I have this code that doesn\'t work, but I think the intent is clear:
testmakeshared.cpp
#include
class A {
public:
stat
If you also want to enable a constuctor that takes arguments, this may help a bit.
#include
#include
template
struct enable_make : public S
{
template
enable_make(T&&... t)
: S(std::forward(t)...)
{
}
};
class foo
{
public:
static std::unique_ptr create(std::unique_ptr u, char const* s)
{
return std::make_unique>(std::move(u), s);
}
protected:
foo(std::unique_ptr u, char const* s)
{
}
};
void test()
{
auto fp = foo::create(std::make_unique(3), "asdf");
}