Boost logo

Boost Users :

Subject: [Boost-users] fusion result_of::at<Seq, N>::type doesn't return the type I expect
From: Hicham Mouline (hicham_at_[hidden])
Date: 2010-02-23 09:53:39


Hi,

This code prints double and 0 where I would expect is_same to print 1. msvc2008, boost trunk

#include <iostream>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/range_c.hpp>
#include <boost/mpl/distance.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/find.hpp>
#include <boost/fusion/include/mpl.hpp>
#include <boost/fusion/include/size.hpp>
#include <boost/fusion/include/at.hpp>
#include <boost/fusion/include/for_each.hpp>
#include <boost/fusion/include/adapt_struct.hpp>

struct p {
  double f0;
  double f1;
  double f2;
  unsigned int f3;
  unsigned int f4;
  unsigned int f5;
  unsigned int f6;
};

/// macro required to be at global namespace
BOOST_FUSION_ADAPT_STRUCT(
  p,
  (double, f0)
  (double, f1)
  (double, f2)
  (unsigned int, f3)
  (unsigned int, f4)
  (unsigned int, f5)
  (unsigned int, f6)
)

typedef boost::mpl::vector<double, unsigned int> dtt;
typedef boost::fusion::result_of::at_c<p,0>::type t0;

int main()
{
        std::cout<< typeid(t0).name() <<std::endl;
        std::cout<< boost::is_same< t0, double >::value <<std::endl;

  return 0;
}

I am certain I am missing something obvious,

rds,


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