Peter Dimov wrote:
Kevin Wheatley wrote:
Subsequently, the containers now contain std::pair's to shared_ptrs, so I have even more composition going on, which for a one off 'function' is getting messy, with Lambda it should be much simpler so I'd certainly like to know if I missed something with this.
Extracting a member of a pair is equally painful with Bind and Lambda: bind(&Pair::second, _1). Lambda also supports _1->*&Pair::second for ordinary pointers, but not for shared_ptr, where you'll need something like &*_1->*&Pair::second.
Peter,
Thanks for the reply. It's all starting to look rather like Perl at
this point and as such my inbuild parser is failing to parse what that
does at a glance (can't work out what set of rules I've got to use
:-), so it might be worth avoiding just so that mortals can simply see
what is going on!
I guess if Lambda understood about smart pointers in a similar way to
Bind some of this syntax could be simplfied.
see attatched for what I'd like to do.
Kevin
--
| Kevin Wheatley, Cinesite (Europe) Ltd | Nobody thinks this |
| Senior Technology | My employer for certain |
| And Network Systems Architect | Not even myself |
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstddef>
#include