Help with C++ template specialization...

Joined
Nov 5, 2014
Messages
2
Reaction score
1
Rather than fabricate up special undecipherable abstract examples, here is some code directly out of the project on which I'm currently working. Here is the template declaration:

template<class Precision, class VoiceClass, int32 numChannels, int32 maxVoices, class GlobalParameterStorage>
VoiceProcessorImplementation<Precision, VoiceClass, numChannels, maxVoices, GlobalParameterStorage>::VoiceProcessorImplementation (float sampleRate, GlobalParameterStorage* globalParameters)
{
}

Here is the calling code which invokes it:

voiceProcessor = new VoiceProcessorImplementation<float, Voice<float>, 2, MAX_VOICES, GlobalParameterState> ((float)processSetup.sampleRate, &paramState);

This is working. I didn't actually write this code, it's from an example project I used as a "starting point" for my own project.

Here is what I want to change - in the template declaration (parameter list), VoiceClass is a parameter which represents a class with a constructor expecting no arguments. I have changed the signature of the constructor of VoiceClass so that it now expects a single parameter/argument, of class XXX.

How do I syntactically change these two statements (above) so the invoking call will pass a single argument of class XXX to the template, which will in turn pass that argument on the VoiceClass constructor?

I am embarrassed to admit how much time I have wasted trying to figure this out. Pages and pages of documents of cryptic articles on C++ templates and template specialization have been digested, and I'm as confused as ever.

Can anyone help me? Please, if possible, no long winded abstractions on the finer points of C++, my brain is tired. I just need to get this undoubtedly simple syntactical change in place so I can continue with my project.

Thanks in advance! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,807
Latest member
ryef

Latest Threads

Top