We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code: https://godbolt.org/z/WxGfz3so7
#define NTEST 1 #include <https://raw.githubusercontent.com/boost-ext/mp/main/mp> #include <type_traits> namespace mp::detail { template <size_t left = 0u, size_t right = MP_SIZE - 1u, auto = [](){}> static constexpr auto meta_size() -> size_t { if constexpr (left >= right) { return left + requires { get(info<mp::info{left}>{}); }; } else if constexpr (constexpr auto mid = left + (right - left) / 2u; requires { get(info<mp::info{mid}>{}); }) { return meta_size<mid + 1u, right>(); } else { return meta_size<left, mid - 1u>(); } } } // namespace mp::detail int main() { static_assert(static_cast<std::size_t>(mp::meta<char>) == 0); static_assert(static_cast<std::size_t>(mp::meta<unsigned char>) == 1); static_assert(static_cast<std::size_t>(mp::meta<int>) == 2); static_assert(mp::detail::meta_size() == 3); { constexpr auto m = mp::invoke<std::add_const>(mp::meta<char*>); static_assert(std::is_same_v<mp::type_of<m>, char* const>); static_assert(mp::detail::meta_size() == 9); } { constexpr auto m = mp::invoke<std::add_volatile>(mp::meta<char*>); static_assert(std::is_same_v<mp::type_of<m>, char* volatile>); static_assert(mp::detail::meta_size() == 19); } return 0; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Code: https://godbolt.org/z/WxGfz3so7
The text was updated successfully, but these errors were encountered: