#include #include #include #include #include #include #include #include #include #include #include namespace te = boost::type_erasure; namespace mpl = boost::mpl; using deobject = te::any< mpl::vector< te::copy_constructible< te::_self >, te::ostreamable< >, te::relaxed >, te::_self >; struct IPrintMyCtors { std::string name { "IPrintMyCtors" }; IPrintMyCtors() { std::cout << "ctor" << std::endl; } IPrintMyCtors( IPrintMyCtors const & other) { std::cout << "copy ctor" << std::endl; name = other.name; } IPrintMyCtors( IPrintMyCtors && other) = default; }; std::ostream & operator<<(std::ostream &os, IPrintMyCtors const & et) { os << et.name; return os; } using dobject_container = std::vector ; std::ostream & operator<<(std::ostream &os, dobject_container const & c) { os << "" << std::endl; for (auto const & e : c) { os << ""; os << e; os << "\n"; } os << "" << std::endl; return os; } int main( int argc, char *argv[] ) { dobject_container first_container; deobject a(10); deobject b(1.9); deobject c(first_container); first_container.push_back(10); first_container.push_back(1.9); first_container.push_back(std::string("I am a string on the first container")); first_container.push_back(IPrintMyCtors()); first_container.push_back(7); dobject_container second_container; second_container.push_back(4); second_container.push_back(std::string("I am a string on the second container")); std::cout << "Appending first_container to second_container\n"; second_container.push_back(first_container); first_container.push_back(9); std::cout << "Printing the second_container\n"; std::cout << second_container; return 0; }