Added MakeTypelist

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@57 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
magmaikh 2002-10-07 05:37:20 +00:00
parent 41a466c1b2
commit 0fd2f91c64
2 changed files with 59 additions and 6 deletions

View file

@ -13,7 +13,8 @@
// without express or implied warranty. // without express or implied warranty.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Last update: May 19, 2002 // Last update: Oct 10, 2002
//MSVC7
#ifndef TYPELIST_INC_ #ifndef TYPELIST_INC_
#define TYPELIST_INC_ #define TYPELIST_INC_
@ -373,7 +374,7 @@ namespace Loki
// class template MakeTypelist // class template MakeTypelist
// Takes a number of arguments equal to its numeric suffix // Takes a number of arguments equal to its numeric suffix
// The arguments are type names. // The arguments are type names.
// MakeTypeList<T1, T2, ...>::Result // MakeTypelist<T1, T2, ...>::Result
// returns a typelist that is of T1, T2, ... // returns a typelist that is of T1, T2, ...
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -386,10 +387,10 @@ namespace Loki
typename T13 = NullType, typename T14 = NullType, typename T15 = NullType, typename T13 = NullType, typename T14 = NullType, typename T15 = NullType,
typename T16 = NullType, typename T17 = NullType, typename T18 = NullType typename T16 = NullType, typename T17 = NullType, typename T18 = NullType
> >
struct MakeTypeList struct MakeTypelist
{ {
private: private:
typedef typename MakeTypeList typedef typename MakeTypelist
< <
T2 , T3 , T4 , T2 , T3 , T4 ,
T5 , T6 , T7 , T5 , T6 , T7 ,
@ -405,7 +406,7 @@ namespace Loki
}; };
template<> template<>
struct MakeTypeList struct MakeTypelist
< <
NullType, NullType, NullType, NullType, NullType, NullType,
NullType, NullType, NullType, NullType, NullType, NullType,
@ -1053,6 +1054,7 @@ typedef char _type_##_is_not_a_Typelist[true]
// (credit due to Dave Taylor) // (credit due to Dave Taylor)
// June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! // June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!!
// May 10, 2002: ported by Rani Sharoni to VC7 (RTM - 9466) // May 10, 2002: ported by Rani Sharoni to VC7 (RTM - 9466)
// Oct 10, 2002: added MakeTypelist (SGB/MKH)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#endif // TYPELIST_INC_ #endif // TYPELIST_INC_

View file

@ -13,7 +13,8 @@
// without express or implied warranty. // without express or implied warranty.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Last update: November 22, 2001 // Last update: October 10, 2002
//Reference
#ifndef TYPELIST_INC_ #ifndef TYPELIST_INC_
#define TYPELIST_INC_ #define TYPELIST_INC_
@ -369,6 +370,55 @@ namespace Loki
namespace TL namespace TL
{ {
////////////////////////////////////////////////////////////////////////////////
// class template MakeTypelist
// Takes a number of arguments equal to its numeric suffix
// The arguments are type names.
// MakeTypelist<T1, T2, ...>::Result
// returns a typelist that is of T1, T2, ...
////////////////////////////////////////////////////////////////////////////////
template
<
typename T1 = NullType, typename T2 = NullType, typename T3 = NullType,
typename T4 = NullType, typename T5 = NullType, typename T6 = NullType,
typename T7 = NullType, typename T8 = NullType, typename T9 = NullType,
typename T10 = NullType, typename T11 = NullType, typename T12 = NullType,
typename T13 = NullType, typename T14 = NullType, typename T15 = NullType,
typename T16 = NullType, typename T17 = NullType, typename T18 = NullType
>
struct MakeTypelist
{
private:
typedef typename MakeTypelist
<
T2 , T3 , T4 ,
T5 , T6 , T7 ,
T8 , T9 , T10,
T11, T12, T13,
T14, T15, T16,
T17, T18
>
::Result TailResult;
public:
typedef Typelist<T1, TailResult> Result;
};
template<>
struct MakeTypelist
<
NullType, NullType, NullType,
NullType, NullType, NullType,
NullType, NullType, NullType,
NullType, NullType, NullType,
NullType, NullType, NullType,
NullType, NullType, NullType
>{
typedef NullType Result;
};
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// class template Length // class template Length
// Computes the length of a typelist // Computes the length of a typelist
@ -752,6 +802,7 @@ namespace Loki
// (rather than the SUPERSUBCLASS macro). // (rather than the SUPERSUBCLASS macro).
// Minor fix in Reverse, adding support for empty lists, like all the other // Minor fix in Reverse, adding support for empty lists, like all the other
// algorithms. T.S. // algorithms. T.S.
// Oct 10, 2002: added MakeTypelist (SGB/MKH)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#endif // TYPELIST_INC_ #endif // TYPELIST_INC_