Re: specialized constructor in specialized class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 29 June 2010 08:54, Frank Winter <frank.winter@xxxxxxx> wrote:
>
> Sorry, this did not solve it. The error message then
> occurs 2 times. For each occurence of template<>
>

Ah, right -- I was taking the completely wrong approach for constructors.

Why specialize?  Just overload it :)

template <typename T>
struct S;

template <>
struct S<double> {
    template <typename U>
    S(U) { cout << "nope"; }
    S(int) { cout << "yup"; }
};

int main() {
    S<double> s1(1);
    S<double> s2(true);
}

<http://codepad.org/k4v4oucl>

~ Scott


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux