Fix perfect fowards
parent
5a0df03d2b
commit
97cb1c6b15
|
@ -85,24 +85,24 @@ public: // constructors
|
|||
|
||||
// convenience template to construct with properties directly
|
||||
template <typename... More>
|
||||
Node(const std::string& n, const More... more)
|
||||
Node(const std::string& n, More&&... more)
|
||||
: name(n)
|
||||
, properties()
|
||||
, children()
|
||||
, force_has_children(false) {
|
||||
AddProperties(more...);
|
||||
AddProperties(std::forward<More>(more)...);
|
||||
}
|
||||
|
||||
public: // functions to add properties or children
|
||||
// add a single property to the node
|
||||
template <typename T>
|
||||
void AddProperty(T value) {
|
||||
void AddProperty(T&& value) {
|
||||
properties.emplace_back(std::forward<T>(value));
|
||||
}
|
||||
|
||||
// convenience function to add multiple properties at once
|
||||
template <typename T, typename... More>
|
||||
void AddProperties(T value, More... more) {
|
||||
void AddProperties(T&& value, More&&... more) {
|
||||
properties.emplace_back(std::forward<T>(value));
|
||||
AddProperties(std::forward<More>(more)...);
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public: // functions to add properties or children
|
|||
template <typename... More>
|
||||
void AddChild(
|
||||
const std::string& name,
|
||||
More... more
|
||||
More&&... more
|
||||
) {
|
||||
FBX::Node c(name);
|
||||
c.AddProperties(std::forward<More>(more)...);
|
||||
|
@ -147,7 +147,7 @@ public: // support specifically for dealing with Properties70 nodes
|
|||
const std::string& type,
|
||||
const std::string& type2,
|
||||
const std::string& flags,
|
||||
More... more
|
||||
More&&... more
|
||||
) {
|
||||
Node n("P");
|
||||
n.AddProperties(name, type, type2, flags, std::forward<More>(more)...);
|
||||
|
|
|
@ -245,12 +245,9 @@ struct Nullable {
|
|||
|
||||
Nullable() :
|
||||
isPresent(false) {}
|
||||
Nullable(const T &val) :
|
||||
Nullable(T &val) :
|
||||
value(val),
|
||||
isPresent(true) {}
|
||||
Nullable(T &&val) :
|
||||
value(std::move(val)),
|
||||
isPresent(true) {}
|
||||
};
|
||||
|
||||
//! A reference to one top-level object, which is valid
|
||||
|
|
Loading…
Reference in New Issue