Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost][lambda] How to adapt container objects?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-06-22 14:52:53


AMDG

Peter Barnes wrote:
> I need to create an index using a std:vector as the sort key.
> boost::lamda and std::sort seem just the thing:
>
> <snip>
> // Container wrapper
> class Container
> {
> std::vector<int> _v;
> public:
> Container(std::vector<int> v) : _v(v) { } ;
> const int operator[](const int i) { return _v[i]; }
> };
>
> <snip>
>
> I don't understand the error message, and can't make out from the
> documentation why this doesn't work. Do I need to extend the return
> type deduction system somehow? But operator[] is not one of the
> action types.

It's other_action<subscript_action>. It ought to be documented at
http://www.boost.org/doc/html/lambda/extending.html. Will fix shortly.

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net