|
Boost Users : |
From: Nicola (nvitacolonna_at_[hidden])
Date: 2008-04-11 06:09:50
In article
<A194A82A1A084C4C8A29AD16E363B5F8FCDE36_at_WIN2003s325.its.local>,
"Patrick Loney" <Patrick.Loney_at_[hidden]> wrote:
> struct f : public std::unary_function<int, int&> {
> int operator()(int& x) { return x; } };
No, nor does
struct f : public std::unary_function<int, int> {
int operator()(int x) { return x; } };
or
struct f {
typedef int& result_type;
result_type operator()(int& x) { return x; }
};
The compiler complains upon dereferencing. But my goal is to be able to
modify the iterator's value (i.e., to write *it = value), so the return
type of the function object must be a reference. Maybe, I can use
iterator_adaptor instead of transform_iterator?
I have forgotten to mention that I am using Boost 1.34.1.
Nicola
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