mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-06 10:46:18 +08:00
Wrap C arrays with rfl::Array.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#ifndef RFL_ARRAY_HPP_
|
||||
#define RFL_ARRAY_HPP_
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include "internal/to_std_array.hpp"
|
||||
|
||||
namespace rfl {
|
||||
|
||||
template <class T>
|
||||
requires std::is_array_v<T>
|
||||
struct Array : internal::to_std_array_t<T> {
|
||||
using Type = T;
|
||||
using Base = internal::to_std_array_t<T>;
|
||||
using Base::Base;
|
||||
|
||||
Array() = default;
|
||||
Array(const Base &t) : Base(t) {}
|
||||
Array(Base &&t) : Base(std::move(t)) {}
|
||||
Array(const T &t) : Base(reinterpret_cast<const Base &>(t)) {}
|
||||
Array(T &&t) : Base(reinterpret_cast<Base &&>(t)) {}
|
||||
};
|
||||
|
||||
} // namespace rfl
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user