Constant template parameter class manages to link externally

Posted by the_drow on Stack Overflow See other posts from Stack Overflow or by the_drow
Published on 2010-05-15T22:13:23Z Indexed on 2010/05/15 22:20 UTC
Read the original article Hit count: 191

Filed under:
|

I have a class foo with an enum template parameter and for some reason it links to two versions of the ctor in the cpp file.

enum Enum
{
    bar,
    baz
};

template <Enum version = bar>
class foo
{
public:
    foo();
};

// CPP File
#include "foo.hpp"

foo<bar>::foo() { cout << "bar"; }
foo<baz>::foo() { cout << "baz"; }

I'm using msvc 2008, is this the standard behavior?
Are only type template parameters cannot be linked to cpp files?

© Stack Overflow or respective owner

Related posts about c++

Related posts about templates