This Question Determined That a Non-Copyable Type Can\'t Be Used With Boost Variant
Tree
class
template
using Mixed = boost::variant<
std::unique_ptr,
std::unique_ptr,
std::unique_ptr,
std::unique_ptr
>;
int main() {
auto md = std::unique_ptr(new int(123));
Mixed mixed = std::move(md);
std::cout << *boost::get< std::unique_ptr >(mixed) << std::endl;
return 0;
}
unique_ptr is move-only and can be used in variant. The above example can compile and work (C++11).