1

I want to make a simple message template class as follows. I followed the structure verbatim from the chosen answer posted here. However, this seems to break in Visual Studio 2013.

template<typename T> Message;

template<> Message <std::vector<uint8_t>>
{
public:

};

template<> Message <std::string>
{

};

IntelliSense tells me that Message is not a template.

Placing class before Message in the forward declaration results in a slightly better, but equally annoying IntelliSense error: expected and identifierafter the opening brace { of each template.

template<typename T> class Message;

template<> Message <std::vector<uint8_t>>
{
public:

};

template<> Message <std::string>
{

};

I should note that all the above code is currently being placed in a header file.

Community
  • 1
  • 1
audiFanatic
  • 2,296
  • 8
  • 40
  • 56

1 Answers1

1

You need to include the class keyword in the template specialization as well. I don't know why the linked answer doesn't do that.

template<typename T> class Message;

template<> class Message <std::vector<uint8_t>>
{
public:

};

template<> class Message <std::string>
{

};
Xirema
  • 19,889
  • 4
  • 32
  • 68