Skip to content

Commit

Permalink
[Type] Convert enable_if to concepts in fixed_array (#5205)
Browse files Browse the repository at this point in the history
  • Loading branch information
alxbilger authored Jan 17, 2025
1 parent 1072217 commit 3635db7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Sofa/framework/Type/src/sofa/type/fixed_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,16 @@ class fixed_array
constexpr fixed_array() {}

/// Specific constructor for 1-element vectors.
template<size_type NN = N, typename std::enable_if<NN == 1, int>::type = 0>
explicit constexpr fixed_array(value_type r1) noexcept
requires (N == 1)
{
elems[0] = r1;
}

template<typename... ArgsT,
typename = std::enable_if_t< (std::is_convertible_v<ArgsT, value_type> && ...) >,
typename = std::enable_if_t< (sizeof...(ArgsT) == N && sizeof...(ArgsT) > 1) >
>
template<typename... ArgsT>
constexpr fixed_array(ArgsT&&... r) noexcept
: elems{static_cast<value_type>(std::forward< ArgsT >(r))...}
requires ((std::convertible_to<ArgsT, value_type> && ...) && sizeof...(ArgsT) == N && sizeof...(ArgsT) > 1)
: elems{static_cast<value_type>(std::forward<ArgsT>(r))...}
{}

// iterator support
Expand Down

0 comments on commit 3635db7

Please sign in to comment.