Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2004-01-22 16:14:14


From: David Abrahams <dave_at_[hidden]>
> "Giovanni Bajo" <giovannibajo_at_[hidden]> writes:
> > Hartmut Kaiser wrote:
> >
> >> I usually use another compiler to spot the errors, returning
> >> afterwards to my production compiler - the VC7.1).
> >
> > Same here. Comeau has the best error messages by far, imo.
>
> Comeau is nasty! Try this on it, for example:
>
> # include <map>
> # include <vector>
> # include <algorithm>
> int main()
> {
> std::map<int,int> a;
> std::vector<int> v(20);
> std::copy(a.begin(), a.end(), v.begin());
> return 0;
> }

Not bad with STLFilt:

stl_algobase.h(144): error: no suitable conversion function from
  "pair<int,int>" to "vector<int>::value_type" exists
      *__result = *__first;
                  ^
          detected during:
    instantiation of "vector<int>::value_type * __copy(map<int,int>::iterator,
   map<int,int>::iterator, vector<int>::value_type *, input_iterator_tag,
   iterator_traits<map<int,int>::iterator>::difference_type *)" at line 175
    instantiation of "vector<int>::value_type * __copy_aux2(map<int,int>::iter,
   map<int,int>::iter, vector<int>::value_type *, __false_type)" at line 208
    instantiation of "vector<int>::value_type * __copy_aux(map<int,
  int>::iterator, map<int,int>::iterator, vector<int>::value_type *,
   iterator_traits<map<int,int>::iterator>::value_type *)" at line 216
    instantiation of "vector<int>::value_type * copy(map<int,int>::iter,
   map<int,int>::iter, vector<int>::value_type *)" at line 8 of "ComeauTest.c"

> or this one:
>
> # include <boost/mpl/transform.hpp>
> # include <boost/mpl/vector/vector10.hpp>
>
> namespace mpl = boost::mpl;
> using namespace mpl::placeholders;
> template <class T>
> struct returning_ptr
> {
> typedef T* (&type)();
> };
>
> typedef mpl::transform<
> mpl::vector5<int&,char,long[5],bool,double>
> , returning_ptr<_1>
> >::type func_pointers;

Couldn't try it with Comeau online.

> GCC + STLFilt is best, by far.

Now you can use STLFilt with Comeau, too.

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

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