diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2024-10-07 20:59:55 +0200 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2024-10-07 20:59:55 +0200 |
commit | d2f7bd5e0aaa51f52fb0785c84c0f28fde84f5a5 (patch) | |
tree | b853b12574975a072d724e9ac7323c04e8a5b364 | |
parent | a220880dc12ff40b59130e9da0f8dfb02bef96e2 (diff) | |
download | cpp-templates-main.tar.gz cpp-templates-main.zip |
-rw-r--r-- | compressed_pair.cc | 4 | ||||
-rw-r--r-- | fn_signature_checker.cc | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/compressed_pair.cc b/compressed_pair.cc index 873c4ce..f044f29 100644 --- a/compressed_pair.cc +++ b/compressed_pair.cc @@ -68,8 +68,6 @@ struct pair : entry<T, 0>, entry<U, 1> { }; } // namespace cpp11 -struct empty {}; - #if __cplusplus >= 202002L namespace cpp20 { template <typename T, typename U> @@ -90,6 +88,8 @@ struct pair { // -- TEST ME ------------------------------------------------------------------ +struct empty {}; + static_assert(sizeof(cpp11::pair<int, int>) == 8); static_assert(sizeof(cpp11::pair<int, empty>) == 4); static_assert(sizeof(cpp11::pair<empty, empty>) == 2); diff --git a/fn_signature_checker.cc b/fn_signature_checker.cc index 985c719..bd1db20 100644 --- a/fn_signature_checker.cc +++ b/fn_signature_checker.cc @@ -55,13 +55,13 @@ void do_work() { // // If the partial specialization (3) is enabled, this could also match a // static member function T::get. - static_assert(std::is_same<fn_t<int(int)>, fn_t<decltype(&T::get)>>::value, + static_assert(std::is_same<int(int), fn_t<decltype(&T::get)>>::value, "T has no member function 'int get(int)'"); // Check for non-static member function. - static_assert(std::is_same<fn_t<void(int)>, fn_t<decltype(&T::set)>>::value, + static_assert(std::is_same<void(int), fn_t<decltype(&T::set)>>::value, "T has no member function 'void set(int)'"); // Check for static member function. - static_assert(std::is_same<fn_t<int()>, fn_t<decltype(T::cnt)>>::value, + static_assert(std::is_same<int(), fn_t<decltype(T::cnt)>>::value, "T has no static function 'static int cnt()'"); } |