support bazel complie this project and format code.

This commit is contained in:
zhangxing
2023-03-30 00:15:11 +08:00
committed by light-city
parent 1f86192576
commit 3c8a3f259b
641 changed files with 10349 additions and 9523 deletions

View File

@@ -0,0 +1,28 @@
//
// Created by light on 20-1-6.
//
// https://www.boost.org/doc/libs/1_62_0/libs/hana/doc/html/structboost_1_1hana_1_1type.html#a2d2e7e08e284f7e0bd1bd9c3ad0e0a2b
#include <boost/hana.hpp>
#include <vector>
#include <string>
namespace hana = boost::hana;
int main() {
// 检查成员
struct Person {
std::string name;
};
auto has_name = hana::is_valid([](auto &&p) -> decltype(p.name) {});
Person joe{"Joe"};
static_assert(has_name(joe), "");
static_assert(!has_name(1), "");
// 检查嵌套类型
auto has_value_type = hana::is_valid([](auto t) -> hana::type<typename decltype(t)::type::value_type> {});
static_assert(has_value_type(hana::type_c<std::vector<int>>), "");
static_assert(!has_value_type(hana::type_c<Person>), "");
return 0;
}