MetaWare High C/C++ Compiler R2.6 (c) Copyright 1987-94, MetaWare Incorporated E "primes.cpp",L16/C63(#416): prim | Type `enum{}´ can´t be converted to txpe `D<2>´ ("primes.cpp",L2/C25). -- Detected during instantiation of Prime_print<30> at "primes.cpp",L21/C5: E "primes.cpp",L11/C25(#416): prim | Type `enum{}´ can´t be converted to txpe `D<3>´ ("primes.cpp",L2/C25). -- Detected during instantiation of Prime_print<30> at "primes.cpp",L21/C5: E "primes.cpp",L11/C25(#416): prim | Type `enum{}´ can´t be converted to txpe `D<5>´ ("primes.cpp",L2/C25). -- Detected during instantiation of Prime_print<30> at "primes.cpp",L21/C5: E "primes.cpp",L11/C25(#416): prim | Type `enum{}´ can´t be converted to txpe `D<7>´ ("primes.cpp",L2/C25). -- Detected during instantiation of Prime_print<30> at "primes.cpp",L21/C5: E "primes.cpp",L11/C25(#416): prim | Type `enum{}´ can´t be converted to txpe `D<11>´ ("primes.cpp",L2/C25). -- Detected during instantiation of Prime_print<30> at "primes.cpp",L21/C5: E "primes.cpp",L11/C25(#416): prim | Type `enum{}´ can´t be converted to txpe `D<13>´ ("primes.cpp",L2/C25). -- Detected during instantiation of Prime_print<30> at "primes.cpp",L21/C5: E "primes.cpp",L11/C25(#416): prim | Type `enum{}´ can´t be converted to txpe `D<17>´ ("primes.cpp",L2/C25). -- Detected during instantiation of Prime_print<30> at "primes.cpp",L21/C5: E "primes.cpp",L11/C25(#416): prim | Type `enum{}´ can´t be converted to txpe `D<19>´ ("primes.cpp",L2/C25). -- Detected during instantiation of Prime_print<30> at "primes.cpp",L21/C5: E "primes.cpp",L11/C25(#416): prim | Type `enum{}´ can´t be converted to txpe `D<23>´ ("primes.cpp",L2/C25). -- Detected during instantiation of Prime_print<30> at "primes.cpp",L21/C5: E "primes.cpp",L11/C25(#416): prim | Type `enum{}´ can´t be converted to txpe `D<29>´ ("primes.cpp",L2/C25).
<source>:12: error: initializing argument 1 of 'D<i>::D(void*) [with int i = 17]' ... <source>:12: error: initializing argument 1 of 'D<i>::D(void*) [with int i = 13]' ... <source>:12: error: initializing argument 1 of 'D<i>::D(void*) [with int i = 11]' ... <source>:12: error: initializing argument 1 of 'D<i>::D(void*) [with int i = 7]' ... <source>:12: error: initializing argument 1 of 'D<i>::D(void*) [with int i = 5]' ... <source>:12: error: initializing argument 1 of 'D<i>::D(void*) [with int i = 3]' ... <source>:12: error: initializing argument 1 of 'D<i>::D(void*) [with int i = 2]'
test.cpp: In instantiation of 'struct DbgPrintType<prime_values<17, 13, 11, 7, 5, 3, 2> >': test.cpp:62:3: required from here test.cpp:53:24: warning: comparison of integer expressions of different signedness: 'long long unsigned int' and 'int' [-Wsign-compare] 53 | enum { n = sizeof(T) > -1 }; | ~~~~~~~~~~^~~~
在后面的内容中,我们首先将接触到序列和元函数的概念以及它们的习惯用法。然后我们会使用序列和元函数完成基本的判断和循环操作。以上是模板元编程的基础部分,在此之后我们将实现一套轻量级的模板元编程库YAMPL(Yet Another MPL),YAMPL在接口上将非常接近Boost的MPL。请注意,实现YAMPL的目的并不是取代MPL,而是让我们牢牢掌握模板元编程的一种手段。