mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-06 21:35:44 +00:00
Enable C++11 define when the compiler does.
* Renames HAVE_CXX0X to HAVE_CXX11 to be in line with the offical name. * Depends on __cplusplus being defined as >= 201103L.
This commit is contained in:
parent
bf3e3fbe3b
commit
56b7e3baa1
@ -427,7 +427,7 @@ config& config::operator=(const config& cfg)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifdef HAVE_CXX0X
|
||||
#ifdef HAVE_CXX11
|
||||
config::config(config &&cfg):
|
||||
values(std::move(cfg.values)),
|
||||
children(std::move(cfg.children)),
|
||||
@ -641,7 +641,7 @@ config& config::add_child(const std::string& key, const config& val)
|
||||
return *v.back();
|
||||
}
|
||||
|
||||
#ifdef HAVE_CXX0X
|
||||
#ifdef HAVE_CXX11
|
||||
config &config::add_child(const std::string &key, config &&val)
|
||||
{
|
||||
check_valid(val);
|
||||
|
@ -70,7 +70,7 @@ class config
|
||||
*/
|
||||
void check_valid(const config &cfg) const;
|
||||
|
||||
#ifndef HAVE_CXX0X
|
||||
#ifndef HAVE_CXX11
|
||||
struct safe_bool_impl { void nonnull() {} };
|
||||
/**
|
||||
* Used as the return type of the conversion operator for boolean contexts.
|
||||
@ -87,7 +87,7 @@ public:
|
||||
config(const config &);
|
||||
config &operator=(const config &);
|
||||
|
||||
#ifdef HAVE_CXX0X
|
||||
#ifdef HAVE_CXX11
|
||||
config(config &&);
|
||||
config &operator=(config &&);
|
||||
#endif
|
||||
@ -100,7 +100,7 @@ public:
|
||||
~config();
|
||||
|
||||
|
||||
#ifdef HAVE_CXX0X
|
||||
#ifdef HAVE_CXX11
|
||||
explicit operator bool() const
|
||||
{ return this != &invalid; }
|
||||
#else
|
||||
@ -396,7 +396,7 @@ public:
|
||||
config& add_child(const std::string& key, const config& val);
|
||||
config& add_child_at(const std::string &key, const config &val, unsigned index);
|
||||
|
||||
#ifdef HAVE_CXX0X
|
||||
#ifdef HAVE_CXX11
|
||||
config &add_child(const std::string &key, config &&val);
|
||||
#endif
|
||||
|
||||
|
@ -37,4 +37,20 @@
|
||||
|
||||
#endif //_MSC_VER
|
||||
|
||||
/**
|
||||
* Enable C++11 support in some parts of the code.
|
||||
*
|
||||
* These parts \em must also work without C++11, since Wesnoth still uses C++98
|
||||
* as officiaal C++ version.
|
||||
*
|
||||
* @note Older version of GCC don't define the proper version for
|
||||
* @c __cplusplus, but have their own test macro. That test is omitted since
|
||||
* the amount of support for these compilers depends al lot on the exact
|
||||
* compiler version. If you want to enable it for these compilers simply define
|
||||
* the macro manually.
|
||||
*/
|
||||
#if (__cplusplus >= 201103L)
|
||||
#define HAVE_CXX11
|
||||
#endif
|
||||
|
||||
#endif //GLOBAL_HPP_INCLUDED
|
||||
|
Loading…
x
Reference in New Issue
Block a user