mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-16 22:17:02 +07:00
arg_base for argument cast checking
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
class arg final {
|
class arg_base {
|
||||||
public:
|
public:
|
||||||
enum class ref_types {
|
enum class ref_types {
|
||||||
ref,
|
ref,
|
||||||
@@ -19,36 +19,38 @@ namespace meta_hpp
|
|||||||
crref,
|
crref,
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
arg() = delete;
|
arg_base() = delete;
|
||||||
|
|
||||||
arg(arg&&) = delete;
|
arg_base(arg_base&&) = delete;
|
||||||
arg& operator=(arg&&) = delete;
|
arg_base& operator=(arg_base&&) = delete;
|
||||||
|
|
||||||
arg(const arg&) = delete;
|
arg_base(const arg_base&) = delete;
|
||||||
arg& operator=(const arg&) = delete;
|
arg_base& operator=(const arg_base&) = delete;
|
||||||
|
|
||||||
template < typename T
|
template < typename T, std::enable_if_t<
|
||||||
, std::enable_if_t<!std::is_reference_v<T>, int> = 0 >
|
std::is_pointer_v<T> ||
|
||||||
explicit arg(T&& v);
|
std::is_lvalue_reference_v<T>, int> = 0 >
|
||||||
|
explicit arg_base(typename_arg_t<T>)
|
||||||
|
: raw_type_{type_db::get<stdex::remove_cvref_t<T>>()}
|
||||||
|
, ref_type_{std::is_const_v<std::remove_reference_t<T>> ? ref_types::cref : ref_types::ref} {}
|
||||||
|
|
||||||
template < typename T
|
template < typename T, std::enable_if_t<
|
||||||
, std::enable_if_t<std::is_lvalue_reference_v<T>, int> = 0 >
|
std::is_rvalue_reference_v<T> ||
|
||||||
explicit arg(T&& v);
|
(!std::is_pointer_v<T> && !std::is_reference_v<T>), int> = 0 >
|
||||||
|
explicit arg_base(typename_arg_t<T>)
|
||||||
template < typename To >
|
: raw_type_{type_db::get<stdex::remove_cvref_t<T>>()}
|
||||||
To cast() const;
|
, ref_type_{std::is_const_v<std::remove_reference_t<T>> ? ref_types::crref : ref_types::rref} {}
|
||||||
|
|
||||||
template < typename To >
|
|
||||||
bool can_cast() const noexcept;
|
|
||||||
|
|
||||||
any_type raw_type() const noexcept;
|
|
||||||
ref_types ref_type() const noexcept;
|
|
||||||
|
|
||||||
bool is_const() const noexcept;
|
bool is_const() const noexcept;
|
||||||
bool is_lvalue() const noexcept;
|
bool is_lvalue() const noexcept;
|
||||||
bool is_rvalue() const noexcept;
|
bool is_rvalue() const noexcept;
|
||||||
|
|
||||||
|
any_type raw_type() const noexcept;
|
||||||
|
ref_types ref_type() const noexcept;
|
||||||
|
|
||||||
|
template < typename To >
|
||||||
|
bool can_cast_to() const noexcept;
|
||||||
private:
|
private:
|
||||||
void* data_{};
|
|
||||||
any_type raw_type_{};
|
any_type raw_type_{};
|
||||||
ref_types ref_type_{};
|
ref_types ref_type_{};
|
||||||
};
|
};
|
||||||
@@ -56,75 +58,31 @@ namespace meta_hpp
|
|||||||
|
|
||||||
namespace meta_hpp
|
namespace meta_hpp
|
||||||
{
|
{
|
||||||
template < typename T
|
inline bool arg_base::is_const() const noexcept {
|
||||||
, std::enable_if_t<!std::is_reference_v<T>, int> >
|
return ref_type_ == ref_types::cref
|
||||||
inline arg::arg(T&& v)
|
|| ref_type_ == ref_types::crref;
|
||||||
: data_{const_cast<std::add_pointer_t<stdex::remove_cvref_t<T>>>(std::addressof(v))}
|
|
||||||
, raw_type_{type_db::get<stdex::remove_cvref_t<T>>()}
|
|
||||||
, ref_type_{std::is_const_v<T> ? ref_types::crref : ref_types::rref} {}
|
|
||||||
|
|
||||||
template < typename T
|
|
||||||
, std::enable_if_t<std::is_lvalue_reference_v<T>, int> >
|
|
||||||
inline arg::arg(T&& v)
|
|
||||||
: data_{const_cast<std::add_pointer_t<stdex::remove_cvref_t<T>>>(std::addressof(v))}
|
|
||||||
, raw_type_{type_db::get<stdex::remove_cvref_t<T>>()}
|
|
||||||
, ref_type_{std::is_const_v<std::remove_reference_t<T>> ? ref_types::cref : ref_types::ref} {}
|
|
||||||
|
|
||||||
template < typename To >
|
|
||||||
inline To arg::cast() const {
|
|
||||||
if ( !can_cast<To>() ) {
|
|
||||||
throw std::logic_error("bad argument cast");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if constexpr ( std::is_pointer_v<To> ) {
|
inline bool arg_base::is_lvalue() const noexcept {
|
||||||
return *static_cast<To*>(data_);
|
return ref_type_ == ref_types::ref
|
||||||
|
|| ref_type_ == ref_types::cref;
|
||||||
}
|
}
|
||||||
|
|
||||||
if constexpr ( std::is_reference_v<To> ) {
|
inline bool arg_base::is_rvalue() const noexcept {
|
||||||
using raw_type = stdex::remove_cvref_t<To>;
|
return ref_type_ == ref_types::rref
|
||||||
|
|| ref_type_ == ref_types::crref;
|
||||||
if constexpr ( std::is_lvalue_reference_v<To> ) {
|
|
||||||
return *static_cast<raw_type*>(data_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if constexpr ( std::is_rvalue_reference_v<To> ) {
|
inline any_type arg_base::raw_type() const noexcept {
|
||||||
return std::move(*static_cast<raw_type*>(data_));
|
return raw_type_;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if constexpr ( !std::is_pointer_v<To> && !std::is_reference_v<To> ) {
|
inline arg_base::ref_types arg_base::ref_type() const noexcept {
|
||||||
using raw_type = stdex::remove_cvref_t<To>;
|
return ref_type_;
|
||||||
|
|
||||||
if ( ref_type() == ref_types::ref ) {
|
|
||||||
if constexpr ( std::is_constructible_v<To, raw_type&> ) {
|
|
||||||
return To{*static_cast<raw_type*>(data_)};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ref_type() == ref_types::cref ) {
|
|
||||||
if constexpr ( std::is_constructible_v<To, const raw_type&> ) {
|
|
||||||
return To{std::as_const(*static_cast<raw_type*>(data_))};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ref_type() == ref_types::rref ) {
|
|
||||||
if constexpr ( std::is_constructible_v<To, raw_type&&> ) {
|
|
||||||
return To{std::move(*static_cast<raw_type*>(data_))};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ref_type() == ref_types::crref ) {
|
|
||||||
if constexpr ( std::is_constructible_v<To, const raw_type&&> ) {
|
|
||||||
return To{std::move(std::as_const(*static_cast<raw_type*>(data_)))};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw std::logic_error("bad argument cast");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template < typename To >
|
template < typename To >
|
||||||
inline bool arg::can_cast() const noexcept {
|
bool arg_base::can_cast_to() const noexcept {
|
||||||
if constexpr ( std::is_pointer_v<To> ) {
|
if constexpr ( std::is_pointer_v<To> ) {
|
||||||
using to_raw_type = std::remove_cv_t<To>;
|
using to_raw_type = std::remove_cv_t<To>;
|
||||||
using to_raw_ptr_type = std::remove_cv_t<std::remove_pointer_t<to_raw_type>>;
|
using to_raw_ptr_type = std::remove_cv_t<std::remove_pointer_t<to_raw_type>>;
|
||||||
@@ -192,27 +150,87 @@ namespace meta_hpp
|
|||||||
|| (ref_type() == ref_types::crref && std::is_constructible_v<To, const to_raw_type&&>);
|
|| (ref_type() == ref_types::crref && std::is_constructible_v<To, const to_raw_type&&>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
inline any_type arg::raw_type() const noexcept {
|
namespace meta_hpp
|
||||||
return raw_type_;
|
{
|
||||||
|
class arg final : public arg_base {
|
||||||
|
public:
|
||||||
|
arg() = delete;
|
||||||
|
|
||||||
|
arg(arg&&) = delete;
|
||||||
|
arg& operator=(arg&&) = delete;
|
||||||
|
|
||||||
|
arg(const arg&) = delete;
|
||||||
|
arg& operator=(const arg&) = delete;
|
||||||
|
|
||||||
|
template < typename T >
|
||||||
|
explicit arg(T&& v);
|
||||||
|
|
||||||
|
template < typename To >
|
||||||
|
To cast() const;
|
||||||
|
private:
|
||||||
|
void* data_{};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace meta_hpp
|
||||||
|
{
|
||||||
|
template < typename T >
|
||||||
|
arg::arg(T&& v)
|
||||||
|
: arg_base{typename_arg<T&&>}
|
||||||
|
, data_{const_cast<std::add_pointer_t<stdex::remove_cvref_t<T>>>(std::addressof(v))} {}
|
||||||
|
|
||||||
|
template < typename To >
|
||||||
|
To arg::cast() const {
|
||||||
|
if ( !can_cast_to<To>() ) {
|
||||||
|
throw std::logic_error("bad argument cast");
|
||||||
}
|
}
|
||||||
|
|
||||||
inline arg::ref_types arg::ref_type() const noexcept {
|
if constexpr ( std::is_pointer_v<To> ) {
|
||||||
return ref_type_;
|
return *static_cast<To*>(data_);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool arg::is_const() const noexcept {
|
if constexpr ( std::is_reference_v<To> ) {
|
||||||
return ref_type_ == ref_types::cref
|
using raw_type = stdex::remove_cvref_t<To>;
|
||||||
|| ref_type_ == ref_types::crref;
|
|
||||||
|
if constexpr ( std::is_lvalue_reference_v<To> ) {
|
||||||
|
return *static_cast<raw_type*>(data_);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool arg::is_lvalue() const noexcept {
|
if constexpr ( std::is_rvalue_reference_v<To> ) {
|
||||||
return ref_type_ == ref_types::ref
|
return std::move(*static_cast<raw_type*>(data_));
|
||||||
|| ref_type_ == ref_types::cref;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool arg::is_rvalue() const noexcept {
|
if constexpr ( !std::is_pointer_v<To> && !std::is_reference_v<To> ) {
|
||||||
return ref_type_ == ref_types::rref
|
using raw_type = stdex::remove_cvref_t<To>;
|
||||||
|| ref_type_ == ref_types::crref;
|
|
||||||
|
if ( ref_type() == ref_types::ref ) {
|
||||||
|
if constexpr ( std::is_constructible_v<To, raw_type&> ) {
|
||||||
|
return To{*static_cast<raw_type*>(data_)};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ref_type() == ref_types::cref ) {
|
||||||
|
if constexpr ( std::is_constructible_v<To, const raw_type&> ) {
|
||||||
|
return To{std::as_const(*static_cast<raw_type*>(data_))};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ref_type() == ref_types::rref ) {
|
||||||
|
if constexpr ( std::is_constructible_v<To, raw_type&&> ) {
|
||||||
|
return To{std::move(*static_cast<raw_type*>(data_))};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ref_type() == ref_types::crref ) {
|
||||||
|
if constexpr ( std::is_constructible_v<To, const raw_type&&> ) {
|
||||||
|
return To{std::move(std::as_const(*static_cast<raw_type*>(data_)))};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw std::logic_error("bad argument cast");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
184
untests/features/utilities/arg_base_tests.cpp
Normal file
184
untests/features/utilities/arg_base_tests.cpp
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* This file is part of the "https://github.com/blackmatov/meta.hpp"
|
||||||
|
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||||
|
* Copyright (C) 2021, by Matvey Cherevko (blackmatov@gmail.com)
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include "_utilities_fwd.hpp"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
using namespace meta_hpp;
|
||||||
|
using namespace std::string_literals;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
struct ivec2 {
|
||||||
|
int x{};
|
||||||
|
int y{};
|
||||||
|
|
||||||
|
[[maybe_unused]] ivec2() = default;
|
||||||
|
[[maybe_unused]] explicit ivec2(int v): x{v}, y{v} {}
|
||||||
|
[[maybe_unused]] ivec2(int x, int y): x{x}, y{y} {}
|
||||||
|
|
||||||
|
[[maybe_unused]] ivec2(ivec2&& other) noexcept {
|
||||||
|
x = other.x;
|
||||||
|
y = other.y;
|
||||||
|
other.x = 0;
|
||||||
|
other.y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[maybe_unused]] ivec2(const ivec2& other) noexcept {
|
||||||
|
x = other.x;
|
||||||
|
y = other.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
ivec2& operator=(ivec2&&) = delete;
|
||||||
|
ivec2& operator=(const ivec2&) = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ivec3 {
|
||||||
|
int x{};
|
||||||
|
int y{};
|
||||||
|
int z{};
|
||||||
|
|
||||||
|
[[maybe_unused]] ivec3() = default;
|
||||||
|
[[maybe_unused]] explicit ivec3(int v): x{v}, y{v}, z{v} {}
|
||||||
|
[[maybe_unused]] ivec3(int x, int y, int z): x{x}, y{y}, z{z} {}
|
||||||
|
|
||||||
|
[[maybe_unused]] ivec3(ivec3&& other) noexcept {
|
||||||
|
x = other.x;
|
||||||
|
y = other.y;
|
||||||
|
z = other.z;
|
||||||
|
other.x = 0;
|
||||||
|
other.y = 0;
|
||||||
|
other.z = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[maybe_unused]] ivec3(const ivec3& other) noexcept {
|
||||||
|
x = other.x;
|
||||||
|
y = other.y;
|
||||||
|
z = other.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
ivec3& operator=(ivec3&&) = delete;
|
||||||
|
ivec3& operator=(const ivec3&) = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
[[maybe_unused]] bool operator==(const ivec2& l, const ivec2& r) noexcept {
|
||||||
|
return l.x == r.x && l.y == r.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[maybe_unused]] bool operator==(const ivec3& l, const ivec3& r) noexcept {
|
||||||
|
return l.x == r.x && l.y == r.y && l.z == r.z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("features/utilities/arg_base/type") {
|
||||||
|
SUBCASE("ptr") {
|
||||||
|
ivec2 v{1,2};
|
||||||
|
ivec2* vp = &v;
|
||||||
|
arg_base a{typename_arg<decltype(vp)>};
|
||||||
|
|
||||||
|
CHECK(a.raw_type().id() == type_db::get<ivec2*>().id());
|
||||||
|
CHECK(a.ref_type() == arg_base::ref_types::ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("rptr") {
|
||||||
|
ivec2 v{1,2};
|
||||||
|
ivec2* vp = &v;
|
||||||
|
arg_base a{typename_arg<decltype(std::move(vp))>};
|
||||||
|
|
||||||
|
CHECK(a.raw_type().id() == type_db::get<ivec2*>().id());
|
||||||
|
CHECK(a.ref_type() == arg_base::ref_types::rref);
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("ptr_c") {
|
||||||
|
ivec2 v{1,2};
|
||||||
|
ivec2* const vp = &v;
|
||||||
|
arg_base a{typename_arg<decltype(vp)>};
|
||||||
|
|
||||||
|
CHECK(a.raw_type().id() == type_db::get<ivec2*>().id());
|
||||||
|
CHECK(a.ref_type() == arg_base::ref_types::cref);
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("rptr_c") {
|
||||||
|
ivec2 v{1,2};
|
||||||
|
ivec2* const vp = &v;
|
||||||
|
arg_base a{typename_arg<decltype(std::move(vp))>};
|
||||||
|
|
||||||
|
CHECK(a.raw_type().id() == type_db::get<ivec2*>().id());
|
||||||
|
CHECK(a.ref_type() == arg_base::ref_types::crref);
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("cptr") {
|
||||||
|
const ivec2 v{1,2};
|
||||||
|
const ivec2* vp = &v;
|
||||||
|
arg_base a{typename_arg<decltype(vp)>};
|
||||||
|
|
||||||
|
CHECK(a.raw_type().id() == type_db::get<const ivec2*>().id());
|
||||||
|
CHECK(a.ref_type() == arg_base::ref_types::ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("crptr") {
|
||||||
|
const ivec2 v{1,2};
|
||||||
|
const ivec2* vp = &v;
|
||||||
|
arg_base a{typename_arg<decltype(std::move(vp))>};
|
||||||
|
|
||||||
|
CHECK(a.raw_type().id() == type_db::get<const ivec2*>().id());
|
||||||
|
CHECK(a.ref_type() == arg_base::ref_types::rref);
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("cptr_c") {
|
||||||
|
const ivec2 v{1,2};
|
||||||
|
const ivec2* const vp = &v;
|
||||||
|
arg_base a{typename_arg<decltype(vp)>};
|
||||||
|
|
||||||
|
CHECK(a.raw_type().id() == type_db::get<const ivec2*>().id());
|
||||||
|
CHECK(a.ref_type() == arg_base::ref_types::cref);
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("crptr_c") {
|
||||||
|
const ivec2 v{1,2};
|
||||||
|
const ivec2* const vp = &v;
|
||||||
|
arg_base a{typename_arg<decltype(std::move(vp))>};
|
||||||
|
|
||||||
|
CHECK(a.raw_type().id() == type_db::get<const ivec2*>().id());
|
||||||
|
CHECK(a.ref_type() == arg_base::ref_types::crref);
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("ref") {
|
||||||
|
ivec2 v{1,2};
|
||||||
|
ivec2& vr = v;
|
||||||
|
arg_base a{typename_arg<decltype(vr)>};
|
||||||
|
|
||||||
|
CHECK(a.raw_type().id() == type_db::get<ivec2>().id());
|
||||||
|
CHECK(a.ref_type() == arg_base::ref_types::ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("cref") {
|
||||||
|
const ivec2 v{1,2};
|
||||||
|
const ivec2& vr = v;
|
||||||
|
arg_base a{typename_arg<decltype(vr)>};
|
||||||
|
|
||||||
|
CHECK(a.raw_type().id() == type_db::get<ivec2>().id());
|
||||||
|
CHECK(a.ref_type() == arg_base::ref_types::cref);
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("rref") {
|
||||||
|
ivec2 v{1,2};
|
||||||
|
arg_base a{typename_arg<decltype(std::move(v))>};
|
||||||
|
|
||||||
|
CHECK(a.raw_type().id() == type_db::get<ivec2>().id());
|
||||||
|
CHECK(a.ref_type() == arg_base::ref_types::rref);
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("crref") {
|
||||||
|
const ivec2 v{1,2};
|
||||||
|
arg_base a{typename_arg<decltype(std::move(v))>};
|
||||||
|
|
||||||
|
CHECK(a.raw_type().id() == type_db::get<ivec2>().id());
|
||||||
|
CHECK(a.ref_type() == arg_base::ref_types::crref);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -183,42 +183,42 @@ TEST_CASE("features/utilities/arg/type") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("features/utilities/arg/can_cast") {
|
TEST_CASE("features/utilities/arg/can_cast_to") {
|
||||||
SUBCASE("ptr") {
|
SUBCASE("ptr") {
|
||||||
ivec2 v{1,2};
|
ivec2 v{1,2};
|
||||||
ivec2* vp = &v;
|
ivec2* vp = &v;
|
||||||
arg a{vp};
|
arg a{vp};
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2>());
|
CHECK_FALSE(a.can_cast_to<ivec2>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2>());
|
CHECK_FALSE(a.can_cast_to<const ivec2>());
|
||||||
|
|
||||||
CHECK(a.can_cast<ivec2*>());
|
CHECK(a.can_cast_to<ivec2*>());
|
||||||
CHECK(a.can_cast<const ivec2*>());
|
CHECK(a.can_cast_to<const ivec2*>());
|
||||||
CHECK(a.can_cast<ivec2* const>());
|
CHECK(a.can_cast_to<ivec2* const>());
|
||||||
CHECK(a.can_cast<const ivec2* const>());
|
CHECK(a.can_cast_to<const ivec2* const>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&&>());
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec3*>());
|
CHECK_FALSE(a.can_cast_to<ivec3*>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3*>());
|
CHECK_FALSE(a.can_cast_to<const ivec3*>());
|
||||||
CHECK_FALSE(a.can_cast<ivec3* const>());
|
CHECK_FALSE(a.can_cast_to<ivec3* const>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3* const>());
|
CHECK_FALSE(a.can_cast_to<const ivec3* const>());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK(a.can_cast<ivec2*&>());
|
CHECK(a.can_cast_to<ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&>());
|
||||||
CHECK(a.can_cast<ivec2* const&>());
|
CHECK(a.can_cast_to<ivec2* const&>());
|
||||||
CHECK(a.can_cast<const ivec2* const&>());
|
CHECK(a.can_cast_to<const ivec2* const&>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const&&>());
|
||||||
|
|
||||||
[]([[maybe_unused]] ivec2 *&){}(vp);
|
[]([[maybe_unused]] ivec2 *&){}(vp);
|
||||||
//[]([[maybe_unused]] const ivec2 *&){}(vp);
|
//[]([[maybe_unused]] const ivec2 *&){}(vp);
|
||||||
@@ -237,36 +237,36 @@ TEST_CASE("features/utilities/arg/can_cast") {
|
|||||||
ivec2* vp = &v;
|
ivec2* vp = &v;
|
||||||
arg a{std::move(vp)};
|
arg a{std::move(vp)};
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2>());
|
CHECK_FALSE(a.can_cast_to<ivec2>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2>());
|
CHECK_FALSE(a.can_cast_to<const ivec2>());
|
||||||
|
|
||||||
CHECK(a.can_cast<ivec2*>());
|
CHECK(a.can_cast_to<ivec2*>());
|
||||||
CHECK(a.can_cast<const ivec2*>());
|
CHECK(a.can_cast_to<const ivec2*>());
|
||||||
CHECK(a.can_cast<ivec2* const>());
|
CHECK(a.can_cast_to<ivec2* const>());
|
||||||
CHECK(a.can_cast<const ivec2* const>());
|
CHECK(a.can_cast_to<const ivec2* const>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&&>());
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec3*>());
|
CHECK_FALSE(a.can_cast_to<ivec3*>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3*>());
|
CHECK_FALSE(a.can_cast_to<const ivec3*>());
|
||||||
CHECK_FALSE(a.can_cast<ivec3* const>());
|
CHECK_FALSE(a.can_cast_to<ivec3* const>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3* const>());
|
CHECK_FALSE(a.can_cast_to<const ivec3* const>());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&>());
|
||||||
CHECK(a.can_cast<ivec2* const&>());
|
CHECK(a.can_cast_to<ivec2* const&>());
|
||||||
CHECK(a.can_cast<const ivec2* const&>());
|
CHECK(a.can_cast_to<const ivec2* const&>());
|
||||||
|
|
||||||
CHECK(a.can_cast<ivec2*&&>());
|
CHECK(a.can_cast_to<ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&&>());
|
||||||
CHECK(a.can_cast<ivec2* const&&>());
|
CHECK(a.can_cast_to<ivec2* const&&>());
|
||||||
CHECK(a.can_cast<const ivec2* const&&>());
|
CHECK(a.can_cast_to<const ivec2* const&&>());
|
||||||
|
|
||||||
//[]([[maybe_unused]] ivec2 *&){}(std::move(vp));
|
//[]([[maybe_unused]] ivec2 *&){}(std::move(vp));
|
||||||
//[]([[maybe_unused]] const ivec2 *&){}(std::move(vp));
|
//[]([[maybe_unused]] const ivec2 *&){}(std::move(vp));
|
||||||
@@ -285,36 +285,36 @@ TEST_CASE("features/utilities/arg/can_cast") {
|
|||||||
ivec2* const vp = &v;
|
ivec2* const vp = &v;
|
||||||
arg a{vp};
|
arg a{vp};
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2>());
|
CHECK_FALSE(a.can_cast_to<ivec2>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2>());
|
CHECK_FALSE(a.can_cast_to<const ivec2>());
|
||||||
|
|
||||||
CHECK(a.can_cast<ivec2*>());
|
CHECK(a.can_cast_to<ivec2*>());
|
||||||
CHECK(a.can_cast<const ivec2*>());
|
CHECK(a.can_cast_to<const ivec2*>());
|
||||||
CHECK(a.can_cast<ivec2* const>());
|
CHECK(a.can_cast_to<ivec2* const>());
|
||||||
CHECK(a.can_cast<const ivec2* const>());
|
CHECK(a.can_cast_to<const ivec2* const>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&&>());
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec3*>());
|
CHECK_FALSE(a.can_cast_to<ivec3*>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3*>());
|
CHECK_FALSE(a.can_cast_to<const ivec3*>());
|
||||||
CHECK_FALSE(a.can_cast<ivec3* const>());
|
CHECK_FALSE(a.can_cast_to<ivec3* const>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3* const>());
|
CHECK_FALSE(a.can_cast_to<const ivec3* const>());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&>());
|
||||||
CHECK(a.can_cast<ivec2* const&>());
|
CHECK(a.can_cast_to<ivec2* const&>());
|
||||||
CHECK(a.can_cast<const ivec2* const&>());
|
CHECK(a.can_cast_to<const ivec2* const&>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const&&>());
|
||||||
|
|
||||||
// []([[maybe_unused]] ivec2 *&){}(vp);
|
// []([[maybe_unused]] ivec2 *&){}(vp);
|
||||||
// []([[maybe_unused]] const ivec2 *&){}(vp);
|
// []([[maybe_unused]] const ivec2 *&){}(vp);
|
||||||
@@ -333,36 +333,36 @@ TEST_CASE("features/utilities/arg/can_cast") {
|
|||||||
ivec2* const vp = &v;
|
ivec2* const vp = &v;
|
||||||
arg a{std::move(vp)};
|
arg a{std::move(vp)};
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2>());
|
CHECK_FALSE(a.can_cast_to<ivec2>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2>());
|
CHECK_FALSE(a.can_cast_to<const ivec2>());
|
||||||
|
|
||||||
CHECK(a.can_cast<ivec2*>());
|
CHECK(a.can_cast_to<ivec2*>());
|
||||||
CHECK(a.can_cast<const ivec2*>());
|
CHECK(a.can_cast_to<const ivec2*>());
|
||||||
CHECK(a.can_cast<ivec2* const>());
|
CHECK(a.can_cast_to<ivec2* const>());
|
||||||
CHECK(a.can_cast<const ivec2* const>());
|
CHECK(a.can_cast_to<const ivec2* const>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&&>());
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec3*>());
|
CHECK_FALSE(a.can_cast_to<ivec3*>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3*>());
|
CHECK_FALSE(a.can_cast_to<const ivec3*>());
|
||||||
CHECK_FALSE(a.can_cast<ivec3* const>());
|
CHECK_FALSE(a.can_cast_to<ivec3* const>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3* const>());
|
CHECK_FALSE(a.can_cast_to<const ivec3* const>());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&>());
|
||||||
CHECK(a.can_cast<ivec2* const&>());
|
CHECK(a.can_cast_to<ivec2* const&>());
|
||||||
CHECK(a.can_cast<const ivec2* const&>());
|
CHECK(a.can_cast_to<const ivec2* const&>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&&>());
|
||||||
CHECK(a.can_cast<ivec2* const&&>());
|
CHECK(a.can_cast_to<ivec2* const&&>());
|
||||||
CHECK(a.can_cast<const ivec2* const&&>());
|
CHECK(a.can_cast_to<const ivec2* const&&>());
|
||||||
|
|
||||||
//[]([[maybe_unused]] ivec2 *&){}(std::move(vp));
|
//[]([[maybe_unused]] ivec2 *&){}(std::move(vp));
|
||||||
//[]([[maybe_unused]] const ivec2 *&){}(std::move(vp));
|
//[]([[maybe_unused]] const ivec2 *&){}(std::move(vp));
|
||||||
@@ -381,34 +381,34 @@ TEST_CASE("features/utilities/arg/can_cast") {
|
|||||||
const ivec2* vp = &v;
|
const ivec2* vp = &v;
|
||||||
arg a{vp};
|
arg a{vp};
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2>());
|
CHECK_FALSE(a.can_cast_to<ivec2>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2>());
|
CHECK_FALSE(a.can_cast_to<const ivec2>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*>());
|
CHECK_FALSE(a.can_cast_to<ivec2*>());
|
||||||
CHECK(a.can_cast<const ivec2*>());
|
CHECK(a.can_cast_to<const ivec2*>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const>());
|
||||||
CHECK(a.can_cast<const ivec2* const>());
|
CHECK(a.can_cast_to<const ivec2* const>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&&>());
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<const ivec3*>());
|
CHECK_FALSE(a.can_cast_to<const ivec3*>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3* const>());
|
CHECK_FALSE(a.can_cast_to<const ivec3* const>());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&>());
|
||||||
CHECK(a.can_cast<const ivec2*&>());
|
CHECK(a.can_cast_to<const ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&>());
|
||||||
CHECK(a.can_cast<const ivec2* const&>());
|
CHECK(a.can_cast_to<const ivec2* const&>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const&&>());
|
||||||
|
|
||||||
//[]([[maybe_unused]] ivec2 *&){}(vp);
|
//[]([[maybe_unused]] ivec2 *&){}(vp);
|
||||||
[]([[maybe_unused]] const ivec2 *&){}(vp);
|
[]([[maybe_unused]] const ivec2 *&){}(vp);
|
||||||
@@ -427,34 +427,34 @@ TEST_CASE("features/utilities/arg/can_cast") {
|
|||||||
const ivec2* vp = &v;
|
const ivec2* vp = &v;
|
||||||
arg a{std::move(vp)};
|
arg a{std::move(vp)};
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2>());
|
CHECK_FALSE(a.can_cast_to<ivec2>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2>());
|
CHECK_FALSE(a.can_cast_to<const ivec2>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*>());
|
CHECK_FALSE(a.can_cast_to<ivec2*>());
|
||||||
CHECK(a.can_cast<const ivec2*>());
|
CHECK(a.can_cast_to<const ivec2*>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const>());
|
||||||
CHECK(a.can_cast<const ivec2* const>());
|
CHECK(a.can_cast_to<const ivec2* const>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&&>());
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<const ivec3*>());
|
CHECK_FALSE(a.can_cast_to<const ivec3*>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3* const>());
|
CHECK_FALSE(a.can_cast_to<const ivec3* const>());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&>());
|
||||||
CHECK(a.can_cast<const ivec2* const&>());
|
CHECK(a.can_cast_to<const ivec2* const&>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&&>());
|
||||||
CHECK(a.can_cast<const ivec2*&&>());
|
CHECK(a.can_cast_to<const ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&&>());
|
||||||
CHECK(a.can_cast<const ivec2* const&&>());
|
CHECK(a.can_cast_to<const ivec2* const&&>());
|
||||||
|
|
||||||
//[]([[maybe_unused]] ivec2 *&){}(std::move(vp));
|
//[]([[maybe_unused]] ivec2 *&){}(std::move(vp));
|
||||||
//[]([[maybe_unused]] const ivec2 *&){}(std::move(vp));
|
//[]([[maybe_unused]] const ivec2 *&){}(std::move(vp));
|
||||||
@@ -473,34 +473,34 @@ TEST_CASE("features/utilities/arg/can_cast") {
|
|||||||
const ivec2* const vp = &v;
|
const ivec2* const vp = &v;
|
||||||
arg a{vp};
|
arg a{vp};
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2>());
|
CHECK_FALSE(a.can_cast_to<ivec2>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2>());
|
CHECK_FALSE(a.can_cast_to<const ivec2>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2*>());
|
CHECK_FALSE(a.can_cast_to<ivec2*>());
|
||||||
CHECK(a.can_cast<const ivec2*>());
|
CHECK(a.can_cast_to<const ivec2*>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const>());
|
||||||
CHECK(a.can_cast<const ivec2* const>());
|
CHECK(a.can_cast_to<const ivec2* const>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&&>());
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<const ivec3*>());
|
CHECK_FALSE(a.can_cast_to<const ivec3*>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3* const>());
|
CHECK_FALSE(a.can_cast_to<const ivec3* const>());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&>());
|
||||||
CHECK(a.can_cast<const ivec2* const&>());
|
CHECK(a.can_cast_to<const ivec2* const&>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const&&>());
|
||||||
|
|
||||||
//[]([[maybe_unused]] ivec2 *&){}(vp);
|
//[]([[maybe_unused]] ivec2 *&){}(vp);
|
||||||
//[]([[maybe_unused]] const ivec2 *&){}(vp);
|
//[]([[maybe_unused]] const ivec2 *&){}(vp);
|
||||||
@@ -519,34 +519,34 @@ TEST_CASE("features/utilities/arg/can_cast") {
|
|||||||
const ivec2* const vp = &v;
|
const ivec2* const vp = &v;
|
||||||
arg a{std::move(vp)};
|
arg a{std::move(vp)};
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2>());
|
CHECK_FALSE(a.can_cast_to<ivec2>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2>());
|
CHECK_FALSE(a.can_cast_to<const ivec2>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*>());
|
CHECK_FALSE(a.can_cast_to<ivec2*>());
|
||||||
CHECK(a.can_cast<const ivec2*>());
|
CHECK(a.can_cast_to<const ivec2*>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const>());
|
||||||
CHECK(a.can_cast<const ivec2* const>());
|
CHECK(a.can_cast_to<const ivec2* const>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&&>());
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<const ivec3*>());
|
CHECK_FALSE(a.can_cast_to<const ivec3*>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3* const>());
|
CHECK_FALSE(a.can_cast_to<const ivec3* const>());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&>());
|
||||||
CHECK(a.can_cast<const ivec2* const&>());
|
CHECK(a.can_cast_to<const ivec2* const&>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&&>());
|
||||||
CHECK(a.can_cast<const ivec2* const&&>());
|
CHECK(a.can_cast_to<const ivec2* const&&>());
|
||||||
|
|
||||||
//[]([[maybe_unused]] ivec2 *&){}(std::move(vp));
|
//[]([[maybe_unused]] ivec2 *&){}(std::move(vp));
|
||||||
//[]([[maybe_unused]] const ivec2 *&){}(std::move(vp));
|
//[]([[maybe_unused]] const ivec2 *&){}(std::move(vp));
|
||||||
@@ -565,36 +565,36 @@ TEST_CASE("features/utilities/arg/can_cast") {
|
|||||||
ivec2& vr = v;
|
ivec2& vr = v;
|
||||||
arg a{vr};
|
arg a{vr};
|
||||||
|
|
||||||
CHECK(a.can_cast<ivec2>());
|
CHECK(a.can_cast_to<ivec2>());
|
||||||
CHECK(a.can_cast<const ivec2>());
|
CHECK(a.can_cast_to<const ivec2>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*>());
|
CHECK_FALSE(a.can_cast_to<ivec2*>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const>());
|
||||||
|
|
||||||
CHECK(a.can_cast<ivec2&>());
|
CHECK(a.can_cast_to<ivec2&>());
|
||||||
CHECK(a.can_cast<const ivec2&>());
|
CHECK(a.can_cast_to<const ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&&>());
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec3>());
|
CHECK_FALSE(a.can_cast_to<ivec3>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3>());
|
CHECK_FALSE(a.can_cast_to<const ivec3>());
|
||||||
CHECK_FALSE(a.can_cast<ivec3&>());
|
CHECK_FALSE(a.can_cast_to<ivec3&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3&>());
|
CHECK_FALSE(a.can_cast_to<const ivec3&>());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const&>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const&&>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,35 +603,35 @@ TEST_CASE("features/utilities/arg/can_cast") {
|
|||||||
const ivec2& vr = v;
|
const ivec2& vr = v;
|
||||||
arg a{vr};
|
arg a{vr};
|
||||||
|
|
||||||
CHECK(a.can_cast<ivec2>());
|
CHECK(a.can_cast_to<ivec2>());
|
||||||
CHECK(a.can_cast<const ivec2>());
|
CHECK(a.can_cast_to<const ivec2>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*>());
|
CHECK_FALSE(a.can_cast_to<ivec2*>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&>());
|
||||||
CHECK(a.can_cast<const ivec2&>());
|
CHECK(a.can_cast_to<const ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2&&>());
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec3>());
|
CHECK_FALSE(a.can_cast_to<ivec3>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3>());
|
CHECK_FALSE(a.can_cast_to<const ivec3>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3&>());
|
CHECK_FALSE(a.can_cast_to<const ivec3&>());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const&>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const&&>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -639,37 +639,37 @@ TEST_CASE("features/utilities/arg/can_cast") {
|
|||||||
ivec2 v{1,2};
|
ivec2 v{1,2};
|
||||||
arg a{std::move(v)};
|
arg a{std::move(v)};
|
||||||
|
|
||||||
CHECK(a.can_cast<ivec2>());
|
CHECK(a.can_cast_to<ivec2>());
|
||||||
CHECK(a.can_cast<const ivec2>());
|
CHECK(a.can_cast_to<const ivec2>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*>());
|
CHECK_FALSE(a.can_cast_to<ivec2*>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&>());
|
||||||
CHECK(a.can_cast<const ivec2&>());
|
CHECK(a.can_cast_to<const ivec2&>());
|
||||||
CHECK(a.can_cast<ivec2&&>());
|
CHECK(a.can_cast_to<ivec2&&>());
|
||||||
CHECK(a.can_cast<const ivec2&&>());
|
CHECK(a.can_cast_to<const ivec2&&>());
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec3>());
|
CHECK_FALSE(a.can_cast_to<ivec3>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3>());
|
CHECK_FALSE(a.can_cast_to<const ivec3>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3&>());
|
CHECK_FALSE(a.can_cast_to<const ivec3&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec3&&>());
|
CHECK_FALSE(a.can_cast_to<ivec3&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec3&&>());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const&>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const&&>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -677,36 +677,36 @@ TEST_CASE("features/utilities/arg/can_cast") {
|
|||||||
const ivec2 v{1,2};
|
const ivec2 v{1,2};
|
||||||
arg a{std::move(v)};
|
arg a{std::move(v)};
|
||||||
|
|
||||||
CHECK(a.can_cast<ivec2>());
|
CHECK(a.can_cast_to<ivec2>());
|
||||||
CHECK(a.can_cast<const ivec2>());
|
CHECK(a.can_cast_to<const ivec2>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*>());
|
CHECK_FALSE(a.can_cast_to<ivec2*>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&>());
|
||||||
CHECK(a.can_cast<const ivec2&>());
|
CHECK(a.can_cast_to<const ivec2&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2&&>());
|
||||||
CHECK(a.can_cast<const ivec2&&>());
|
CHECK(a.can_cast_to<const ivec2&&>());
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec3>());
|
CHECK_FALSE(a.can_cast_to<ivec3>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3>());
|
CHECK_FALSE(a.can_cast_to<const ivec3>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3&>());
|
CHECK_FALSE(a.can_cast_to<const ivec3&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec3&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec3&&>());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const&>());
|
||||||
|
|
||||||
CHECK_FALSE(a.can_cast<ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2*&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2*&&>());
|
||||||
CHECK_FALSE(a.can_cast<ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<ivec2* const&&>());
|
||||||
CHECK_FALSE(a.can_cast<const ivec2* const&&>());
|
CHECK_FALSE(a.can_cast_to<const ivec2* const&&>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user