Boost logo

Boost :

From: Thomas Witt (witt_at_[hidden])
Date: 2002-02-21 07:59:39


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You may have a look at msg 25611
"Tuple extension proposal" it tries to solve your problem
in a different way.

On Thursday 21 February 2002 00:15, jkharris01 wrote:
> Should bind() be extended to include binding to member data? If it
> already allows convenient binding to member functions, wouldn't
> member data be a natural extension?
>
> The specific problem that got me thinking about this is that I
> couldn't find an easy way to make a predicate compare only
> the ".second" member of a pair, as in a map lookup by value:
>
> typedef std::map<int,float> map_t;
>
> // find the map entry whose value is 3.14
> void findpi(const map_t& themap)
> {
> std::find_if(themap.begin(), themap.end(),
> member_equal(&map_t::value_type::second, 3.14));
> }
>

This would be

     void findpi(const map_t& themap)
     {
         find(make_select_iterator<1>(themap.begin()),
              make_select_iterator<1>(themap.end()),
              3.14);
     }

Thomas

- --
Dipl.-Ing. Thomas Witt
Institut fuer Verkehrswesen, Eisenbahnbau und -betrieb, Universitaet Hannover
voice: +49(0) 511 762 - 4273, fax: +49(0) 511 762-3001
http://www.ive.uni-hannover.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8dO8/0ds/gS3XsBoRAsgJAJ0Uob+DI3znBt59+SIqdGFekKoKygCfY1Wv
1A1OTtATyHkrOL3QueZ9XOI=
=3lkt
-----END PGP SIGNATURE-----


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk