differences between Partial Explicit Specializations

This is a discussion on differences between Partial Explicit Specializations within the C++ Programming forums, part of the General Programming Boards category; Hi I am reading template chapter in c++. We can specizlize a primary template both Partial and Explicit. But what ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    61

    differences between Partial Explicit Specializations

    Hi
    I am reading template chapter in c++.
    We can specizlize a primary template both Partial and Explicit.
    But what are the differences?Advantages and disadvantages.?

    Thanks

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,574
    A partial template is a version of a class template where some (not all) of the template parameters are specified. The advantages are obvious, since you may want to "fix" some of the parameters to certain data types.

    Code:
    template <class myClass1, class myClass2>
    class some_template {
        /* ... */
    };
    
    // a partial specialization: fixes 2nd parameter as int. First parameter varies
    template <class myClass1>
    class some_template<myClass1, int> {
        /* ... */
    };
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. More explicit template member function hell
    By SevenThunders in forum C++ Programming
    Replies: 1
    Last Post: 03-17-2009, 11:36 PM
  2. stdio differences windows vs linux
    By keira in forum C Programming
    Replies: 6
    Last Post: 09-14-2008, 05:42 PM
  3. Interesting behavior with explicit copy constructor
    By Clairvoyant1332 in forum C++ Programming
    Replies: 1
    Last Post: 04-28-2008, 04:19 PM
  4. Replies: 6
    Last Post: 08-12-2007, 02:02 PM
  5. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 09:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21