when i open the file and cursor is in the template TypeContainerImpl~~~ or TypeContainer,
the IDE become freezed.
this code should be compiled with Loki.
and VA_IGNORE_THIS_START tricks don't work.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ListAfter
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename TList, typename T>
struct ListAfter
{
typedef typename TList::Tail NextTList;
typedef typename ListAfter<NextTList, T>::Type Type;
};
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
template<typename T, typename Tail>
struct ListAfter< Typelist<T, Tail>, T>
{
typedef Typelist<T, Tail> Type;
};
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
template<typename T>
struct ListAfter<NullType, T>
{
typedef NullType Type;
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// TypeContainer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template< template <class> class T, typename TList >
struct TypeContainerImpl : public TypeContainerImpl<T, typename TList::Tail>
{
typedef typename TList::Head TemplateArgType;
typedef typename TList::Tail NextTList;
typedef T<TemplateArgType> Instance;
typedef TypeContainerImpl<T, NextTList> Parent;
Instance data;
};
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
template< template <class> class T >
struct TypeContainerImpl<T, NullType>
{
};
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
template<template <class> class T, typename Seq>
struct TypeContainer : public TypeContainerImpl<T, typename Seq::Type>
{
typedef typename Seq::Type AllList;
typedef TypeContainerImpl<T, AllList> ImplType;
template<typename U>
struct TypeAccesor
{
typedef typename ListAfter<AllList, U>::Type List;
typedef TypeContainerImpl<T, List> Type;
};
template<unsigned int Index>
struct ToType
{
typedef typename TL::TypeAt<AllList, Index>::Result Type;
};
//-----------------------------------------------------------------------------------------------------------------------------------------------
template<typename U>
T<U>& Get() { return static_cast< typename TypeAccesor<U>::Type* >(const_cast<TypeContainer*>(this))->data; }
template<typename U>
const T<U>& Get() const { return static_cast< const typename TypeAccesor<U>::Type* >(this)->data; }
//-----------------------------------------------------------------------------------------------------------------------------------------------
template<unsigned int Index>
T< typename ToType<Index>::Type >& Get() { return Get< typename ToType<Index>::Type >(); }
template<unsigned int Index>
const T< typename ToType<Index>::Type >& Get() { return Get< typename ToType<Index>::Type >(); }
//-----------------------------------------------------------------------------------------------------------------------------------------------
template<typename U>
operator T<U>&() { return Get<U>(); }
template<typename U>
operator const T<U>&() { return Get<U>(); }
};
//////////////////////////////////////
// Instantiate like this
typedef Loki::Seq<int, doulbe, float> Instances;
typedef TypeContainer<Some_Template_Type, Instances> Container;
Container cont;