mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-05-10 09:23:30 +00:00
add conversion to std::array
This commit is contained in:
parent
cc756cb22d
commit
5bf0907974
1 changed files with 10 additions and 0 deletions
|
@ -67,6 +67,12 @@ namespace sprout {
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
value_type elems[static_size ? static_size : 1];
|
value_type elems[static_size ? static_size : 1];
|
||||||
|
private:
|
||||||
|
template<sprout::index_t... Indexes>
|
||||||
|
SPROUT_CONSTEXPR std::array<T, N>
|
||||||
|
to_std_array(sprout::index_tuple<Indexes...>) const {
|
||||||
|
return std::array<T, N>{{elems[Indexes]...}};
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
// construct/copy/destroy:
|
// construct/copy/destroy:
|
||||||
template<typename T2>
|
template<typename T2>
|
||||||
|
@ -258,6 +264,10 @@ namespace sprout {
|
||||||
return sprout::distance(begin(), p);
|
return sprout::distance(begin(), p);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SPROUT_CONSTEXPR operator std::array<T, N>() const {
|
||||||
|
return to_std_array(sprout::make_index_tuple<N>::make());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
template<typename T, std::size_t N>
|
template<typename T, std::size_t N>
|
||||||
SPROUT_CONSTEXPR_OR_CONST typename sprout::array<T, N>::size_type sprout::array<T, N>::static_size;
|
SPROUT_CONSTEXPR_OR_CONST typename sprout::array<T, N>::size_type sprout::array<T, N>::static_size;
|
||||||
|
|
Loading…
Add table
Reference in a new issue