I'm making a template class that is a wrapper around some type of data. I would like to be able to set / construct this class the same way as I set that data when it's not wrapped.
Here's the basic idea:
template<typename T> class WrapperClass{
public:
T data;
WrapperClass(const T& _data) : data( _data) {}
// others stuff
};
Now with something like an integer, I can do this:
WrapperClass<int> wrapped_data = 1;
But with a struct or class I don't know how:
struct SomeStruct{
int a, b, c;
SomeStruct(int _a, int _b, int _c) {/*...*/}
};
//Would like to set the wrapped struct the same way as normal struct:
SomeStruct some_struct1 = { 1,2,3};
SomeStruct some_struct2( 1,2,3);
WrapperClass<SomeStruct> wrapped_struct1( {1,2,3}); //OK
WrapperClass<SomeStruct> wrapped_struct2 = {1,2,3}; //ERROR
WrapperClass<SomeStruct> wrapped_struct3( 1,2,3); //ERROR
Is there a way to somehow forward the parameters so I can do that latter syntax without an error?