|
Boost : |
From: shunsuke (pstade.mb_at_[hidden])
Date: 2007-11-22 20:35:09
Joel de Guzman wrote:
> Ok, tell you what: I understand the confusion. If you or anyone else
> can find a way to do value_at that passes the exact underlying element
> (undecorated) type, through the transform function, then, I'd gladly
> rethink this matter. Here's a possibility:
>
> struct identity
> {
> template <class FunCall>
> struct result;
>
> template <class Fun, class T>
> struct result<Fun(T&)>
> {
> typedef T& type;
> };
>
> template <class T>
> struct value
> {
> typedef T& type;
> };
>
> template <class T>
> T& operator()(T& v) const
> {
> return v;
> }
> };
I think this is not a good solution.
If we are following Boost.Iterator's way,
"value concept" should be placed in not FunctionObject but in transform_view.
Because boost::transform_iterator can't always determine
its `value_type` or `reference` from FunctionObject,
you can pass explicitly `value_type` and `reference` type to boost::transform_iterator.
Say,
template<class Seq, class F, class ResultOfDeref = use_default, class ValueOf = use_default>
struct transform_view;
seems better.
Regards,
-- Shunsuke Sogame
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk