mirror of
https://github.com/kennethreitz/static_string.git
synced 2026-06-05 23:00:20 +00:00
Merge review changes with master
* Initial constexpr support * Remove invisible unicode * Fix const function qualification * Working constexpr
This commit is contained in:
committed by
GitHub
parent
aa0fad2304
commit
c3110b1b6c
@@ -12,7 +12,7 @@
|
||||
#define BOOST_FIXED_STRING_CONFIG_HPP
|
||||
|
||||
// Are we dependent on Boost?
|
||||
#define BOOST_FIXED_STRING_USE_BOOST
|
||||
// #define BOOST_FIXED_STRING_STANDALONE
|
||||
|
||||
// Can we have deduction guides?
|
||||
#ifdef __cpp_deduction_guides
|
||||
@@ -30,8 +30,45 @@
|
||||
#define BOOST_FIXED_STRING_NODISCARD
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_FIXED_STRING_USE_BOOST
|
||||
//#undef __cplusplus
|
||||
//#define __cplusplus 201703L
|
||||
|
||||
#if __cplusplus > 201703L
|
||||
#define BOOST_FIXED_STRING_CPP20_CXPER constexpr
|
||||
#define BOOST_FIXED_STRING_CPP17_CXPER constexpr
|
||||
#define BOOST_FIXED_STRING_CPP14_CXPER constexpr
|
||||
#define BOOST_FIXED_STRING_CPP11_CXPER constexpr
|
||||
#define BOOST_FIXED_STRING_CPP20_CXPER_USED
|
||||
#define BOOST_FIXED_STRING_CPP17_CXPER_USED
|
||||
#define BOOST_FIXED_STRING_CPP14_CXPER_USED
|
||||
#define BOOST_FIXED_STRING_CPP11_CXPER_USED
|
||||
#define BOOST_FIXED_STRING_ALLOW_UNINIT_MEM
|
||||
#elif __cplusplus >= 201703L
|
||||
#define BOOST_FIXED_STRING_CPP20_CXPER
|
||||
#define BOOST_FIXED_STRING_CPP17_CXPER constexpr
|
||||
#define BOOST_FIXED_STRING_CPP14_CXPER constexpr
|
||||
#define BOOST_FIXED_STRING_CPP11_CXPER constexpr
|
||||
#define BOOST_FIXED_STRING_CPP17_CXPER_USED
|
||||
#define BOOST_FIXED_STRING_CPP14_CXPER_USED
|
||||
#define BOOST_FIXED_STRING_CPP11_CXPER_USED
|
||||
#elif __cplusplus >= 201402L
|
||||
#define BOOST_FIXED_STRING_CPP20_CXPER
|
||||
#define BOOST_FIXED_STRING_CPP17_CXPER
|
||||
#define BOOST_FIXED_STRING_CPP14_CXPER constexpr
|
||||
#define BOOST_FIXED_STRING_CPP11_CXPER constexpr
|
||||
#define BOOST_FIXED_STRING_CPP14_CXPER_USED
|
||||
#define BOOST_FIXED_STRING_CPP11_CXPER_USED
|
||||
#else
|
||||
#define BOOST_FIXED_STRING_CPP20_CXPER
|
||||
#define BOOST_FIXED_STRING_CPP17_CXPER
|
||||
#define BOOST_FIXED_STRING_CPP14_CXPER
|
||||
#define BOOST_FIXED_STRING_CPP11_CXPER constexpr
|
||||
#define BOOST_FIXED_STRING_CPP11_CXPER_USED
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_FIXED_STRING_STANDALONE
|
||||
#include <boost/utility/string_view.hpp>
|
||||
#include <boost/container_hash/hash.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
@@ -41,7 +78,7 @@
|
||||
#endif
|
||||
|
||||
// Boost and non-Boost versions of utilities
|
||||
#ifdef BOOST_FIXED_STRING_USE_BOOST
|
||||
#ifndef BOOST_FIXED_STRING_STANDALONE
|
||||
#ifndef BOOST_FIXED_STRING_THROW
|
||||
#define BOOST_FIXED_STRING_THROW(ex) BOOST_THROW_EXCEPTION(ex)
|
||||
#endif
|
||||
@@ -66,18 +103,10 @@
|
||||
namespace boost {
|
||||
namespace fixed_string {
|
||||
|
||||
/// The type of `string_view` used by the library
|
||||
using string_view =
|
||||
#ifdef BOOST_FIXED_STRING_USE_BOOST
|
||||
boost::string_view;
|
||||
#else
|
||||
std::string_view;
|
||||
#endif
|
||||
|
||||
/// The type of `basic_string_view` used by the library
|
||||
template<typename CharT, typename Traits>
|
||||
using basic_string_view =
|
||||
#ifdef BOOST_FIXED_STRING_USE_BOOST
|
||||
#ifndef BOOST_FIXED_STRING_STANDALONE
|
||||
boost::basic_string_view<CharT, Traits>;
|
||||
#else
|
||||
std::basic_string_view<CharT, Traits>;
|
||||
|
||||
Reference in New Issue
Block a user