Thread: template fn replacements for msg macros

  1. #16
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Waterloo, Texas
    That was one way I attempted to do it. Problem? My compiler choked! The message was:

    "Internal compiler error."
    "Please submit a full bug report."

    Ha! You know you're really desperate when you've pushed the compiler that far!

    Anyway, I solved the problem by implementing an ingenious but simple functor algorithm.

    Hey if you like templates you should check out this site. It shows you how to use the compilation process as a meta-program using templates! This one guy wrote a class that when compiled, returned several errors, which, when viewed together, gave you a table of prime numbers! Quite interesting!

    Damn! Can't find the bookmark. I'll get back to you with that URL, if you're interested.
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
        return std::pow
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;

  2. #17
    Join Date
    Jan 2002
    Thanks JoeSixpack for your suggestion.

    And thanks, too, FYB, for your detailed and most interesting suggestions. The 'subtlety' I was joking about was your use of 'UC' for 'you see' in the context of obfuscation versus clarity - I thought you made your point very well and quite amusingly. I apologise for any offence my 'picky' and sometimes wicked sense of humour may have caused you - I really do appreciate your input.
    I tried this and it actually calls the fn in current scope and not the base one as intended (see original post).

    Your second and third suggestions, FYB, look very interesting/promising indeed.

    But it looks like Sebastiani has already been there and killed a compiler with it.

    >>Anyway, I solved the problem by implementing an ingenious but simple functor algorithm.<<

    Looks like 'functors' it is then...

    Thanks again, everyone for all your input so far. It's given me a lot more to think about. Appreciated.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #18
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    I'm curious about the compiler error you speak of. what about my example with class A, B, and C? does that kill your compiler? it shouldn't. I actually tried it and compiled fine.

    I've actually spent some time thinking about this design in fact and it may proove to be a good starting point for a "Windows Template Library" WTL? All classes would be derived from some number of template classes.... hmmm...
    Last edited by FillYourBrain; 10-30-2002 at 07:59 AM.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 09:42 PM
  2. Specialising a member function with a template template parameter
    By the4thamigo_uk in forum C++ Programming
    Replies: 10
    Last Post: 10-12-2007, 04:37 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  5. oh me oh my hash maps up the wazoo
    By DarkDays in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 12:54 PM