Hello,

> I would however suggest a sorted   std::vector<llvm::StringRef>  for 
> AvailableFeatures. It provides a lesser memory footprint (about 16 bytes per 
> entry) and offers basically the same complexity for the interface here:   
> std::lower_bound(AvailableFeatures.begin(), AvailableFeatures.end(), Name) != 
> AvailableFeatures.end();

Is that check enough? <http://www.sgi.com/tech/stl/lower_bound.html> says:

| The first version of lower_bound returns the furthermost iterator i in 
[first, last) such that,
| for every iterator j in [first, i), *j < value.

This can also be true if *i > value. So, I think the check should be:

   iterator it = std::lower_bound(AvailableFeatures.begin(), 
AvailableFeatures.end(), Name);
   if (it != AvailableFeatures.end() && *it == Name) ...

Please correct me if I'm wrong.

Of course, since r140320 uses std::binary_search instead of std::lower_bound, 
the point is somewhat moot ;-)


Jonathan


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to