Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
serges147 committed Jun 4, 2024
1 parent 4c754a5 commit 9ea0198
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions include/cetl/unbounded_variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1002,8 +1002,9 @@ class unbounded_variant : detail::base_move<Pmr, Footprint, Copyable, Movable, A
///
/// In use by several \ref cetl::unbounded_variant constructors.
///
/// Can't use directly either of already existing `std::in_place_type_t` or `cetl::pf17::in_place_type_t` types due to
/// C++14 limitation and polyfill optionality (by design in CETL, according to Scott), so a bit of code duplication.
/// Can't use directly either of already existing `std::in_place_type_t` or `cetl::pf17::in_place_type_t` types due
/// to C++14 limitation and polyfill optionality (by design in CETL, according to Scott), so a bit of code
/// duplication.
///
template <typename T>
struct in_place_type_t
Expand Down Expand Up @@ -1056,12 +1057,12 @@ class unbounded_variant : detail::base_move<Pmr, Footprint, Copyable, Movable, A
/// Its size must be less than or equal to `Footprint` in case of PMR support.
/// \param value Value to be stored.
///
template <typename ValueType,
typename Tp = std::decay_t<ValueType>,
typename PmrAlias = Pmr,
typename = detail::EnableIfNotPmrT<PmrAlias>,
typename = std::enable_if_t<!std::is_same<Tp, unbounded_variant>::value &&
!is_in_place_type<ValueType>::value>>
template <
typename ValueType,
typename Tp = std::decay_t<ValueType>,
typename PmrAlias = Pmr,
typename = detail::EnableIfNotPmrT<PmrAlias>,
typename = std::enable_if_t<!std::is_same<Tp, unbounded_variant>::value && !is_in_place_type<ValueType>::value>>
unbounded_variant(ValueType&& value) // NOLINT(*-explicit-constructor)
{
create<Tp>(std::forward<ValueType>(value));
Expand All @@ -1077,12 +1078,12 @@ class unbounded_variant : detail::base_move<Pmr, Footprint, Copyable, Movable, A
/// \param mem_res Pointer to a memory resource to be used by the variant.
/// \param value Value to be stored.
///
template <typename ValueType,
typename Tp = std::decay_t<ValueType>,
typename PmrAlias = Pmr,
typename = detail::EnableIfPmrT<PmrAlias>,
typename = std::enable_if_t<!std::is_same<Tp, unbounded_variant>::value &&
!is_in_place_type<ValueType>::value>>
template <
typename ValueType,
typename Tp = std::decay_t<ValueType>,
typename PmrAlias = Pmr,
typename = detail::EnableIfPmrT<PmrAlias>,
typename = std::enable_if_t<!std::is_same<Tp, unbounded_variant>::value && !is_in_place_type<ValueType>::value>>
unbounded_variant(Pmr* const mem_res, ValueType&& value)
: base{mem_res}
{
Expand Down Expand Up @@ -1477,7 +1478,8 @@ using unbounded_variant_like = unbounded_variant<sizeof(ValueType),
template <typename ValueType, typename UnboundedVariant = unbounded_variant_like<ValueType>, typename... Args>
CETL_NODISCARD UnboundedVariant make_unbounded_variant(Args&&... args)
{
return UnboundedVariant(UnboundedVariant::template in_place_type<ValueType>, std::forward<Args>(args)...);
using in_place_type_t = UnboundedVariant::template in_place_type_t<ValueType>;
return UnboundedVariant(in_place_type_t{}, std::forward<Args>(args)...);
}

/// \brief Constructs an unbounded_variant object containing an object of type T,
Expand All @@ -1489,7 +1491,8 @@ template <typename ValueType,
typename... Args>
CETL_NODISCARD UnboundedVariant make_unbounded_variant(std::initializer_list<Up> list, Args&&... args)
{
return UnboundedVariant(UnboundedVariant::template in_place_type<ValueType>, list, std::forward<Args>(args)...);
using in_place_type_t = UnboundedVariant::template in_place_type_t<ValueType>;
return UnboundedVariant(in_place_type_t{}, list, std::forward<Args>(args)...);
}

/// \brief Performs type-safe access to the contained object.
Expand Down

0 comments on commit 9ea0198

Please sign in to comment.