C++ - Constructing wrapper class with same syntax as wrapped data
问题 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;