forked from boostorg/static_string
Fix standard version detection for msvc and void_t for certain gcc versions
This commit is contained in:
@ -21,7 +21,7 @@
|
||||
// #define BOOST_STATIC_STRING_NULL_OPTIMIZATION
|
||||
|
||||
// Can we have deduction guides?
|
||||
#ifdef __cpp_deduction_guides
|
||||
#if __cpp_deduction_guides >= 201703
|
||||
#define BOOST_STATIC_STRING_USE_DEDUCT
|
||||
#endif
|
||||
|
||||
@ -36,7 +36,14 @@
|
||||
#define BOOST_STATIC_STRING_NODISCARD
|
||||
#endif
|
||||
|
||||
#if __cplusplus > 201703L
|
||||
// MSVC doesn't define __cplusplus by default
|
||||
#ifdef _MSVC_LANG
|
||||
#define BOOST_STATIC_STRING_STANDARD_VERSION _MSVC_LANG
|
||||
#else
|
||||
#define BOOST_STATIC_STRING_STANDARD_VERSION __cplusplus
|
||||
#endif
|
||||
|
||||
#if BOOST_STATIC_STRING_STANDARD_VERSION > 201703L
|
||||
#define BOOST_STATIC_STRING_CPP20_CONSTEXPR constexpr
|
||||
#define BOOST_STATIC_STRING_CPP17_CONSTEXPR constexpr
|
||||
#define BOOST_STATIC_STRING_CPP14_CONSTEXPR constexpr
|
||||
@ -46,7 +53,7 @@
|
||||
#define BOOST_STATIC_STRING_CPP14_CONSTEXPR_USED
|
||||
#define BOOST_STATIC_STRING_CPP11_CONSTEXPR_USED
|
||||
#define BOOST_STATIC_STRING_ALLOW_UNINIT_MEM
|
||||
#elif __cplusplus >= 201703L
|
||||
#elif BOOST_STATIC_STRING_STANDARD_VERSION >= 201703L
|
||||
#define BOOST_STATIC_STRING_CPP20_CONSTEXPR
|
||||
#define BOOST_STATIC_STRING_CPP17_CONSTEXPR constexpr
|
||||
#define BOOST_STATIC_STRING_CPP14_CONSTEXPR constexpr
|
||||
@ -54,7 +61,7 @@
|
||||
#define BOOST_STATIC_STRING_CPP17_CONSTEXPR_USED
|
||||
#define BOOST_STATIC_STRING_CPP14_CONSTEXPR_USED
|
||||
#define BOOST_STATIC_STRING_CPP11_CONSTEXPR_USED
|
||||
#elif __cplusplus >= 201402L
|
||||
#elif BOOST_STATIC_STRING_STANDARD_VERSION >= 201402L
|
||||
#define BOOST_STATIC_STRING_CPP20_CONSTEXPR
|
||||
#define BOOST_STATIC_STRING_CPP17_CONSTEXPR
|
||||
#define BOOST_STATIC_STRING_CPP14_CONSTEXPR constexpr
|
||||
@ -117,8 +124,8 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (__cplusplus >= 201402L) && \
|
||||
(__cplusplus < 201703L) && \
|
||||
#if (BOOST_STATIC_STRING_STANDARD_VERSION >= 201402L) && \
|
||||
(BOOST_STATIC_STRING_STANDARD_VERSION < 201703L) && \
|
||||
defined(__clang__) && \
|
||||
((__clang_major__ == 4) || (__clang_major__ == 5))
|
||||
// This directive works on clang
|
||||
|
@ -63,9 +63,16 @@ struct is_nothrow_convertible<From, To, typename std::enable_if<
|
||||
is_nothrow_convertible_msvc_helper<From, To>::value>::type>
|
||||
: std::true_type { };
|
||||
|
||||
// void_t for c++11
|
||||
// GCC 4.8, 4.9 workaround for void_t to make the defining-type-id dependant
|
||||
template<typename...>
|
||||
using void_t = void;
|
||||
struct void_t_helper
|
||||
{
|
||||
using type = void;
|
||||
};
|
||||
|
||||
// void_t for c++11
|
||||
template<typename... Ts>
|
||||
using void_t = typename void_t_helper<Ts...>::type;
|
||||
|
||||
// Simplified check for if a type is an iterator
|
||||
template<class T, typename = void>
|
||||
|
@ -337,8 +337,8 @@ insert(
|
||||
count > max_size() - curr_size, std::length_error{"count() > max_size() - size()"});
|
||||
auto const index = pos - curr_data;
|
||||
Traits::move(&curr_data[index + count], &curr_data[index], curr_size - index);
|
||||
this->set_size(curr_size + count);
|
||||
Traits::assign(&curr_data[index], count, ch);
|
||||
this->set_size(curr_size + count);
|
||||
term();
|
||||
return &curr_data[index];
|
||||
}
|
||||
|
Reference in New Issue
Block a user