PolymorphicWrapper(const PolymorphicWrapper& other) { mCopyFunction = other.mCopyFunction; mValue = mCopyFunction(other.mValue); //uses stored lambda to copy }
PolymorphicWrapper& operator=(const PolymorphicWrapper& other) { mCopyFunction = other.mCopyFunction; mValue = mCopyFunction(other.mValue); //uses stored lambda to copy return *this; }
CopyablePolymorphic(const CopyablePolymorphic& other) { mCopyFunction = other.mCopyFunction; mValue = mCopyFunction(other.mValue); //uses stored lambda to copy }