martinmoene / optional-lite

optional lite - A C++17-like optional, a nullable object for C++98, C++11 and later in a single-file header-only library
Boost Software License 1.0
403 stars 45 forks source link

Propagating copy-constructor triviality #76

Open matthew-wozniczka opened 1 year ago

matthew-wozniczka commented 1 year ago

I noticed I wasn't able to instantiate std::atomic<nonstd::optional<int>> in Visual Studio 2019 because std::is_trivially_copyable wasn't true for nonstd::optional<int>

There's a defect report for this: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0602r1.html (Not sure if it was actually accepted into the standard? But at least Microsoft implemented it in their STL implementation https://learn.microsoft.com/en-us/cpp/overview/what-s-new-for-cpp-2017?view=msvc-170 )

martinmoene commented 1 year ago

Thanks for the heads-up.

Had a brief look at it. It may not be a 'trivial' change, requiring a bit of probing how I'd like to approach this.

May take some time.