forked from boostorg/type_index
Log(N) complexity and templates depth in make_index_seq_impl, avoid usage of slow sizeof...(I), workaround GCC ICE in constexpr tests
This commit is contained in:
1 parent
8b6c3facb3
commit
8e3466ece5
4 files changed
+79
-101
No files matched your search
@@ -74,16 +74,20 @@ void search_same() {
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
#ifndef BOOST_NO_CXX14_CONSTEXPR
|
||||
template <class T, std::size_t N>
|
||||
BOOST_CXX14_CONSTEXPR bool in_namespace(const char (&ns)[N]) BOOST_NOEXCEPT {
|
||||
BOOST_CXX14_CONSTEXPR const char* name = boost::typeindex::ctti_type_index::type_id<T>().raw_name();
|
||||
for (std::size_t i = 0; i < N - 1; ++i)
|
||||
if (name[i] != ns[i])
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct is_boost_namespace {
|
||||
static constexpr char cb[5] = {'b', 'o', 'o', 's', 't'};
|
||||
static constexpr boost::typeindex::ctti_type_index type = boost::typeindex::ctti_type_index::type_id<T>();
|
||||
static constexpr bool value = (boost::typeindex::detail::constexpr_search(type.name(), type.name() + 5, cb, cb + 5) != cb + 5);
|
||||
};
|
||||
#endif
|
||||
*/
|
||||
BOOST_CXX14_CONSTEXPR bool is_boost_namespace() BOOST_NOEXCEPT {
|
||||
return in_namespace<T>("boost::");
|
||||
}
|
||||
|
||||
void constexpr_test() {
|
||||
using namespace boost::typeindex;
|
||||
@@ -127,15 +131,12 @@ void constexpr_test() {
|
||||
|
||||
BOOST_CXX14_CONSTEXPR const char* short_name = t_short0.name();
|
||||
BOOST_TEST(*short_name != '\0');
|
||||
/*
|
||||
#ifndef BOOST_NO_CXX14_CONSTEXPR
|
||||
constexpr bool in_namespace = is_boost_namespace<ctti_type_index>::value;
|
||||
|
||||
BOOST_CXX14_CONSTEXPR bool in_namespace = is_boost_namespace<ctti_type_index>();
|
||||
BOOST_TEST(in_namespace);
|
||||
|
||||
constexpr bool not_in_namespace = !is_boost_namespace<std::string>::value;
|
||||
BOOST_CXX14_CONSTEXPR bool not_in_namespace = !is_boost_namespace<std::string>();
|
||||
BOOST_TEST(not_in_namespace);
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user