0

I currently have something like this that works fine in Visual Studio however I get the following error in Mingw

error: specializing member '{anonymous}::Buffer<{anonymous}::VertexBufferFactory, IDirect3DVertexBuffer9*, ktVertexBuffer>::applyBuffer' requires 'template<>' syntax
 void VertexBuffer::applyBuffer(uint32_t no, uint32_t stride, uint32_t offset)
      ^

The code is

typedef Buffer<VertexBufferFactory, ddVertexBuffer,VertexBuffer> VertexBuffer;

void VertexBuffer::applyBuffer(uint32_t no, uint32_t stride, uint32_t offset)
{
    Gpu::ddSetStreamSource(no, buffer, offset, stride);
}

The template declaration of buffer is

template <class FACTORY, class BUFFER, class BASE>
class Buffer : public BASE {
}

Any suggestions on why I am getting this error and how to resolve it ?

James Franco
  • 4,516
  • 10
  • 38
  • 80
  • 3
    It would be easier to help if you could provide a complete example, including at least the template declaration for `Buffer`. Try to reduce the code down to the absolute minimum that is required to reproduce the error, though. Please see [How to create a Minimal, Complete, and Verifiable example?](https://stackoverflow.com/help/mcve) – 5gon12eder Mar 13 '15 at 17:26
  • possible duplicate of [specializing member S::display requires ‘template<>’ syntax](http://stackoverflow.com/questions/16493187/specializing-member-sdisplay-requires-template-syntax) – Captain Obvlious Mar 13 '15 at 17:26

1 Answers1

1

It seems that you're defining a member (applyBuffer) of a (fully) specialised class template (Buffer). The syntax for that uses template<> as in

template<>
void Buffer<VertexBufferFactory, ddVertexBuffer,VertexBuffer>
::applyBuffer(uint32_t no, uint32_t stride, uint32_t offset)
{
    Gpu::ddSetStreamSource(no, buffer, offset, stride);
}
Walter
  • 44,150
  • 20
  • 113
  • 196