Skip to content

Commit

Permalink
Array: Added missing constraint to single value constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
JanosGit committed Feb 26, 2024
1 parent 4133c9d commit 46b3b97
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions include/vctr/Containers/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,18 @@ class Array : public VctrBase<ElementType, std::array<ElementType, storageExtent
Vctr::storage.fill (initialValue);
}

/** Creates an Array with extent 1 from an initial value. */
template <std::convertible_to<ElementType> T>
constexpr Array (T&& initialValue)
requires (extent == 1)
: Vctr (StdArrayType { initialValue }) {}

/** Creates an Array from a list of at least two initial values. */
template <is::suitableInitializerForElementType<ElementType>... T>
requires (sizeof...(T) > 1)
constexpr Array (T&&... initialValues) : Vctr (StdArrayType { std::forward<T> (initialValues)... })
{}

/** Creates an Array with extent 1 from an initial value. */
template <std::convertible_to<ElementType> T>
constexpr Array (T&& initialValues) : Vctr (StdArrayType { initialValues }) {}

/** Creates an Array by moving a std::array into it */
template <class OtherElementType, size_t otherSize>
constexpr Array (std::array<OtherElementType, otherSize>&& other) : Vctr (std::move (other)) {}
Expand Down

0 comments on commit 46b3b97

Please sign in to comment.