forked from boostorg/type_index
Combine klemens-morgenstern ideas with mine. Must compile and work at least on GCC-5
This commit is contained in:
@ -23,7 +23,8 @@ env:
|
||||
global:
|
||||
# Autodetect Boost branch by using the following code: - BRANCH_TO_TEST=$TRAVIS_BRANCH
|
||||
# or just directly specify it
|
||||
- BRANCH_TO_TEST=$TRAVIS_BRANCH
|
||||
#- BRANCH_TO_TEST=$TRAVIS_BRANCH
|
||||
- BRANCH_TO_TEST=develop
|
||||
|
||||
# Files, which coverage results must be ignored (files from other projects).
|
||||
# Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/*'
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) Antony Polukhin, 2013-2015.
|
||||
// Copyright (c) Antony Polukhin, 2013-2016.
|
||||
//
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
@ -122,7 +122,8 @@ public:
|
||||
{}
|
||||
|
||||
inline const type_info_t& type_info() const BOOST_NOEXCEPT;
|
||||
BOOST_CXX14_CONSTEXPR inline const char* raw_name() const BOOST_NOEXCEPT;
|
||||
BOOST_CXX14_CONSTEXPR inline const char* raw_name() const BOOST_NOEXCEPT;
|
||||
BOOST_CXX14_CONSTEXPR inline const char* name() const BOOST_NOEXCEPT;
|
||||
inline std::string pretty_name() const;
|
||||
inline std::size_t hash_code() const BOOST_NOEXCEPT;
|
||||
|
||||
@ -148,13 +149,13 @@ inline const ctti_type_index::type_info_t& ctti_type_index::type_info() const BO
|
||||
BOOST_CXX14_CONSTEXPR inline bool ctti_type_index::equal(const ctti_type_index& rhs) const BOOST_NOEXCEPT {
|
||||
const char* const left = raw_name();
|
||||
const char* const right = rhs.raw_name();
|
||||
return left == right || !boost::typeindex::detail::constexpr_strcmp(left, right);
|
||||
return /*left == right ||*/ !boost::typeindex::detail::constexpr_strcmp(left, right);
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR inline bool ctti_type_index::before(const ctti_type_index& rhs) const BOOST_NOEXCEPT {
|
||||
const char* const left = raw_name();
|
||||
const char* const right = rhs.raw_name();
|
||||
return left != right && boost::typeindex::detail::constexpr_strcmp(left, right) < 0;
|
||||
return /*left != right &&*/ boost::typeindex::detail::constexpr_strcmp(left, right) < 0;
|
||||
}
|
||||
|
||||
|
||||
@ -183,6 +184,11 @@ BOOST_CXX14_CONSTEXPR inline const char* ctti_type_index::raw_name() const BOOST
|
||||
return data_;
|
||||
}
|
||||
|
||||
|
||||
BOOST_CXX14_CONSTEXPR inline const char* ctti_type_index::name() const BOOST_NOEXCEPT {
|
||||
return data_;
|
||||
}
|
||||
|
||||
inline std::size_t ctti_type_index::get_raw_name_length() const BOOST_NOEXCEPT {
|
||||
return std::strlen(raw_name() + detail::ctti_skip_size_at_end);
|
||||
}
|
||||
@ -200,94 +206,6 @@ inline std::size_t ctti_type_index::hash_code() const BOOST_NOEXCEPT {
|
||||
}
|
||||
|
||||
|
||||
/// @cond
|
||||
BOOST_CXX14_CONSTEXPR inline bool operator == (const ctti_type_index& lhs, const ctti_type_index& rhs) BOOST_NOEXCEPT {
|
||||
return lhs.equal(rhs);
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR inline bool operator < (const ctti_type_index& lhs, const ctti_type_index& rhs) BOOST_NOEXCEPT {
|
||||
return lhs.before(rhs);
|
||||
}
|
||||
|
||||
|
||||
BOOST_CXX14_CONSTEXPR inline bool operator > (const ctti_type_index& lhs, const ctti_type_index& rhs) BOOST_NOEXCEPT {
|
||||
return rhs < lhs;
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR inline bool operator <= (const ctti_type_index& lhs, const ctti_type_index& rhs) BOOST_NOEXCEPT {
|
||||
return !(lhs > rhs);
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR inline bool operator >= (const ctti_type_index& lhs, const ctti_type_index& rhs) BOOST_NOEXCEPT {
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR inline bool operator != (const ctti_type_index& lhs, const ctti_type_index& rhs) BOOST_NOEXCEPT {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
// ######################### COMPARISONS with detail::ctti_data ############################ //
|
||||
inline bool operator == (const boost::typeindex::detail::ctti_data& lhs, const ctti_type_index& rhs) BOOST_NOEXCEPT {
|
||||
return ctti_type_index(lhs) == rhs;
|
||||
}
|
||||
|
||||
inline bool operator < (const boost::typeindex::detail::ctti_data& lhs, const ctti_type_index& rhs) BOOST_NOEXCEPT {
|
||||
return ctti_type_index(lhs) < rhs;
|
||||
}
|
||||
|
||||
inline bool operator > (const boost::typeindex::detail::ctti_data& lhs, const ctti_type_index& rhs) BOOST_NOEXCEPT {
|
||||
return rhs < ctti_type_index(lhs);
|
||||
}
|
||||
|
||||
inline bool operator <= (const boost::typeindex::detail::ctti_data& lhs, const ctti_type_index& rhs) BOOST_NOEXCEPT {
|
||||
return !(ctti_type_index(lhs) > rhs);
|
||||
}
|
||||
|
||||
inline bool operator >= (const boost::typeindex::detail::ctti_data& lhs, const ctti_type_index& rhs) BOOST_NOEXCEPT {
|
||||
return !(ctti_type_index(lhs) < rhs);
|
||||
}
|
||||
|
||||
inline bool operator != (const boost::typeindex::detail::ctti_data& lhs, const ctti_type_index& rhs) BOOST_NOEXCEPT {
|
||||
return !(ctti_type_index(lhs) == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline bool operator == (const ctti_type_index& lhs, const boost::typeindex::detail::ctti_data& rhs) BOOST_NOEXCEPT {
|
||||
return lhs == ctti_type_index(rhs);
|
||||
}
|
||||
|
||||
inline bool operator < (const ctti_type_index& lhs, const boost::typeindex::detail::ctti_data& rhs) BOOST_NOEXCEPT {
|
||||
return lhs < ctti_type_index(rhs);
|
||||
}
|
||||
|
||||
inline bool operator > (const ctti_type_index& lhs, const boost::typeindex::detail::ctti_data& rhs) BOOST_NOEXCEPT {
|
||||
return ctti_type_index(rhs) < lhs;
|
||||
}
|
||||
|
||||
inline bool operator <= (const ctti_type_index& lhs, const boost::typeindex::detail::ctti_data& rhs) BOOST_NOEXCEPT {
|
||||
return !(lhs > ctti_type_index(rhs));
|
||||
}
|
||||
|
||||
inline bool operator >= (const ctti_type_index& lhs, const boost::typeindex::detail::ctti_data& rhs) BOOST_NOEXCEPT {
|
||||
return !(lhs < ctti_type_index(rhs));
|
||||
}
|
||||
|
||||
inline bool operator != (const ctti_type_index& lhs, const boost::typeindex::detail::ctti_data& rhs) BOOST_NOEXCEPT {
|
||||
return !(lhs == ctti_type_index(rhs));
|
||||
}
|
||||
|
||||
// ######################### COMPARISONS with detail::ctti_data END ############################ //
|
||||
|
||||
/// @endcond
|
||||
|
||||
#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED)
|
||||
/// c++14 constexpr noexcept comparison operators for type_index_facade classes.
|
||||
constexpr bool operator ==, !=, <, ... (const ctti_type_index& lhs, const ctti_type_index& rhs) noexcept;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
}} // namespace boost::typeindex
|
||||
|
||||
#endif // BOOST_TYPE_INDEX_CTTI_TYPE_INDEX_HPP
|
||||
|
@ -22,16 +22,18 @@
|
||||
#endif
|
||||
|
||||
/// @cond
|
||||
#define BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(begin_skip, end_skip, runtime_skip, runtime_skip_until) \
|
||||
namespace boost { namespace typeindex { namespace detail { \
|
||||
BOOST_STATIC_CONSTEXPR std::size_t ctti_skip_size_at_begin = begin_skip; \
|
||||
BOOST_STATIC_CONSTEXPR std::size_t ctti_skip_size_at_end = end_skip; \
|
||||
BOOST_STATIC_CONSTEXPR bool ctti_skip_more_at_runtime = runtime_skip; \
|
||||
BOOST_STATIC_CONSTEXPR char ctti_skip_until_runtime[] = runtime_skip_until; \
|
||||
}}} /* namespace boost::typeindex::detail */ \
|
||||
/**/
|
||||
#define BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(begin_skip, end_skip, runtime_skip, runtime_skip_until, constexpr_begin_skip) \
|
||||
namespace boost { namespace typeindex { namespace detail { \
|
||||
BOOST_STATIC_CONSTEXPR std::size_t ctti_skip_size_at_begin = begin_skip; \
|
||||
BOOST_STATIC_CONSTEXPR std::size_t ctti_skip_size_at_end = end_skip; \
|
||||
BOOST_STATIC_CONSTEXPR bool ctti_skip_more_at_runtime = runtime_skip; \
|
||||
BOOST_STATIC_CONSTEXPR char ctti_skip_until_runtime[] = runtime_skip_until; \
|
||||
BOOST_STATIC_CONSTEXPR std::size_t ctti_skip_size_at_constexpr_begin = constexpr_begin_skip; \
|
||||
}}} /* namespace boost::typeindex::detail */ \
|
||||
/**/
|
||||
/// @endcond
|
||||
|
||||
|
||||
#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED)
|
||||
/* Nothing to document. All the macro docs are moved to <boost/type_index.hpp> */
|
||||
#elif defined(BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING)
|
||||
@ -43,10 +45,10 @@
|
||||
|
||||
#if defined (BOOST_NO_CXX11_NOEXCEPT)
|
||||
// sizeof("const char *__cdecl boost::detail::ctti<") - 1, sizeof(">::n(void)") - 1
|
||||
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 10, false, "")
|
||||
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 10, false, "", 0)
|
||||
#else
|
||||
// sizeof("const char *__cdecl boost::detail::ctti<") - 1, sizeof(">::n(void) noexcept") - 1
|
||||
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 19, false, "")
|
||||
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 19, false, "", 0)
|
||||
#endif
|
||||
#elif defined(__clang__) && defined(__APPLE__)
|
||||
// Someone made __clang_major__ equal to LLVM version rather than compiler version
|
||||
@ -54,21 +56,21 @@
|
||||
//
|
||||
// Using less efficient solution because there is no good way to detect real version of Clang.
|
||||
// sizeof("static const char *boost::detail::ctti<") - 1, sizeof("]") - 1, true, "???????????>::n() [T = int"
|
||||
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 1, true, "T = ")
|
||||
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 1, true, "T = ", 0)
|
||||
#elif defined(__clang__) && (__clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ == 0))
|
||||
// sizeof("static const char *boost::detail::ctti<") - 1, sizeof(">::n()") - 1
|
||||
// note: checked on 3.0
|
||||
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 6, false, "")
|
||||
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 6, false, "", 0)
|
||||
#elif defined(__clang__) && __clang_major__ == 3 && __clang_minor__ > 0
|
||||
// sizeof("static const char *boost::detail::ctti<") - 1, sizeof("]") - 1, true, "int>::n() [T = int"
|
||||
// note: checked on 3.1, 3.4
|
||||
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 1, true, "T = ")
|
||||
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 1, true, "T = ", 0)
|
||||
#elif defined(__GNUC__)
|
||||
// sizeof("static const char* boost::detail::ctti<T>::n() [with T = ") - 1, sizeof("]") - 1
|
||||
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(57, 1, false, "")
|
||||
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(57, 1, false, "", 91)
|
||||
#else
|
||||
// Deafult code for other platforms... Just skip nothing!
|
||||
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(0, 0, false, "")
|
||||
BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(0, 0, false, "", 0)
|
||||
#endif
|
||||
|
||||
#undef BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS
|
||||
@ -143,6 +145,79 @@ namespace boost { namespace typeindex { namespace detail {
|
||||
boost::mpl::bool_<ctti_skip_more_at_runtime>()
|
||||
);
|
||||
}
|
||||
|
||||
#if ! defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES ) && ! defined ( BOOST_NO_CXX11_CONSTEXPR )
|
||||
|
||||
|
||||
template <std::size_t Switch, class T0, class T1, class T2, class T3, class T4, class TDefault>
|
||||
struct switch_{
|
||||
typedef typename TDefault::type type;
|
||||
};
|
||||
|
||||
template <class T0, class T1, class T2, class T3, class T4, class TDefault>
|
||||
struct switch_<0, T0, T1, T2, T3, T4, TDefault>{ typedef typename T0::type type; };
|
||||
|
||||
template <class T0, class T1, class T2, class T3, class T4, class TDefault>
|
||||
struct switch_<1, T0, T1, T2, T3, T4, TDefault>{ typedef typename T1::type type; };
|
||||
|
||||
template <class T0, class T1, class T2, class T3, class T4, class TDefault>
|
||||
struct switch_<2, T0, T1, T2, T3, T4, TDefault>{ typedef typename T2::type type; };
|
||||
|
||||
template <class T0, class T1, class T2, class T3, class T4, class TDefault>
|
||||
struct switch_<3, T0, T1, T2, T3, T4, TDefault>{ typedef typename T3::type type; };
|
||||
|
||||
template <class T0, class T1, class T2, class T3, class T4, class TDefault>
|
||||
struct switch_<4, T0, T1, T2, T3, T4, TDefault>{ typedef typename T4::type type; };
|
||||
|
||||
|
||||
template<std::size_t ... Idx>
|
||||
struct index_seq {};
|
||||
|
||||
template<typename T, std::size_t... Append>
|
||||
struct append;
|
||||
|
||||
template<std::size_t ...indexes, std::size_t... Append>
|
||||
struct append<index_seq<indexes...>, Append...> {
|
||||
using type = index_seq<indexes ..., Append...>;
|
||||
};
|
||||
|
||||
template<typename T, std::size_t... Append>
|
||||
using append_t = typename append<T, Append...>::type;
|
||||
|
||||
template<std::size_t Size, std::size_t Counter = 0, typename T = index_seq<>>
|
||||
struct make_index_seq {
|
||||
typedef typename switch_<
|
||||
Size - Counter - 1,
|
||||
make_index_seq<Size, Counter+1, append_t<T, Counter> >,
|
||||
make_index_seq<Size, Counter+2, append_t<T, Counter, Counter + 1> >,
|
||||
make_index_seq<Size, Counter+3, append_t<T, Counter, Counter + 1, Counter + 2> >,
|
||||
make_index_seq<Size, Counter+4, append_t<T, Counter, Counter + 1, Counter + 2, Counter + 3> >,
|
||||
make_index_seq<Size, Counter+5, append_t<T, Counter, Counter + 1, Counter + 2, Counter + 3, Counter + 4> >,
|
||||
make_index_seq<Size, Counter+6, append_t<T, Counter, Counter + 1, Counter + 2, Counter + 3, Counter + 4, Counter + 5> >
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template<std::size_t Size, typename T>
|
||||
struct make_index_seq<Size, Size, T> {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<std::size_t Size, std::size_t Start = 0>
|
||||
using make_index_seq_t = typename make_index_seq<Size, Start>::type;
|
||||
|
||||
|
||||
|
||||
template <char... C>
|
||||
struct cstring {
|
||||
static constexpr std::size_t size_ = sizeof...(C) + 1;
|
||||
static constexpr char data_[size_] = { C..., '\0' };
|
||||
};
|
||||
|
||||
template <char... C>
|
||||
constexpr char cstring<C...>::data_[];
|
||||
#endif
|
||||
|
||||
|
||||
}}} // namespace boost::typeindex::detail
|
||||
|
||||
namespace boost { namespace detail {
|
||||
@ -152,11 +227,80 @@ namespace boost { namespace detail {
|
||||
/// This name must be as short as possible, to avoid code bloat
|
||||
template <class T>
|
||||
struct ctti {
|
||||
|
||||
/// Returns raw name. Must be as short, as possible, to avoid code bloat
|
||||
BOOST_CXX14_CONSTEXPR static const char* n() BOOST_NOEXCEPT {
|
||||
|
||||
#if ! defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES ) && ! defined ( BOOST_NO_CXX11_CONSTEXPR )
|
||||
//helper functions
|
||||
template <std::size_t Index>
|
||||
constexpr static char s() { // step
|
||||
constexpr std::size_t offset =
|
||||
(Index >= 10u ? 1u : 0u)
|
||||
+ (Index >= 100u ? 1u : 0u)
|
||||
+ (Index >= 1000u ? 1u : 0u)
|
||||
+ (Index >= 10000u ? 1u : 0u)
|
||||
+ (Index >= 100000u ? 1u : 0u)
|
||||
+ (Index >= 1000000u ? 1u : 0u)
|
||||
;
|
||||
|
||||
#if defined(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE)
|
||||
return boost::typeindex::detail::skip_begining< sizeof(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE >(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE);
|
||||
return BOOST_TYPE_INDEX_FUNCTION_SIGNATURE[Index + offset];
|
||||
#elif defined(__FUNCSIG__)
|
||||
return __FUNCSIG__[Index + offset];
|
||||
#elif defined(__PRETTY_FUNCTION__) \
|
||||
|| defined(__GNUC__) \
|
||||
|| (defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130)) \
|
||||
|| (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) \
|
||||
|| (defined(__ICC) && (__ICC >= 600)) \
|
||||
|| defined(__ghs__) \
|
||||
|| defined(__DMC__)
|
||||
return __PRETTY_FUNCTION__[Index + offset];
|
||||
#else
|
||||
BOOST_STATIC_ASSERT_MSG(
|
||||
sizeof(T) && false,
|
||||
"TypeIndex library could not detect your compiler. "
|
||||
"Please make the BOOST_TYPE_INDEX_FUNCTION_SIGNATURE macro use "
|
||||
"correct compiler macro for getting the whole function name. "
|
||||
"Define BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING to correct value after that."
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<std::size_t ...Indexes>
|
||||
constexpr static auto impl(::boost::typeindex::detail::index_seq<Indexes...> ) {
|
||||
return ::boost::typeindex::detail::cstring<s<Indexes>()...>();
|
||||
}
|
||||
|
||||
template <std::size_t Dummy = 0>
|
||||
constexpr static auto n()
|
||||
{
|
||||
constexpr std::size_t size = sizeof(
|
||||
#if defined(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE)
|
||||
BOOST_TYPE_INDEX_FUNCTION_SIGNATURE
|
||||
#elif defined(__FUNCSIG__)
|
||||
__FUNCSIG__
|
||||
#elif defined(__PRETTY_FUNCTION__) \
|
||||
|| defined(__GNUC__) \
|
||||
|| (defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130)) \
|
||||
|| (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) \
|
||||
|| (defined(__ICC) && (__ICC >= 600)) \
|
||||
|| defined(__ghs__) \
|
||||
|| defined(__DMC__)
|
||||
__PRETTY_FUNCTION__
|
||||
#else
|
||||
int
|
||||
#endif
|
||||
);
|
||||
|
||||
using idx_seq = boost::typeindex::detail::make_index_seq_t<
|
||||
size - boost::typeindex::detail::ctti_skip_size_at_end,
|
||||
boost::typeindex::detail::ctti_skip_size_at_constexpr_begin
|
||||
>;
|
||||
return decltype( impl(idx_seq()) )::data_;
|
||||
}
|
||||
#else
|
||||
/// Returns raw name. Must be as short, as possible, to avoid code bloat
|
||||
static const char* n() BOOST_NOEXCEPT {
|
||||
#if defined(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE)
|
||||
return boost::typeindex::detail::skip_begining< sizeof(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE) >(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE);
|
||||
#elif defined(__FUNCSIG__)
|
||||
return boost::typeindex::detail::skip_begining< sizeof(__FUNCSIG__) >(__FUNCSIG__);
|
||||
#elif defined(__PRETTY_FUNCTION__) \
|
||||
@ -166,7 +310,6 @@ struct ctti {
|
||||
|| (defined(__ICC) && (__ICC >= 600)) \
|
||||
|| defined(__ghs__) \
|
||||
|| defined(__DMC__)
|
||||
|
||||
return boost::typeindex::detail::skip_begining< sizeof(__PRETTY_FUNCTION__) >(__PRETTY_FUNCTION__);
|
||||
#else
|
||||
BOOST_STATIC_ASSERT_MSG(
|
||||
@ -178,6 +321,7 @@ struct ctti {
|
||||
);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
}} // namespace boost::detail
|
||||
|
@ -66,7 +66,7 @@ template <class Derived, class TypeInfo>
|
||||
class type_index_facade {
|
||||
private:
|
||||
/// @cond
|
||||
const Derived & derived() const BOOST_NOEXCEPT {
|
||||
BOOST_CXX14_CONSTEXPR const Derived & derived() const BOOST_NOEXCEPT {
|
||||
return *static_cast<Derived const*>(this);
|
||||
}
|
||||
/// @endcond
|
||||
@ -154,34 +154,34 @@ protected:
|
||||
|
||||
/// @cond
|
||||
template <class Derived, class TypeInfo>
|
||||
inline bool operator == (const type_index_facade<Derived, TypeInfo>& lhs, const type_index_facade<Derived, TypeInfo>& rhs) BOOST_NOEXCEPT {
|
||||
BOOST_CXX14_CONSTEXPR inline bool operator == (const type_index_facade<Derived, TypeInfo>& lhs, const type_index_facade<Derived, TypeInfo>& rhs) BOOST_NOEXCEPT {
|
||||
return static_cast<Derived const&>(lhs).equal(static_cast<Derived const&>(rhs));
|
||||
}
|
||||
|
||||
template <class Derived, class TypeInfo>
|
||||
inline bool operator < (const type_index_facade<Derived, TypeInfo>& lhs, const type_index_facade<Derived, TypeInfo>& rhs) BOOST_NOEXCEPT {
|
||||
BOOST_CXX14_CONSTEXPR inline bool operator < (const type_index_facade<Derived, TypeInfo>& lhs, const type_index_facade<Derived, TypeInfo>& rhs) BOOST_NOEXCEPT {
|
||||
return static_cast<Derived const&>(lhs).before(static_cast<Derived const&>(rhs));
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <class Derived, class TypeInfo>
|
||||
inline bool operator > (const type_index_facade<Derived, TypeInfo>& lhs, const type_index_facade<Derived, TypeInfo>& rhs) BOOST_NOEXCEPT {
|
||||
BOOST_CXX14_CONSTEXPR inline bool operator > (const type_index_facade<Derived, TypeInfo>& lhs, const type_index_facade<Derived, TypeInfo>& rhs) BOOST_NOEXCEPT {
|
||||
return rhs < lhs;
|
||||
}
|
||||
|
||||
template <class Derived, class TypeInfo>
|
||||
inline bool operator <= (const type_index_facade<Derived, TypeInfo>& lhs, const type_index_facade<Derived, TypeInfo>& rhs) BOOST_NOEXCEPT {
|
||||
BOOST_CXX14_CONSTEXPR inline bool operator <= (const type_index_facade<Derived, TypeInfo>& lhs, const type_index_facade<Derived, TypeInfo>& rhs) BOOST_NOEXCEPT {
|
||||
return !(lhs > rhs);
|
||||
}
|
||||
|
||||
template <class Derived, class TypeInfo>
|
||||
inline bool operator >= (const type_index_facade<Derived, TypeInfo>& lhs, const type_index_facade<Derived, TypeInfo>& rhs) BOOST_NOEXCEPT {
|
||||
BOOST_CXX14_CONSTEXPR inline bool operator >= (const type_index_facade<Derived, TypeInfo>& lhs, const type_index_facade<Derived, TypeInfo>& rhs) BOOST_NOEXCEPT {
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
|
||||
template <class Derived, class TypeInfo>
|
||||
inline bool operator != (const type_index_facade<Derived, TypeInfo>& lhs, const type_index_facade<Derived, TypeInfo>& rhs) BOOST_NOEXCEPT {
|
||||
BOOST_CXX14_CONSTEXPR inline bool operator != (const type_index_facade<Derived, TypeInfo>& lhs, const type_index_facade<Derived, TypeInfo>& rhs) BOOST_NOEXCEPT {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
@ -58,8 +58,6 @@ test-suite type_index
|
||||
[ link-fail testing_crossmodule.cpp test_lib_nortti : : link_fail_rtti_nortti ]
|
||||
[ run testing_crossmodule.cpp test_lib_rtti_compat : : : $(nortti) $(compat) : testing_crossmodule_nortti_rtti_compat ]
|
||||
[ run testing_crossmodule.cpp test_lib_nortti_compat : : : $(compat) : testing_crossmodule_rtti_nortti_compat ]
|
||||
# The constexpr meta_type
|
||||
[ run test_constexpr.cpp ]
|
||||
;
|
||||
|
||||
# Assuring that examples compile and run. Adding sources from `examples` directory to the `type_index` test suite.
|
||||
|
@ -10,7 +10,7 @@
|
||||
// This cpp file:
|
||||
// * tests BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING macro
|
||||
// * outputs full ctti name so that TypeIndex library could be adjust to new compiler without requesting regression tester's help
|
||||
#define BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING (0,0,false,"")
|
||||
#define BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING (0,0,false,"",0)
|
||||
#include <boost/type_index/ctti_type_index.hpp>
|
||||
|
||||
namespace user_defined_namespace {
|
||||
|
@ -1,67 +0,0 @@
|
||||
//
|
||||
// Copyright Klemens Morgenstern
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/type_index/ctti_type_index.hpp>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#if ! defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES ) && ! defined ( BOOST_NO_CXX11_CONSTEXPR ) && ! defined( BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION )
|
||||
|
||||
template<typename ...Args>
|
||||
struct my_dummy_tuple {};
|
||||
|
||||
int main()
|
||||
{
|
||||
using ti = boost::typeindex::ctti_type_index;
|
||||
using t1 = int;
|
||||
using t2 = double;
|
||||
using t3 = my_dummy_tuple<int, double>;
|
||||
using t4 = my_dummy_tuple<double, int, int, int, double, void*>;
|
||||
|
||||
|
||||
using ct1 = typename boost::typeindex::ctti_type_index_t<t1>;
|
||||
using ct2 = typename boost::typeindex::ctti_type_index_t<t2>;
|
||||
using ct3 = typename boost::typeindex::ctti_type_index_t<t3>;
|
||||
using ct4 = typename boost::typeindex::ctti_type_index_t<t4>;
|
||||
|
||||
BOOST_STATIC_ASSERT( ct1() != ct2());
|
||||
BOOST_STATIC_ASSERT( ct1() == ct1());
|
||||
|
||||
BOOST_STATIC_ASSERT( ct2() < ct1());
|
||||
BOOST_STATIC_ASSERT( ct3() > ct4());
|
||||
BOOST_STATIC_ASSERT( ct1() >= ct1());
|
||||
BOOST_STATIC_ASSERT( ct1() <= ct1());
|
||||
|
||||
|
||||
cout << ct1().to_string() << endl;
|
||||
cout << ct2().to_string() << endl;
|
||||
cout << ct3().to_string() << endl;
|
||||
cout << ct4().to_string() << endl;
|
||||
|
||||
BOOST_TEST(to_string(ct1()) == ti::type_id<t1>().pretty_name());
|
||||
BOOST_TEST(to_string(ct2()) == ti::type_id<t2>().pretty_name());
|
||||
BOOST_TEST(to_string(ct3()) == ti::type_id<t3>().pretty_name());
|
||||
BOOST_TEST(to_string(ct4()) == ti::type_id<t4>().pretty_name());
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
@ -74,16 +74,16 @@ void search_same() {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
#ifndef BOOST_NO_CXX14_CONSTEXPR
|
||||
template <class T>
|
||||
struct is_boost_namespace {
|
||||
constexpr char cb[5] = {'b', 'o', 'o', 's', 't'};
|
||||
constexpr boost::typeindex::ctti_type_index type = boost::typeindex::ctti_type_index::type_id<T>();
|
||||
constexpr bool value = (boost::typeindex::detail::constexpr_search(type.name(), type.name() + 5, cb, cb + 5) != cb + 5);
|
||||
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
|
||||
|
||||
*/
|
||||
|
||||
void constexpr_test() {
|
||||
using namespace boost::typeindex;
|
||||
@ -123,11 +123,11 @@ void constexpr_test() {
|
||||
|
||||
|
||||
BOOST_CXX14_CONSTEXPR const char* int_name = t_int0.name();
|
||||
BOOST_TEST(int_name);
|
||||
BOOST_TEST(*int_name != '\0');
|
||||
|
||||
BOOST_CXX14_CONSTEXPR const char* short_name = t_short0.name();
|
||||
BOOST_TEST(short_name);
|
||||
|
||||
BOOST_TEST(*short_name != '\0');
|
||||
/*
|
||||
#ifndef BOOST_NO_CXX14_CONSTEXPR
|
||||
constexpr bool in_namespace = is_boost_namespace<ctti_type_index>::value;
|
||||
BOOST_TEST(in_namespace);
|
||||
@ -135,7 +135,7 @@ void constexpr_test() {
|
||||
constexpr bool not_in_namespace = !is_boost_namespace<std::string>::value;
|
||||
BOOST_TEST(not_in_namespace);
|
||||
#endif
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user