Boost logo

Boost Users :

From: John Christopher (jcxxr_at_[hidden])
Date: 2006-05-01 19:33:02


Hello,
The example at the bottom of:
http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/fusion/sequences/views/transform_view.html
does not compile; I am using MinGw 3.4.2.

#include <iostream>
#include <boost/fusion/sequence.hpp>
#include <boost/fusion/algorithm.hpp>

using namespace boost::fusion;

struct square
{
  template <typename T>
  struct result
  {
      typedef int type;
  };

  template <typename T>
  int operator()(T x) const
  {
      return x * x;
  }
};
typedef vector<int, short, double> vector_type;

int main (int argc, char ** argv)
{
  vector_type vec(2, 5, 3.3);
  transform_view<vector_type, square> transform(vec, square());
  std::cout << transform << std::endl; //
  return 0;
}
More specifically it is the line
std::cout << transform << std::endl;
that seems to create the problem.
I was also wondering why operator() of square return int and not T.
Thanks


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