add order_by_name helper method

This commit is contained in:
artemp 2016-08-15 12:20:19 +01:00
parent 008a6eb4cf
commit 0471f3369a

View file

@ -94,12 +94,21 @@ public:
{
return extra_params_;
}
bool has_name(std::string const& name) const
{
auto result = std::find_if(std::begin(descriptors_), std::end(descriptors_),
[&name](attribute_descriptor const& desc) { return name == desc.get_name();});
return result != std::end(descriptors_);
}
void order_by_name()
{
std::sort(std::begin(descriptors_), std::end(descriptors_),
[](attribute_descriptor const& d0, attribute_descriptor const& d1)
{
return d0.get_name() < d1.get_name();
});
}
private:
std::string name_;
std::string encoding_;