Topic: help stl gnu


Author: THIRE Frederic <thire@laforia.ibp.fr>
Date: 1996/09/13
Raw View
hi, i have a problem with stl.

here is one file "essai2.c"
---
#include <std/string.h>
#include <algo.h>
#include <vector.h>

main ()
{
  string s;
  vector<string> v;

  vector<string>::iterator i;

  i = find(v.begin(),v.end(),s);
}
----

when i make :
g++ essai2.c
this reply :
/usr/local/lib/g++-include/algo.h: In function `class
basic_string<char,string_char_traits<char> > * find(class
basic_string<char,string_char_traits<char> > *, class
basic_string<char,string_char_traits<char> > *, const class
basic_string<char,string_char_traits<char> > &)':
/usr/local/lib/g++-include/algo.h:71: call of overloaded `operator !='
is ambiguous
/usr/local/lib/g++-include/function.h:24: candidates are: operator
!=(const basic_string<char,string_char_traits<char> > &, const
basic_string<char,string_char_traits<char> > &)
/usr/local/lib/g++-include/std/bastring.h:531:                 operator
!=(const basic_string<char,string_char_traits<char> > &, const
basic_string<char,string_char_traits<char> > &)

i use g++ :
g++ -v
 gcc -v
Reading specs from
/usr/local/lib/gcc-lib/sparc-sun-sunos4.1.4/2.7.2/specs
gcc version 2.7.2


i try to permute thoses include but i can't find a solution.
if you can help me, please tell me.
If you need some information that i didn't give please tell me.

thanks a lot
fred

[ moderator's note: Normally comp.std.c++ does not allow questions like
  "Why doesn't this compile". In this case, the subject is STL and it
  is hard sometimes to tell whether the problem is due to the programmer's
  code, a changing language specification, or a compiler bug. Let's
  keep follow-ups on the subject of how STL should work, as opposed
  to compiler-specific topics. -sdc ]



[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: Jason Merrill <jason@cygnus.com>
Date: 1996/09/14
Raw View
THIRE Frederic <thire@laforia.ibp.fr> writes:

> /usr/local/lib/g++-include/algo.h:71: call of overloaded `operator !='
> is ambiguous

This is a bug in g++ 2.7.2; the compiler should recognize that the string
operator!= is more specialized than the default STL operator!=.  This bug
will be fixed in 2.8.0 and the Cygnus 96q4 release.

Jason Merrill
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]