Thread: What do you like least about C++?

  1. #16
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by MarkZWEERS View Post
    No default types for template arguments
    Ah, but you can have default types for template arguments (I assume you mean the template types inside the template<> part?). For classes it works, but not for functions (that's a shame).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #17
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    mandatory specialisation of all arguments following a one which has been specialised
    What? O_o

    Example?

    Soma

  3. #18
    Registered User
    Join Date
    May 2008
    Location
    Paris
    Posts
    248
    but not for functions
    Yeah, that's exactly what I mean....

    Josuttis an Vandevoorde mention in their book "C++ Templates" that very, very probably the next standard will allow default types for template arguments, as well as a 'double' as non-type template argument. They say that there are no technical difficulties in doing so. Can't wait...

  4. #19
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I agree. C++ is missing that one
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #20
    Registered User
    Join Date
    May 2008
    Location
    Paris
    Posts
    248
    Example?
    pseudo-code
    Code:
    template<typename T1, typename T2> 
      class TestClass {
        ....
      __  function();
      }
    template<typename T2>  // partial specialisation for first template argument, #error!
    __ class<char, T2> :: function()
    What if I've designed my template class, later I decide to add a function 'function' with only its first argument specialised? As far as I know, after a partial specialisation everything has to be specialised.

    Henceforth, this will work:

    Code:
    template<typename T1>  // partial specialisation for second template argument, OK
    __ class<T1, char> :: function()
    EDIT: This is especially horrible with traits... along the road you discover over and over again the "correct" order of the arguments
    Last edited by MarkZWEERS; 06-10-2008 at 02:22 PM. Reason: added comments in code

Popular pages Recent additions subscribe to a feed