Subject: [Boost-bugs] [Boost C++ Libraries] #8729: Library Submission, working with pointer containers
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-06-25 15:02:20
#8729: Library Submission, working with pointer containers
-------------------------------------------+--------------------------
Reporter: Charlie Page <charlie.page@â¦> | Owner: dgregor
Type: Library Submissions | Status: new
Milestone: To Be Determined | Component: function
Version: Boost 1.52.0 | Severity: Optimization
Keywords: |
-------------------------------------------+--------------------------
Hey All,
I don't even know if this is the right place to submit this, but the
website seems to indicate it is.
I was reading a book which seems to suggest that working with pointers in
containers is harder then it should be. A couple of templates can make it
much easier. For instance, to work with pointers(this template assumes
that T is derived from unary_function, as std::set Compare types are, and
long typenames are there to be an example to make this more
understandable, final form could cut back:
template <typename T>
struct dereference {
typename T::result_type operator()(const typename
T::first_argument_type* arg1, const typename T::second_argument_type*
arg2) const {
return T()(*arg1, *arg2);
}
};
e.x.: std::set<string*, Dereference<std::less<string> > > myset;
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/8729> 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:13 UTC