So I was trying to write a compile time version of FizzBuzz, but I'm having a problem.
And I can't seem to figure it out.
It could be something really simple and stupid, but at this point I'm just kinda getting tunnel vision and could use some fresh eyes if anybody had a second.
I'm compiling with GCC 4.6.1.
Here is the code
And this is the error (though it's recursive, so I'll just post a teensy-bit):
This is kind of out there, so no big deal if I don't get any responses.
FizzBuzz.cpp: In instantiation of 'const char FizzBuzzMetaFunc<98u>::value ':
FizzBuzz.cpp:39:92: recursively instantiated from 'generate_array_impl<98u, FizzBuzzMetaFunc, ((const char*)(& FizzBuzzMetaFunc<99u>::value))>'
FizzBuzz.cpp:39:92: instantiated from 'generate_array_impl<99u, FizzBuzzMetaFunc>'
FizzBuzz.cpp:51:63: instantiated from 'GenerateArray<100u, FizzBuzzMetaFunc>'
FizzBuzz.cpp:66:58: instantiated from here
FizzBuzz.cpp:61:12: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
I can't figure out if I'm doing something totally wrong with the literal strings, or what.
If anybody maybe has GCC and likes this stuff, and want's to tell me how wrong I am, I'd appreciate it!
I'm building it with
If not, thanks anyways! Have a nice day
g++ FizzBuzz.cpp -o buzz.exe -std=c++0x -Wall -Wextra
p.s. - My apologies if the code makes you think "what the hell was he thinking?". At this point, I'm not really sure either.