mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-14 15:53:51 +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;
|
||||
}
|
||||
|
||||
#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
|
||||
{
|
||||
check_valid();
|
||||
|
@ -79,7 +79,13 @@ public:
|
||||
// Create an empty node.
|
||||
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.
|
||||
@ -88,7 +94,6 @@ public:
|
||||
|
||||
~config();
|
||||
|
||||
config& operator=(const config& cfg);
|
||||
|
||||
#ifdef HAVE_CXX0X
|
||||
explicit operator bool() const
|
||||
|
Loading…
x
Reference in New Issue
Block a user