strbuffer: use static initializer instead of variadic constructor

This commit is contained in:
Andrzej Rybczak
2014-11-01 01:49:18 +01:00
parent e9a539f8ee
commit 42dce36625
2 changed files with 16 additions and 12 deletions

View File

@@ -90,12 +90,6 @@ public:
typedef std::basic_string<CharT> StringType;
typedef std::set<Property> Properties;
template <typename... Args>
BasicBuffer(Args&&... args)
{
construct(std::forward<Args>(args)...);
}
const StringType &str() const { return m_string; }
const Properties &properties() const { return m_properties; }
@@ -187,6 +181,16 @@ public:
return *this;
}
// static variadic initializer. used instead of a proper constructor because
// it's too polymorphic and would end up invoked as a copy/move constructor.
template <typename... Args>
static BasicBuffer init(Args&&... args)
{
BasicBuffer result;
result.construct(std::forward<Args>(args)...);
return result;
}
private:
void construct() { }
template <typename ArgT, typename... Args>