Inline Bindings::find()

This commit is contained in:
Eelco Dolstra 2014-09-19 16:56:13 +02:00
parent 5b58991a71
commit 93e4f01ee3
2 changed files with 8 additions and 10 deletions

View file

@ -32,15 +32,6 @@
namespace nix { namespace nix {
Bindings::iterator Bindings::find(const Symbol & name)
{
Attr key(name, 0);
iterator i = std::lower_bound(begin(), end(), key);
if (i != end() && i->name == name) return i;
return end();
}
void Bindings::sort() void Bindings::sort()
{ {
std::sort(begin(), end()); std::sort(begin(), end());

View file

@ -57,7 +57,14 @@ public:
attrs[size_++] = attr; attrs[size_++] = attr;
} }
iterator find(const Symbol & name); iterator find(const Symbol & name)
{
Attr key(name, 0);
iterator i = std::lower_bound(begin(), end(), key);
if (i != end() && i->name == name) return i;
return end();
}
iterator begin() { return &attrs[0]; } iterator begin() { return &attrs[0]; }
iterator end() { return &attrs[size_]; } iterator end() { return &attrs[size_]; }