Boost logo

Boost Users :

Subject: Re: [Boost-users] fusion result_of::at<Seq, N>::type doesn't return the type I expect
From: er (erwann.rogard_at_[hidden])
Date: 2010-02-23 13:37:58


Hicham Mouline wrote:
> -----Original Message-----
> From: "Hicham Mouline" [hicham_at_[hidden]]
> Date: 23/02/2010 02:53 PM
> To: boost-users_at_[hidden]
> Subject: Re: fusion result_of::at<Seq, N>::type doesn't return the type I expect
>
> std::cout<< boost::is_same< t0, double >::value <<std::endl;
> I am certain I am missing something obvious,
>
> rds,
>
> -----------------
>
> I needed to compare t0 with double& and not double,
>
> rds,

Hi,

It's not that clear from your example whether you expect a ref or a
value. The doc says this : Returns a reference to the N-th element from
the beginning of the sequence seq.

Since I've recently discovered this wonderful facility that fusion adapt
  is, I wanted to make sure it wasn't returning a value for the custom
classes (fx_) that I have adapted :

typedef boost::fusion::result_of::at_key<fx_,key_>::type result_;
typedef double& expected_;
typedef boost::is_same<result_,expected_> same_;
BOOST_STATIC_ASSERT(same_::value);

Compiles fine.

Also,
typedef boost::fusion::result_of::at_key<const fx_,key_>::type result_;
typedef const double& expected_;


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