Removed C++14 feature macros

This commit is contained in:
Charles Dang 2018-03-19 00:09:33 +11:00
parent 0c04d26543
commit 8becb29fad
4 changed files with 11 additions and 79 deletions

View file

@ -49,27 +49,6 @@
#include "config_attribute_value.hpp"
#include "exceptions.hpp"
#ifdef HAVE_CXX14
# ifdef __clang__ // Check this first, because clang also defines __GNUC__
# ifdef __apple_build_version__ // Apple clang
# if (__clang_major__ == 5 && __clang_minor__ >= 1) || __clang_major__ > 5 // Apple clang 5.1+
# define USE_HETEROGENOUS_LOOKUPS
# endif
# else // Non-Apple clang
# if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3 // clang 3.4+
# define USE_HETEROGENOUS_LOOKUPS
# endif
# endif
# elif defined(__GNUC__) && __GNUC__ >= 5 // GCC 5.0+
# define USE_HETEROGENOUS_LOOKUPS
# endif
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1900 // MSVC 2015
# define USE_HETEROGENOUS_LOOKUPS
#endif
#ifdef USE_HETEROGENOUS_LOOKUPS
#if BOOST_VERSION > 106100
#include <boost/utility/string_view.hpp>
using config_key_type = boost::string_view;
@ -77,9 +56,6 @@ using config_key_type = boost::string_view;
#include <boost/utility/string_ref.hpp>
using config_key_type = boost::string_ref;
#endif
#else
using config_key_type = const std::string &;
#endif
class config;
class enum_tag;
@ -141,11 +117,7 @@ public:
{ return this != &invalid; }
typedef std::vector<std::unique_ptr<config>> child_list;
typedef std::map<std::string, child_list
#ifdef USE_HETEROGENOUS_LOOKUPS
, std::less<>
#endif
> child_map;
typedef std::map<std::string, child_list, std::less<>> child_map;
struct const_child_iterator;
@ -249,9 +221,7 @@ public:
typedef std::map<
std::string
, attribute_value
#ifdef USE_HETEROGENOUS_LOOKUPS
, std::less<>
#endif
> attribute_map;
typedef attribute_map::value_type attribute;
struct const_attribute_iterator;
@ -405,7 +375,6 @@ public:
*/
const attribute_value& operator[](config_key_type key) const;
#ifdef USE_HETEROGENOUS_LOOKUPS
/**
* Returns a reference to the attribute with the given @a key.
* Creates it if it does not exist.
@ -423,7 +392,6 @@ public:
{
return operator[](config_key_type(key));
}
#endif
/**
* Returns a reference to the attribute with the given @a key.

View file

@ -47,26 +47,6 @@
#include "tstring.hpp"
#ifdef HAVE_CXX14
# ifdef __clang__ // Check this first, because clang also defines __GNUC__
# ifdef __apple_build_version__ // Apple clang
# if (__clang_major__ == 5 && __clang_minor__ >= 1) || __clang_major__ > 5 // Apple clang 5.1+
# define USE_HETEROGENOUS_LOOKUPS
# endif
# else // Non-Apple clang
# if (__clang_major__ == 3 && __clang_minor__ >= 4) || __clang_major__ > 3 // clang 3.4+
# define USE_HETEROGENOUS_LOOKUPS
# endif
# endif
# elif defined(__GNUC__) && __GNUC__ >= 5 // GCC 5.0+
# define USE_HETEROGENOUS_LOOKUPS
# endif
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1900 // MSVC 2015
# define USE_HETEROGENOUS_LOOKUPS
#endif
class enum_tag;
/**

View file

@ -38,38 +38,32 @@
class formatter
{
public:
formatter() :
stream_()
formatter()
: stream_()
{
}
template<typename T>
formatter& operator<<(const T & o)
#if HAVE_REF_QUALIFIERS
&
#endif
formatter& operator<<(const T& o) &
{
stream_ << o;
return *this;
}
#if HAVE_REF_QUALIFIERS
template <typename T>
formatter && operator<<(const T & o) && {
template<typename T>
formatter&& operator<<(const T& o) &&
{
stream_ << o;
return std::move(*this);
}
#endif
std::string str() const {
std::string str() const
{
return stream_.str();
}
// Implicit x-value conversion to string
operator std::string() const
#if HAVE_REF_QUALIFIERS
&&
#endif
operator std::string() const &&
{
return stream_.str();
}

View file

@ -33,20 +33,15 @@
#define UNUSED(x) ((void)(x)) /* to avoid warnings */
// To allow using some optional C++14 and C++17 features
#if __cplusplus >= 201402L
#define HAVE_CXX14
// To allow using some optional C++17 features
#if __cplusplus >= 201703L
#define HAVE_CXX17
#endif
#endif
// Some C++11 features are not available on all supported platforms
#if defined(_MSC_VER)
// MSVC supports these starting in MSVC 2015
#if _MSC_VER >= 1900
#define HAVE_REF_QUALIFIERS 1
#define HAVE_INHERITING_CTORS 1
#else
#endif
// MSVC supports these starting in 2017?
@ -67,9 +62,6 @@
#if defined(__clang__)
#include <ciso646> // To ensure standard library version macros are defined
// Clang has convenient feature detection macros \o/
#define HAVE_REF_QUALIFIERS __has_feature(cxx_reference_qualified_functions)
#define HAVE_INHERITING_CTORS __has_feature(cxx_inheriting_constructors)
// All supported versions of clang have these
#define FALLTHROUGH [[clang::fallthrough]]
// Use GCC-style attribute because the __has_cpp_attribute feature-checking macro doesn't exist in clang 3.5
@ -79,8 +71,6 @@
#if defined(__GNUC__) && !defined(__clang__)
// GCC supports these from 4.8 up
#define HAVE_REF_QUALIFIERS 1
#define HAVE_INHERITING_CTORS 1
// Deprecated is supported from 4.9 up
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)