Skip to content

Commit

Permalink
Merge pull request #9638
Browse files Browse the repository at this point in the history
cb54a0a ci: common: remove duplicated definition (tobtoht)
  • Loading branch information
luigi1111 committed Dec 23, 2024
2 parents 06ab84d + cb54a0a commit 941ecef
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions src/common/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,35 +214,4 @@ class optional_variant: public variant<boost::blank, Types...>
bool is_empty() const noexcept { return this->index() == 0; }
};

template <typename... Types>
class optional_variant: public variant<boost::blank, Types...>
{
public:
//constructors
/// default constructor
optional_variant() = default;

/// construct from variant type (use enable_if to avoid issues with copy/move constructor)
template <typename T,
typename std::enable_if<
!std::is_same<
std::remove_cv_t<std::remove_reference_t<T>>,
optional_variant<Types...>
>::value,
bool
>::type = true>
optional_variant(T &&value) : variant<boost::blank, Types...>(std::forward<T>(value)) {}

// construct like boost::optional
optional_variant(boost::none_t) {}

//overloaded operators
/// boolean operator: true if the variant isn't empty/uninitialized
explicit operator bool() const noexcept { return !this->is_empty(); }

//member functions
/// check if empty/uninitialized
bool is_empty() const noexcept { return this->index() == 0; }
};

} //namespace tools

0 comments on commit 941ecef

Please sign in to comment.