// This is an example of duck typing. // // A vector requires that its stored type be copyable, both via copy ctor and // assignment operator, but the class that we’re storing is not copyable. // // Observe what a splendid error message is produced! #include class Mom { public: Mom() = default; // I like the default ctor. Mom(const Mom &) = delete; // You can’t change Mom! Mom& operator=(const Mom &) = delete; // You can’t change Mom! }; int main() { std::vector v; Mom helen; v.push_back(helen); return 0; }