Boost logo

Boost Users :

From: Kevin Wheatley (yg-boost-users_at_[hidden])
Date: 2002-10-10 07:59:08


Hi,

I'm starting to get to grips with boost and in particular on the SGI
platform. I was trying to use the boost::tuples and found that with
the SGI compiler v7.3.1.3m I was getting the following error

CC -LANG:std -I/images/src/boost/from_cvs/boost
-I/images/src/boost/from_cvs/boost/boost/compatibility/cpp_c_headers/
-o tupple tupple.cpp

cc-1239 CC: ERROR File =
/images/src/boost/from_cvs/boost/boost/tuple/tuple_io.hpp, Line = 113
  "close" is ambiguous.

           case close : c = i.widen(')'); break;
                ^
          A template was detected during header processing.
            instantiation of "char
                     
boost::tuples::detail::format_info::get_manipulator(std::
                      basic_ios<char, std::char_traits<char>> &,
                     
boost::tuples::detail::format_info::manipulator_type)"
                      at line 437
            instantiation of "std::basic_istream<char,
std::char_traits<char>>
                     
&boost::tuples::detail::extract_and_check_delimiter(std::
                      basic_istream<char, std::char_traits<char>> &,
                     
boost::tuples::detail::format_info::manipulator_type)"
                      at line 511
            instantiation of "std::basic_istream<char,
std::char_traits<char>>
                     
&boost::tuples::operator>>(std::basic_istream<char,
                      std::char_traits<char>> &,
boost::tuples::cons<double,
                      boost::tuples::detail::map_tuple_to_cons<double,
double,
                      boost::tuples::null_type,
boost::tuples::null_type,
                      boost::tuples::null_type,
boost::tuples::null_type,
                      boost::tuples::null_type,
boost::tuples::null_type,
                      boost::tuples::null_type,
                      boost::tuples::null_type>::type> &)" at line 630
of
                      "/usr/include/CC/stl_iterator.h"
            instantiation of "void std::istream_iterator<density,
char,
                      std::char_traits<char>, ptrdiff_t>::_M_read()"
at line
                      604 of "/usr/include/CC/stl_iterator.h"
            instantiation of "std::istream_iterator<density, char,
                      std::char_traits<char>,
                     
ptrdiff_t>::istream_iterator(std::istream_iterator<densit
                      y, char, std::char_traits<char>,
                      ptrdiff_t>::istream_type &)" at line 19 of
"tupple.cpp"

I'm working with the code from CVS because it compiled better on the
SGI, I looked at the code, and basically I think it's getting confused
due to my test program including a "using namespace std;" so I
modified the tuple_io.hpp to specifically mention
detail::format_info::close rather than the bare close and then my
example works (I also made explicit the other cases of the switch
statement).

Is there a more recomended way of doing this? Almost everywhere else
in that file the full specification of the enum is given.

My code is something like:

#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <iterator>

#include "boost/tuple/tuple.hpp"
#include "boost/tuple/tuple_comparison.hpp"
#include "boost/tuple/tuple_io.hpp"

using namespace std;
using namespace boost::tuples;

typedef tuple<double, double, double> density;

int main()
{
  vector<density> v;
  istream_iterator<density> in(cin);
  istream_iterator<density> eos;
  ostream_iterator<density> out(cout);
  density total;
  copy(in, eos, back_inserter(v));
  copy(v.begin(), v.end(), out);
  cout << endl;
  return 0;
}

Thanks

Kevin

-- 
| Kevin Wheatley                   | These are the opinions of |
| Senior Do-er of Technical Things | nobody and are not shared |
| Cinesite (Europe) Ltd            | by my employers           |

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