Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4623: at() member function to ordered_index/hashed_index
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-09-05 18:12:13
#4623: at() member function to ordered_index/hashed_index
--------------------------------------------------------+-------------------
Reporter: Akira Takahashi <faithandbrave@â¦> | Owner: joaquin
Type: Patches | Status: new
Milestone: To Be Determined | Component: multi_index
Version: Boost 1.44.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------------------------------+-------------------
Comment (by joaquin):
Hello Akira,
ordered indices do not implement `at()` because their interface is
modelled after that of `std::set`, not `std::map`. Your proposed
implementation of an `at()` member function is ''not'' consistent
with the one `std::map` provides:
{{{
template<class Key, class T,...>
class map{
...
const T& at(const key_type& x) const;
}
}}}
Note that `std::map::at` returns a reference to '''`T`''', not
a reference to '''`value_type`''' as you're doing. Translating this
to the Boost.MultiIndex realm would imply returning a reference
to the part of `value_type` that is not the key, which in
general is not possible (it is possible in the case of
`std::map` because `value_type` is `std::par<const Key,T>` and
hence the key is nicely separated from the rest of the value).
Closing this as a non-problem.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4623#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC