Boost logo

Boost :

Subject: [boost] [multi-array] compiler errors with visual studio 2012
From: nfarnsworth_at_[hidden]
Date: 2013-03-23 09:12:24


   Hello,
   have this c++ example which compiles with Visual Studio 2010 but with Visual
   Studio 2012 I got this compiler errors:
   1>------ Build started: Project: MultiArrayDemo, Configuration: Debug Win32
   ------
   1> MultiArrayDemo.cpp
   1>d:\sandbox\multiarraydemo\multiarraydemo\multiarraydemo.cpp(11):error
   C2059: syntax error : '<'
   1> d:\sandbox\multiarraydemo\multiarraydemo\multiarraydemo.cpp(25)
   : see reference to class template instantiation 'Data<T>' being compiled
   1>d:\sandbox\multiarraydemo\multiarraydemo\multiarraydemo.cpp(11):error
   C2238: unexpected token(s) preceding ';'
   ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
   The example uses the boost 1.53 version. Here is the example code:
   #include "stdafx.h"
   #include <boost/multi_array.hpp>
   const int rows = 3;
   const int cols = 5;
   template<class T> struct Data
   {
    typedef boost::multi_array<T,2> data_type;
    typedef typename data_type::array_view<1>::type view_type; //here is the
   first error
    typedef typename data_type::index_range range;
    Data()
    :A(boost::extents[rows][cols])
    {
      double tmp[] =
   {1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0};
      A.assign(tmp,tmp+ (rows * cols));
    }
    data_type A;
   };
   int _tmain(int argc, _TCHAR* argv[])
   {

    Data<double>* data = new Data<double>();
    Data<double>::view_type myView =
   data->A[boost::indices[0][Data<double>::range()]];
    delete data;
     return 0;
   }
   Does anybody know how to solve this problem?
   Best regards and thank you in advance
   Niklas


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk