开发者

Constant template parameter class manages to link externally

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?


You are specializing both forms of the contstructor. Why are you surprised it links both forms in?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜