Re: [boost] Re: functors for taking apart std::pair?

2003-07-14 Thread Beman Dawes
At 06:15 PM 7/12/2003, Aleksey Gurtovoy wrote: Brian McNamara wrote: If and when I get FC++ ( http://www.cc.gatech.edu/~yannis/fc++/ ) into Boost, FC++ has the same kind of selectors you've shown above (named fst and snd, as in Haskell). Whereas these function objects also cannot be used

Re: [boost] Re: functors for taking apart std::pair?

2003-07-13 Thread Daniel Wallin
At 22:51 2003-07-10, Marshall Clow wrote: At 7:21 AM -0400 7/10/03, David Abrahams wrote: Marshall Clow [EMAIL PROTECTED] writes: So, here they are. Are they useful to anyone else? Is there some reason that they don't already exist? Did I miss them somewhere? template class T1, class T2

Re: [boost] Re: functors for taking apart std::pair?

2003-07-12 Thread Brian McNamara
On Sat, Jul 12, 2003 at 01:21:49PM +0100, Andy Sawyer wrote: There's a third form I've also found useful on occasion: struct selector1st { templatetypename Pair const typename Pair::first_type operator()( const Pair a ) const { return a.first; } }; Which has the advantage

[boost] Re: functors for taking apart std::pair?

2003-07-12 Thread Andy Sawyer
Edward Diener writes: Andy Sawyer wrote: Marshall's first and second are slightly different to the HP versions: template class T1, class T2 struct first: std::unary_function std::pair T1, T2, T1 ... vs. templatetypename Pair struct select1st :

[boost] Re: functors for taking apart std::pair?

2003-07-11 Thread Edward Diener
Andy Sawyer wrote: From: Andy Sawyer [EMAIL PROTECTED] To: Boost mailing list [EMAIL PROTECTED] Subject: [boost] Re: functors for taking apart std::pair? Date: Thu, 10 Jul 2003 22:10:42 +0100 ED == Edward Diener [EMAIL PROTECTED] writes: Marshall Clow wrote: I recently had a need

[boost] Re: functors for taking apart std::pair?

2003-07-10 Thread David Abrahams
Marshall Clow [EMAIL PROTECTED] writes: I recently had a need for a functor to return a component of a std::pair, and I was surprised to see that they didn't exist either in the standard library or in boost. So, here they are. Are they useful to anyone else? Is there some reason that they

[boost] Re: functors for taking apart std::pair?

2003-07-10 Thread Edward Diener
Marshall Clow wrote: I recently had a need for a functor to return a component of a std::pair, and I was surprised to see that they didn't exist either in the standard library or in boost. Matt Austern lists in his excellent book Generic Programming and the STL the functors select1st and

[boost] Re: functors for taking apart std::pair?

2003-07-10 Thread Marshall Clow
At 7:21 AM -0400 7/10/03, David Abrahams wrote: Marshall Clow [EMAIL PROTECTED] writes: So, here they are. Are they useful to anyone else? Is there some reason that they don't already exist? Did I miss them somewhere? template class T1, class T2 struct first: std::unary_function std::pair

[boost] Re: functors for taking apart std::pair?

2003-07-10 Thread Ken Alverson
Marshall Clow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] So, here they are. Are they useful to anyone else? Is there some reason that they don't already exist? Did I miss them somewhere? template class T1, class T2 struct first: std::unary_function std::pair T1, T2, T1 { T1

[boost] Re: functors for taking apart std::pair?

2003-07-10 Thread Andy Sawyer
From: Andy Sawyer [EMAIL PROTECTED] To: Boost mailing list [EMAIL PROTECTED] Subject: [boost] Re: functors for taking apart std::pair? Date: Thu, 10 Jul 2003 22:10:42 +0100 ED == Edward Diener [EMAIL PROTECTED] writes: ED Marshall Clow wrote: I recently had a need for a functor to return