Boost logo

Boost Users :

Subject: Re: [Boost-users] ll_any_cast
From: Richard Ulrich (richi_at_[hidden])
Date: 2010-06-21 10:49:38


Sorry for the noise. I found the solution. I modified too much when
copying from ll_static_cast.

If this were added to boost, would it more likely have to live in lambda
or in any?

This one works now:

namespace boost {
      namespace lambda {
            template<class T> class any_cast_action;

            template<class T> class cast_action<any_cast_action<T> >
            {
            public:
                  template<class RET, class Arg1>
                  static RET apply(Arg1 &a1)
                  {
                        boost::any myany = a1;
                        RET retval = any_cast<RET>(a1);
                        return retval;
                  }
            };

            // any_cast
            template <class T, class Arg1>

            inline const lambda_functor<
                  lambda_functor_base<
                        action<1, cast_action<any_cast_action<T> > >,
                        tuple<typename const_copy_argument <const
Arg1>::type>
>
>

            ll_any_cast(const Arg1& a1) {
                  return
                        lambda_functor_base<
                             action<1, cast_action<any_cast_action<T> >
>,
                             tuple<typename const_copy_argument <const
Arg1>::type>
>
                        ( tuple<typename const_copy_argument <const
Arg1>::type>(a1));
            }
      } // namespace lambda
} // namespace boost


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