Added a move-aware implementation of config::add_child.
This commit is contained in:
parent
46dba2216f
commit
333f3761a2
2 changed files with 16 additions and 0 deletions
|
@ -390,6 +390,18 @@ config& config::add_child(const std::string& key, const config& val)
|
|||
return *v.back();
|
||||
}
|
||||
|
||||
#ifdef HAVE_CXX0X
|
||||
config &config::add_child(const std::string &key, config &&val)
|
||||
{
|
||||
check_valid(val);
|
||||
|
||||
child_list &v = children[key];
|
||||
v.push_back(new config(std::move(val)));
|
||||
ordered_children.push_back(child_pos(children.find(key), v.size() - 1));
|
||||
return *v.back();
|
||||
}
|
||||
#endif
|
||||
|
||||
config &config::add_child_at(const std::string &key, const config &val, unsigned index)
|
||||
{
|
||||
check_valid(val);
|
||||
|
|
|
@ -275,6 +275,10 @@ 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
|
||||
config &add_child(const std::string &key, config &&val);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns a reference to the attribute with the given @a key.
|
||||
* Creates it if it does not exist.
|
||||
|
|
Loading…
Add table
Reference in a new issue