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