This is a simplified version of my type system:
#include
#include
template
class Box {
public:
Box(const T&a
You could use a helper function that creates the corresponding type:
template
Box make_boxed(const R& value){
return Box(value);
}
it may seem like additional complication that one has to specify the T
, on the other hand you can use auto
for the returned type. Complete example:
#include
template
class Box {
public:
Box(const T& value) : _value(value) {};
private:
T _value;
/* ... */
};
typedef Box String;
int main(int argc, char* argv[]) {
auto a = make_boxed("asd");
}