I ran into a small problem (easily solvable) when writing C ++ 03 template code, which usually compiles, which will not compile when using the C ++ 11 dialect.
The problem occurs when resolving template parameters. Let this code be an example of this:
template <uint32_t number>
struct number_of_bits {
enum {
value = 1 + number_of_bits<number >> 1>::value
};
};
template <>
struct number_of_bits<0> {
enum {
value = 0
};
};
Since C ++ 11 now allows "→" to complete the list of template parameters, which takes the template parameter as the last argument, it creates a problem when analyzing this code.
I use GCC (version 4.8.1) as my compiler, and it usually compiles using the command line:
g++ test.cc -o test
But it does not compile when I add a command line switch -std=c++11:
g++ -std=c++11 test.cc -o test
++ 11 GCC? , ?