beautify tidy comments

This commit is contained in:
BlackMATov
2022-11-09 07:32:20 +07:00
parent 1ec3f5e86a
commit 71ec8b6885
33 changed files with 163 additions and 197 deletions

View File

@@ -13,6 +13,8 @@
#include <type_traits>
#include <utility>
#include "stdex.hpp"
namespace meta_hpp::detail
{
template < typename Function >
@@ -43,11 +45,14 @@ namespace meta_hpp::detail
}
template < typename Functor >
requires (!stdex::same_as<fixed_function, std::decay_t<Functor>>)
// NOLINTNEXTLINE(*-forwarding-reference-overload)
fixed_function(Functor&& functor) {
vtable_t::construct(*this, std::forward<Functor>(functor));
}
template < typename Functor >
requires (!stdex::same_as<fixed_function, std::decay_t<Functor>>)
fixed_function& operator=(Functor&& functor) {
fixed_function{std::forward<Functor>(functor)}.swap(*this);
return *this;
@@ -62,7 +67,7 @@ namespace meta_hpp::detail
}
R operator()(Args... args) const {
assert(vtable_ && "bad function call");
assert(vtable_ && "bad function call"); // NOLINT
return vtable_->call(*this, std::forward<Args>(args)...);
}
@@ -101,13 +106,13 @@ namespace meta_hpp::detail
template < typename T >
static T* buffer_cast(buffer_t& buffer) noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
// NOLINTNEXTLINE(*-reinterpret-cast)
return std::launder(reinterpret_cast<T*>(buffer.data));
}
template < typename T >
static const T* buffer_cast(const buffer_t& buffer) noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
// NOLINTNEXTLINE(*-reinterpret-cast)
return std::launder(reinterpret_cast<const T*>(buffer.data));
}
@@ -115,13 +120,13 @@ namespace meta_hpp::detail
static vtable_t* get() {
static vtable_t table{
.call = +[](const fixed_function& self, Args... args) -> R {
assert(self);
assert(self); // NOLINT
const Fp& src = *buffer_cast<Fp>(self.buffer_);
return std::invoke(src, std::forward<Args>(args)...);
},
.move = +[](fixed_function& from, fixed_function& to) noexcept {
assert(from && !to);
assert(from && !to); // NOLINT
Fp& src = *buffer_cast<Fp>(from.buffer_);
::new (buffer_cast<Fp>(to.buffer_)) Fp(std::move(src));
@@ -131,7 +136,7 @@ namespace meta_hpp::detail
from.vtable_ = nullptr;
},
.destroy = +[](fixed_function& self){
assert(self);
assert(self); // NOLINT
Fp& src = *buffer_cast<Fp>(self.buffer_);
src.~Fp();

View File

@@ -19,7 +19,7 @@ namespace meta_hpp::detail
template < typename T >
[[nodiscard]] std::size_t operator()(std::size_t seed, const T& x) noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers, readability-magic-numbers)
// NOLINTNEXTLINE(*-magic-numbers)
return (seed ^= std::hash<T>{}(x) + 0x9e3779b9 + (seed << 6) + (seed >> 2));
}
};

View File

@@ -17,7 +17,6 @@ namespace meta_hpp::detail
class type_id final {
public:
template < typename T >
// NOLINTNEXTLINE(readability-named-parameter)
explicit type_id(type_list<T>) noexcept
: id_{type_to_id<T>()} {}

View File

@@ -163,6 +163,7 @@ namespace meta_hpp
for ( std::size_t i = 0; i < arguments.size(); ++i ) {
argument& arg = state->arguments[i];
// NOLINTNEXTLINE(*-pointer-arithmetic)
detail::state_access(arg)->name = std::data(arguments)[i];
}
@@ -265,6 +266,7 @@ namespace meta_hpp
for ( std::size_t i = 0; i < arguments.size(); ++i ) {
argument& arg = state->arguments[i];
// NOLINTNEXTLINE(*-pointer-arithmetic)
detail::state_access(arg)->name = std::data(arguments)[i];
}

View File

@@ -12,11 +12,9 @@
namespace meta_hpp
{
// NOLINTNEXTLINE(readability-named-parameter)
inline scope_bind::scope_bind(std::string name, metadata_map metadata, local_tag)
: state_{detail::scope_state::make(std::move(name), std::move(metadata))} {}
// NOLINTNEXTLINE(readability-named-parameter)
inline scope_bind::scope_bind(std::string_view name, metadata_map metadata, static_tag)
: state_{detail::state_access(resolve_scope(name))} {
state_->metadata.swap(metadata);
@@ -84,6 +82,7 @@ namespace meta_hpp
for ( std::size_t i = 0; i < arguments.size(); ++i ) {
argument& arg = state->arguments[i];
// NOLINTNEXTLINE(*-pointer-arithmetic)
detail::state_access(arg)->name = std::data(arguments)[i];
}

View File

@@ -25,6 +25,7 @@ namespace meta_hpp::detail
template < stdex::copy_constructible T >
struct index_traits<T*> {
uvalue operator()(T* v, std::size_t i) const {
// NOLINTNEXTLINE(*-pointer-arithmetic)
return uvalue{v[i]};
}
};
@@ -32,6 +33,7 @@ namespace meta_hpp::detail
template < stdex::copy_constructible T >
struct index_traits<const T*> {
uvalue operator()(const T* v, std::size_t i) const {
// NOLINTNEXTLINE(*-pointer-arithmetic)
return uvalue{v[i]};
}
};

View File

@@ -33,17 +33,16 @@ namespace meta_hpp::detail
virtual ~uarg_base() = default;
template < decay_value_kind T >
// NOLINTNEXTLINE(readability-named-parameter)
// NOLINTNEXTLINE(*-forwarding-reference-overload)
explicit uarg_base(T&&)
: uarg_base{type_list<T&&>{}} {}
template < decay_non_uvalue_kind T >
// NOLINTNEXTLINE(readability-named-parameter)
// NOLINTNEXTLINE(*-forwarding-reference-overload)
explicit uarg_base(T&&)
: uarg_base{type_list<T&&>{}} {}
template < arg_lvalue_ref_kind T >
// NOLINTNEXTLINE(readability-named-parameter)
explicit uarg_base(type_list<T>)
: ref_type_{std::is_const_v<std::remove_reference_t<T>>
? ref_types::const_lvalue
@@ -51,7 +50,6 @@ namespace meta_hpp::detail
, raw_type_{resolve_type<std::remove_cvref_t<T>>()} {}
template < arg_rvalue_ref_kind T >
// NOLINTNEXTLINE(readability-named-parameter)
explicit uarg_base(type_list<T>)
: ref_type_{std::is_const_v<std::remove_reference_t<T>>
? ref_types::const_rvalue
@@ -120,15 +118,17 @@ namespace meta_hpp::detail
~uarg() override = default;
template < decay_value_kind T >
// NOLINTNEXTLINE(*-forwarding-reference-overload)
explicit uarg(T&& v)
: uarg_base{std::forward<T>(v)}
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
// NOLINTNEXTLINE(*-const-cast)
, data_{const_cast<void*>(v.data())} {}
template < decay_non_uvalue_kind T >
// NOLINTNEXTLINE(*-forwarding-reference-overload)
explicit uarg(T&& v)
: uarg_base{std::forward<T>(v)}
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
// NOLINTNEXTLINE(*-const-cast)
, data_{const_cast<std::remove_cvref_t<T>*>(std::addressof(v))} {}
template < typename To >
@@ -141,7 +141,7 @@ namespace meta_hpp::detail
namespace meta_hpp::detail
{
template < typename To >
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
// NOLINTNEXTLINE(*-cognitive-complexity)
bool uarg_base::can_cast_to() const noexcept {
using to_raw_type_cv = std::remove_reference_t<To>;
using to_raw_type = std::remove_cv_t<to_raw_type_cv>;
@@ -245,7 +245,7 @@ namespace meta_hpp::detail
namespace meta_hpp::detail
{
template < typename To >
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
// NOLINTNEXTLINE(*-cognitive-complexity)
To uarg::cast() const {
if ( !can_cast_to<To>() ) {
throw_exception_with("bad argument cast");

View File

@@ -33,17 +33,16 @@ namespace meta_hpp::detail
virtual ~uinst_base() = default;
template < decay_value_kind T >
// NOLINTNEXTLINE(readability-named-parameter)
// NOLINTNEXTLINE(*-forwarding-reference-overload)
explicit uinst_base(T&&)
: uinst_base{type_list<T&&>{}} {}
template < decay_non_uvalue_kind T >
// NOLINTNEXTLINE(readability-named-parameter)
// NOLINTNEXTLINE(*-forwarding-reference-overload)
explicit uinst_base(T&&)
: uinst_base{type_list<T&&>{}} {}
template < inst_class_lvalue_ref_kind T >
// NOLINTNEXTLINE(readability-named-parameter)
explicit uinst_base(type_list<T>)
: ref_type_{std::is_const_v<std::remove_reference_t<T>>
? ref_types::const_lvalue
@@ -51,7 +50,6 @@ namespace meta_hpp::detail
, raw_type_{resolve_type<std::remove_cvref_t<T>>()} {}
template < inst_class_rvalue_ref_kind T >
// NOLINTNEXTLINE(readability-named-parameter)
explicit uinst_base(type_list<T>)
: ref_type_{std::is_const_v<std::remove_reference_t<T>>
? ref_types::const_rvalue
@@ -120,15 +118,17 @@ namespace meta_hpp::detail
~uinst() override = default;
template < decay_value_kind T >
// NOLINTNEXTLINE(*-forwarding-reference-overload)
explicit uinst(T&& v)
: uinst_base{std::forward<T>(v)}
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
// NOLINTNEXTLINE(*-const-cast)
, data_{const_cast<void*>(v.data())} {}
template < decay_non_uvalue_kind T >
// NOLINTNEXTLINE(*-forwarding-reference-overload)
explicit uinst(T&& v)
: uinst_base{std::forward<T>(v)}
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
// NOLINTNEXTLINE(*-const-cast)
, data_{const_cast<std::remove_cvref_t<T>*>(std::addressof(v))} {}
template < inst_class_ref_kind Q >

View File

@@ -136,7 +136,7 @@ namespace meta_hpp::detail
}
[[nodiscard]] inline const void* pointer_upcast(const void* ptr, const class_type& from, const class_type& to) {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
// NOLINTNEXTLINE(*-const-cast)
return pointer_upcast(const_cast<void*>(ptr), from, to);
}

View File

@@ -31,13 +31,11 @@ namespace meta_hpp
namespace meta_hpp
{
template < typename T >
// NOLINTNEXTLINE(readability-named-parameter)
[[nodiscard]] auto resolve_type(T&&) {
return resolve_type<std::remove_reference_t<T>>();
}
template < typename... Ts >
// NOLINTNEXTLINE(readability-named-parameter)
[[nodiscard]] std::vector<any_type> resolve_types(type_list<Ts...>) {
return { resolve_type<Ts>()... };
}

View File

@@ -36,7 +36,6 @@ namespace meta_hpp::detail
throw_exception_with("an attempt to call a constructor with an incorrect arity");
}
// NOLINTNEXTLINE(readability-named-parameter)
return [args]<std::size_t... Is>(std::index_sequence<Is...>) -> uvalue {
if ( !(... && args[Is].can_cast_to<type_list_at_t<Is, argument_types>>()) ) {
throw_exception_with("an attempt to call a constructor with incorrect argument types");
@@ -68,7 +67,6 @@ namespace meta_hpp::detail
return false;
}
// NOLINTNEXTLINE(readability-named-parameter)
return [args]<std::size_t... Is>(std::index_sequence<Is...>){
return (... && args[Is].can_cast_to<type_list_at_t<Is, argument_types>>());
}(std::make_index_sequence<ct::arity>());
@@ -94,7 +92,6 @@ namespace meta_hpp::detail
argument_list arguments;
arguments.reserve(ct::arity);
// NOLINTNEXTLINE(readability-named-parameter)
[&arguments]<std::size_t... Is>(std::index_sequence<Is...>) mutable {
(arguments.push_back([]<std::size_t I>(){
using P = detail::type_list_at_t<I, typename ct::argument_types>;

View File

@@ -38,7 +38,6 @@ namespace meta_hpp::detail
throw_exception_with("an attempt to call a function with an incorrect arity");
}
// NOLINTNEXTLINE(readability-named-parameter)
return [&function, args]<std::size_t... Is>(std::index_sequence<Is...>) -> uvalue {
if ( !(... && args[Is].can_cast_to<type_list_at_t<Is, argument_types>>()) ) {
throw_exception_with("an attempt to call a function with incorrect argument types");
@@ -74,7 +73,6 @@ namespace meta_hpp::detail
return false;
}
// NOLINTNEXTLINE(readability-named-parameter)
return [args]<std::size_t... Is>(std::index_sequence<Is...>){
return (... && args[Is].can_cast_to<type_list_at_t<Is, argument_types>>());
}(std::make_index_sequence<ft::arity>());
@@ -102,7 +100,6 @@ namespace meta_hpp::detail
argument_list arguments;
arguments.reserve(ft::arity);
// NOLINTNEXTLINE(readability-named-parameter)
[&arguments]<std::size_t... Is>(std::index_sequence<Is...>) mutable {
(arguments.push_back([]<std::size_t I>(){
using P = detail::type_list_at_t<I, typename ft::argument_types>;

View File

@@ -44,7 +44,6 @@ namespace meta_hpp::detail
throw_exception_with("an attempt to call a method with an incorrect instance type");
}
// NOLINTNEXTLINE(readability-named-parameter)
return [&method, &inst, args]<std::size_t... Is>(std::index_sequence<Is...>) -> uvalue {
if ( !(... && args[Is].can_cast_to<type_list_at_t<Is, argument_types>>()) ) {
throw_exception_with("an attempt to call a method with incorrect argument types");
@@ -85,7 +84,6 @@ namespace meta_hpp::detail
return false;
}
// NOLINTNEXTLINE(readability-named-parameter)
return [args]<std::size_t... Is>(std::index_sequence<Is...>){
return (... && args[Is].can_cast_to<type_list_at_t<Is, argument_types>>());
}(std::make_index_sequence<mt::arity>());
@@ -113,7 +111,6 @@ namespace meta_hpp::detail
argument_list arguments;
arguments.reserve(mt::arity);
// NOLINTNEXTLINE(readability-named-parameter)
[&arguments]<std::size_t... Is>(std::index_sequence<Is...>) mutable {
(arguments.push_back([]<std::size_t I>(){
using P = detail::type_list_at_t<I, typename mt::argument_types>;

View File

@@ -123,67 +123,67 @@ namespace meta_hpp
}
inline array_type any_type::as_array() const noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
// NOLINTNEXTLINE(*-static-cast-downcast)
return is_array() ? array_type{static_cast<detail::array_type_data*>(data_)} : array_type{};
}
inline class_type any_type::as_class() const noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
// NOLINTNEXTLINE(*-static-cast-downcast)
return is_class() ? class_type{static_cast<detail::class_type_data*>(data_)} : class_type{};
}
inline constructor_type any_type::as_constructor() const noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
// NOLINTNEXTLINE(*-static-cast-downcast)
return is_constructor() ? constructor_type{static_cast<detail::constructor_type_data*>(data_)} : constructor_type{};
}
inline destructor_type any_type::as_destructor() const noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
// NOLINTNEXTLINE(*-static-cast-downcast)
return is_destructor() ? destructor_type{static_cast<detail::destructor_type_data*>(data_)} : destructor_type{};
}
inline enum_type any_type::as_enum() const noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
// NOLINTNEXTLINE(*-static-cast-downcast)
return is_enum() ? enum_type{static_cast<detail::enum_type_data*>(data_)} : enum_type{};
}
inline function_type any_type::as_function() const noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
// NOLINTNEXTLINE(*-static-cast-downcast)
return is_function() ? function_type{static_cast<detail::function_type_data*>(data_)} : function_type{};
}
inline member_type any_type::as_member() const noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
// NOLINTNEXTLINE(*-static-cast-downcast)
return is_member() ? member_type{static_cast<detail::member_type_data*>(data_)} : member_type{};
}
inline method_type any_type::as_method() const noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
// NOLINTNEXTLINE(*-static-cast-downcast)
return is_method() ? method_type{static_cast<detail::method_type_data*>(data_)} : method_type{};
}
inline nullptr_type any_type::as_nullptr() const noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
// NOLINTNEXTLINE(*-static-cast-downcast)
return is_nullptr() ? nullptr_type{static_cast<detail::nullptr_type_data*>(data_)} : nullptr_type{};
}
inline number_type any_type::as_number() const noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
// NOLINTNEXTLINE(*-static-cast-downcast)
return is_number() ? number_type{static_cast<detail::number_type_data*>(data_)} : number_type{};
}
inline pointer_type any_type::as_pointer() const noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
// NOLINTNEXTLINE(*-static-cast-downcast)
return is_pointer() ? pointer_type{static_cast<detail::pointer_type_data*>(data_)} : pointer_type{};
}
inline reference_type any_type::as_reference() const noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
// NOLINTNEXTLINE(*-static-cast-downcast)
return is_reference() ? reference_type{static_cast<detail::reference_type_data*>(data_)} : reference_type{};
}
inline void_type any_type::as_void() const noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast)
// NOLINTNEXTLINE(*-static-cast-downcast)
return is_void() ? void_type{static_cast<detail::void_type_data*>(data_)} : void_type{};
}
}

View File

@@ -18,7 +18,6 @@ namespace meta_hpp::detail
struct array_tag {};
template < array_kind Array >
// NOLINTNEXTLINE(readability-named-parameter)
array_type_data::array_type_data(type_list<Array>)
: type_data_base{type_id{type_list<array_tag<Array>>{}}, type_kind::array_}
, flags{array_traits<Array>::make_flags()}

View File

@@ -24,7 +24,6 @@ namespace meta_hpp::detail
struct class_tag {};
template < class_kind Class >
// NOLINTNEXTLINE(readability-named-parameter)
class_type_data::class_type_data(type_list<Class>)
: type_data_base{type_id{type_list<class_tag<Class>>{}}, type_kind::class_}
, flags{class_traits<Class>::make_flags()}
@@ -150,6 +149,7 @@ namespace meta_hpp
return true;
}
// NOLINTNEXTLINE(*-use-anyofallof)
for ( auto&& derived_base : derived.data_->bases ) {
if ( is_base_of(derived_base) ) {
return true;
@@ -173,6 +173,7 @@ namespace meta_hpp
return true;
}
// NOLINTNEXTLINE(*-use-anyofallof)
for ( auto&& self_base : data_->bases ) {
if ( self_base.is_derived_from(base) ) {
return true;

View File

@@ -18,7 +18,6 @@ namespace meta_hpp::detail
struct constructor_tag {};
template < class_kind Class, typename... Args >
// NOLINTNEXTLINE(readability-named-parameter)
constructor_type_data::constructor_type_data(type_list<Class>, type_list<Args...>)
: type_data_base{type_id{type_list<constructor_tag<Class, Args...>>{}}, type_kind::constructor_}
, flags{constructor_traits<Class, Args...>::make_flags()}

View File

@@ -18,7 +18,6 @@ namespace meta_hpp::detail
struct destructor_tag {};
template < class_kind Class >
// NOLINTNEXTLINE(readability-named-parameter)
destructor_type_data::destructor_type_data(type_list<Class>)
: type_data_base{type_id{type_list<destructor_tag<Class>>{}}, type_kind::destructor_}
, flags{destructor_traits<Class>::make_flags()}

View File

@@ -21,7 +21,6 @@ namespace meta_hpp::detail
struct enum_tag {};
template < enum_kind Enum >
// NOLINTNEXTLINE(readability-named-parameter)
enum_type_data::enum_type_data(type_list<Enum>)
: type_data_base{type_id{type_list<enum_tag<Enum>>{}}, type_kind::enum_}
, flags{enum_traits<Enum>::make_flags()}

View File

@@ -18,7 +18,6 @@ namespace meta_hpp::detail
struct function_tag {};
template < function_kind Function >
// NOLINTNEXTLINE(readability-named-parameter)
function_type_data::function_type_data(type_list<Function>)
: type_data_base{type_id{type_list<function_tag<Function>>{}}, type_kind::function_}
, flags{function_traits<Function>::make_flags()}

View File

@@ -18,7 +18,6 @@ namespace meta_hpp::detail
struct member_tag {};
template < member_kind Member >
// NOLINTNEXTLINE(readability-named-parameter)
member_type_data::member_type_data(type_list<Member>)
: type_data_base{type_id{type_list<member_tag<Member>>{}}, type_kind::member_}
, flags{member_traits<Member>::make_flags()}

View File

@@ -18,7 +18,6 @@ namespace meta_hpp::detail
struct method_tag {};
template < method_kind Method >
// NOLINTNEXTLINE(readability-named-parameter)
method_type_data::method_type_data(type_list<Method>)
: type_data_base{type_id{type_list<method_tag<Method>>{}}, type_kind::method_}
, flags{method_traits<Method>::make_flags()}

View File

@@ -16,7 +16,6 @@ namespace meta_hpp::detail
struct nullptr_tag {};
template < nullptr_kind Nullptr >
// NOLINTNEXTLINE(readability-named-parameter)
nullptr_type_data::nullptr_type_data(type_list<Nullptr>)
: type_data_base{type_id{type_list<nullptr_tag<Nullptr>>{}}, type_kind::nullptr_} {}
}

View File

@@ -18,7 +18,6 @@ namespace meta_hpp::detail
struct number_tag {};
template < number_kind Number >
// NOLINTNEXTLINE(readability-named-parameter)
number_type_data::number_type_data(type_list<Number>)
: type_data_base{type_id{type_list<number_tag<Number>>{}}, type_kind::number_}
, flags{number_traits<Number>::make_flags()}

View File

@@ -18,7 +18,6 @@ namespace meta_hpp::detail
struct pointer_tag {};
template < pointer_kind Pointer >
// NOLINTNEXTLINE(readability-named-parameter)
pointer_type_data::pointer_type_data(type_list<Pointer>)
: type_data_base{type_id{type_list<pointer_tag<Pointer>>{}}, type_kind::pointer_}
, flags{pointer_traits<Pointer>::make_flags()}

View File

@@ -18,7 +18,6 @@ namespace meta_hpp::detail
struct reference_tag {};
template < reference_kind Reference >
// NOLINTNEXTLINE(readability-named-parameter)
reference_type_data::reference_type_data(type_list<Reference>)
: type_data_base{type_id{type_list<reference_tag<Reference>>{}}, type_kind::reference_}
, flags{reference_traits<Reference>::make_flags()}

View File

@@ -16,7 +16,6 @@ namespace meta_hpp::detail
struct void_tag {};
template < void_kind Void >
// NOLINTNEXTLINE(readability-named-parameter)
void_type_data::void_type_data(type_list<Void>)
: type_data_base{type_id{type_list<void_tag<Void>>{}}, type_kind::void_} {}
}

View File

@@ -39,6 +39,7 @@ namespace meta_hpp
template < detail::decay_non_value_kind T >
requires stdex::copy_constructible<std::decay_t<T>>
// NOLINTNEXTLINE(*-forwarding-reference-overload)
explicit uvalue(T&& val);
template < detail::decay_non_value_kind T >

View File

@@ -42,13 +42,13 @@ namespace meta_hpp
template < typename T >
static T* buffer_cast(buffer_t& buffer) noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
// NOLINTNEXTLINE(*-reinterpret-cast)
return std::launder(reinterpret_cast<T*>(buffer.data));
}
template < typename T >
static const T* buffer_cast(const buffer_t& buffer) noexcept {
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
// NOLINTNEXTLINE(*-reinterpret-cast)
return std::launder(reinterpret_cast<const T*>(buffer.data));
}
@@ -115,7 +115,7 @@ namespace meta_hpp
}
template < typename Tp >
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
// NOLINTNEXTLINE(*-cognitive-complexity)
static vtable_t* get() {
static vtable_t table{
.type = resolve_type<Tp>(),
@@ -129,7 +129,7 @@ namespace meta_hpp
},
.move = [](uvalue& from, uvalue& to) noexcept {
assert(from && !to);
assert(from && !to); // NOLINT
std::visit(detail::overloaded {
[&to](void* ptr) {
@@ -149,7 +149,7 @@ namespace meta_hpp
},
.copy = [](const uvalue& from, uvalue& to){
assert(from && !to);
assert(from && !to); // NOLINT
std::visit(detail::overloaded {
[&to](void* ptr) {
@@ -167,7 +167,7 @@ namespace meta_hpp
},
.destroy = [](uvalue& self) noexcept {
assert(self);
assert(self); // NOLINT
std::visit(detail::overloaded {
[](void* ptr) {
@@ -272,6 +272,7 @@ namespace meta_hpp
template < detail::decay_non_value_kind T >
requires stdex::copy_constructible<std::decay_t<T>>
// NOLINTNEXTLINE(*-forwarding-reference-overload)
uvalue::uvalue(T&& val) {
vtable_t::construct(*this, std::forward<T>(val));
}
@@ -361,7 +362,7 @@ namespace meta_hpp
}
template < typename T >
// NOLINTNEXTLINE(*-function-cognitive-complexity)
// NOLINTNEXTLINE(*-cognitive-complexity)
auto uvalue::try_get_as() noexcept -> std::conditional_t<detail::pointer_kind<T>, T, T*> {
static_assert(std::is_same_v<T, std::decay_t<T>>);
@@ -426,7 +427,7 @@ namespace meta_hpp
}
template < typename T >
// NOLINTNEXTLINE(*-function-cognitive-complexity)
// NOLINTNEXTLINE(*-cognitive-complexity)
auto uvalue::try_get_as() const noexcept -> std::conditional_t<detail::pointer_kind<T>, T, const T*> {
static_assert(std::is_same_v<T, std::decay_t<T>>);