mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-14 21:19:08 +00:00
Added move operators to class config,
...in order to speed up standard containers (e.g. std::vector).
This commit is contained in:
parent
1e4eab72fc
commit
63caf15a2f
@ -209,6 +209,22 @@ config& config::operator=(const config& cfg)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_CXX0X
|
||||||
|
config::config(config &&cfg):
|
||||||
|
values(std::move(cfg.values)),
|
||||||
|
children(std::move(cfg.children)),
|
||||||
|
ordered_children(std::move(cfg.ordered_children))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
config &config::operator=(config &&cfg)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
swap(cfg);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool config::has_attribute(const std::string &key) const
|
bool config::has_attribute(const std::string &key) const
|
||||||
{
|
{
|
||||||
check_valid();
|
check_valid();
|
||||||
|
@ -79,7 +79,13 @@ public:
|
|||||||
// Create an empty node.
|
// Create an empty node.
|
||||||
config();
|
config();
|
||||||
|
|
||||||
config(const config& cfg);
|
config(const config &);
|
||||||
|
config &operator=(const config &);
|
||||||
|
|
||||||
|
#ifdef HAVE_CXX0X
|
||||||
|
config(config &&);
|
||||||
|
config &operator=(config &&);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a config object with an empty child of name @a child.
|
* Creates a config object with an empty child of name @a child.
|
||||||
@ -88,7 +94,6 @@ public:
|
|||||||
|
|
||||||
~config();
|
~config();
|
||||||
|
|
||||||
config& operator=(const config& cfg);
|
|
||||||
|
|
||||||
#ifdef HAVE_CXX0X
|
#ifdef HAVE_CXX0X
|
||||||
explicit operator bool() const
|
explicit operator bool() const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user