How do templates work?

#1

how do templates work, this is a more c++ oriented question because I have a template class I am declaring before my queue class

template <typename SampleType>
class AudioBufferQueue

I get an error saying redefinition of “AudioBufferQueue”,
and later on i am using the template in the queue push() parameter passing it as a SampleType*

0 Likes

#2

If you’re declaring the template in a header, perhaps your header doesn’t have include guards or #pragma once.

0 Likes

#3

I’m an idiot, that fixed it. Thanks!

0 Likes