testing variants
parent
f573aaf92f
commit
cb16be1bae
|
@ -27,7 +27,7 @@ macro(compile_options target_name)
|
|||
sanitizers(${target_name})
|
||||
endmacro()
|
||||
|
||||
project(blt-gp VERSION 0.5.16)
|
||||
project(blt-gp VERSION 0.5.17)
|
||||
|
||||
include(CTest)
|
||||
|
||||
|
|
2
lib/blt
2
lib/blt
|
@ -1 +1 @@
|
|||
Subproject commit fb092422a82e503d314fc5c99eacb306c29386e8
|
||||
Subproject commit e5a3c9d669900ea3976fc575840e499d1ecdac27
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
struct default_type
|
||||
{
|
||||
std::string to_string() // NOLINT
|
||||
virtual std::string to_string() // NOLINT
|
||||
{
|
||||
return "Unimplemented";
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ struct default_type
|
|||
|
||||
struct type1 : default_type
|
||||
{
|
||||
std::string to_string() // NOLINT
|
||||
virtual std::string to_string() final // NOLINT
|
||||
{
|
||||
return "type1";
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ struct type1 : default_type
|
|||
|
||||
struct type2 : default_type
|
||||
{
|
||||
std::string to_string() // NOLINT
|
||||
virtual std::string to_string() final // NOLINT
|
||||
{
|
||||
return "type2";
|
||||
}
|
||||
|
@ -52,21 +52,43 @@ struct type2 : default_type
|
|||
|
||||
struct type3 : default_type
|
||||
{
|
||||
std::string to_string() // NOLINT
|
||||
virtual std::string to_string() final // NOLINT
|
||||
{
|
||||
return "type3";
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void print()
|
||||
{
|
||||
BLT_TRACE("{}", blt::type_string<T>());
|
||||
}
|
||||
|
||||
void test()
|
||||
{
|
||||
// auto ptr = &default_type::to_string;
|
||||
// auto ptr2 = reinterpret_cast<std::string(type3::*)()>(ptr);
|
||||
|
||||
|
||||
// blt::black_box(hi.to_string());
|
||||
// default_type* t = blt::black_box_ret(&hi);
|
||||
// blt::black_box(t->to_string());
|
||||
|
||||
// BLT_TRACE("Validate:");
|
||||
|
||||
// BLT_TRACE("TYPE1: {}", type1{}.to_string());
|
||||
// BLT_TRACE("TYPE2: {}", type2{}.to_string());
|
||||
// BLT_TRACE("TYPE3: {}\n\n", type3{}.to_string());
|
||||
|
||||
// BLT_TRACE("Output:");
|
||||
|
||||
blt::variant_t<type1, type2, type3> some_type1{type1{}};
|
||||
blt::variant_t<type1, type2, type3> some_type2{type2{}};
|
||||
blt::variant_t<type1, type2, type3> some_type3{type3{}};
|
||||
|
||||
BLT_TRACE("TYPE1: {}", some_type1.call_member(&default_type::to_string));
|
||||
BLT_TRACE("TYPE2: {}", some_type2.call_member(&default_type::to_string));
|
||||
BLT_TRACE("TYPE3: {}", some_type3.call_member(&default_type::to_string));
|
||||
BLT_TRACE("TYPE1: {}", some_type1.call_member_args(&default_type::to_string));
|
||||
BLT_TRACE("TYPE2: {}", some_type2.call_member_args(&default_type::to_string));
|
||||
BLT_TRACE("TYPE3: {}", some_type3.call_member_args(&default_type::to_string));
|
||||
}
|
||||
|
||||
using namespace blt::gp;
|
||||
|
|
Loading…
Reference in New Issue