add comment and remove unnecessary copy-constructor

release/4.3a0
Varun Agrawal 2025-01-20 10:20:21 -05:00
parent 7eb5ad67e3
commit 36758a818f
2 changed files with 1 additions and 2 deletions

View File

@ -48,6 +48,7 @@
*/ */
#ifdef __GNUC__ #ifdef __GNUC__
#if __GNUC__ >= 7 && __cplusplus >= 201703L #if __GNUC__ >= 7 && __cplusplus >= 201703L
// Based on https://github.com/borglab/gtsam/issues/1738, we define U as a complete type.
namespace boost { namespace serialization { struct U{}; } } namespace boost { namespace serialization { struct U{}; } }
namespace std { template<> struct is_trivially_default_constructible<boost::serialization::U> : std::false_type {}; } namespace std { template<> struct is_trivially_default_constructible<boost::serialization::U> : std::false_type {}; }
namespace std { template<> struct is_trivially_copy_constructible<boost::serialization::U> : std::false_type {}; } namespace std { template<> struct is_trivially_copy_constructible<boost::serialization::U> : std::false_type {}; }

View File

@ -60,8 +60,6 @@ public:
TestOptionalStruct() = default; TestOptionalStruct() = default;
TestOptionalStruct(const int& opt) TestOptionalStruct(const int& opt)
: opt(opt) {} : opt(opt) {}
// A copy constructor is needed for serialization
TestOptionalStruct(const TestOptionalStruct& other) = default;
bool operator==(const TestOptionalStruct& other) const { bool operator==(const TestOptionalStruct& other) const {
// check the values are equal // check the values are equal
return *opt == *other.opt; return *opt == *other.opt;