// Copyright Jason Rice 2020 // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) #include #include #include #include namespace hana = boost::hana; namespace { template struct optional { T t; }; template constexpr bool operator==(optional const& o, T const& t) { return o.t == t; } template constexpr bool operator==(T const& t, optional const& o) { return o.t == t; } template constexpr bool operator!=(optional const& o, T const& t) { return o.t != t; } template constexpr bool operator!=(T const& t, optional const& o) { return o.t != t; } } int main() { boost::hana::tuple x{}; optional> attr{x}; assert(attr == x); // <-- Kablooey! }