mirror of
https://github.com/slendidev/smath.git
synced 2025-12-11 12:59:53 +02:00
Create unpacking function for vectors
Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
@@ -162,6 +162,16 @@ public:
|
||||
VEC_ACC(v, 2, 1)
|
||||
#undef VEC_ACC
|
||||
|
||||
template <class... Args, std::size_t... Is>
|
||||
constexpr void unpack_impl(std::index_sequence<Is...>,
|
||||
Args &...args) noexcept {
|
||||
((args = (*this)[Is]), ...);
|
||||
}
|
||||
|
||||
template <class... Args> constexpr void unpack(Args &...args) noexcept {
|
||||
unpack_impl(std::index_sequence_for<Args...>{}, args...);
|
||||
}
|
||||
|
||||
// Unary
|
||||
constexpr auto operator-() noexcept -> Vec {
|
||||
Vec r{};
|
||||
|
||||
Reference in New Issue
Block a user