Opened 9 years ago

Last modified 9 years ago

#8729 new Library Submissions

Library Submission, working with pointer containers

Reported by: Charlie Page <charlie.page@…> Owned by: No-Maintainer
Milestone: To Be Determined Component: functional
Version: Boost 1.52.0 Severity: Optimization
Keywords: Cc:

Description

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;

Change History (1)

comment:1 by viboes, 9 years ago

Component: functionfunctional
Owner: changed from Douglas Gregor to No-Maintainer

Moved to functional in case this request has more sens. Otherwise, please move it to None.

Note: See TracTickets for help on using tickets.