add method to access attribute values by index

This commit is contained in:
Artem Pavlenko 2012-01-19 16:57:15 -05:00
parent cc9db7c7d3
commit 0a29fc6df4

View file

@ -59,6 +59,7 @@ class context : private boost::noncopyable,
{
friend class feature_impl;
public:
typedef map_type::value_type value_type;
typedef map_type::key_type key_type;
typedef map_type::size_type size_type;
@ -143,6 +144,13 @@ public:
throw std::out_of_range("Key doesn't exist");
}
value_type const& get(std::size_t index) const
{
if (index < data_.size())
return data_[index];
throw std::out_of_range("Index out of range");
}
std::size_t size() const
{
return data_.size();