Προβλήματα επαναχρησιμοποίησης

Υποστήριξη από εργαλεία

Παράδειγμα λάθους που εμφανίζεται κατά τη μεταγλώττιση προγράμματος C++ με τη χρήση της βιβλιοθήκης STL κάτω από GNU C++ compiler:
c:\gcc\bin\..\lib\gcc-lib\i386-mingw32msvc\2.95.2\..\..\..\..\include\g++-3\stl_
iterator.h: In method `class ostream_iterator<pair<const basic_string<char,strin
g_char_traits<char>,__default_alloc_template<false,0> >,int> > & ostream_iterato
r<pair<const basic_string<char,string_char_traits<char>,__default_alloc_template
<false,0> >,int> >::operator =(const pair<const basic_string<char,string_char_tr
aits<char>,__default_alloc_template<false,0> >,int> &)':
c:\gcc\bin\..\lib\gcc-lib\i386-mingw32msvc\2.95.2\..\..\..\..\include\g++-3\stl_
algobase.h:129:   instantiated from `__copy<_Rb_tree_iterator<pair<const basic_s
tring<char,string_char_traits<char>,__default_alloc_template<false,0> >,int>,pai
r<const basic_string<char,string_char_traits<char>,__default_alloc_template<fals
e,0> >,int> &,pair<const basic_string<char,string_char_traits<char>,__default_al
loc_template<false,0> >,int> *>, ostream_iterator<pair<const basic_string<char,s
tring_char_traits<char>,__default_alloc_template<false,0> >,int> >, ptrdiff_t>(_
Rb_tree_iterator<pair<const basic_string<char,string_char_traits<char>,__default
_alloc_template<false,0> >,int>,pair<const basic_string<char,string_char_traits<
char>,__default_alloc_template<false,0> >,int> &,pair<const basic_string<char,st
ring_char_traits<char>,__default_alloc_template<false,0> >,int> *>, _Rb_tree_ite
rator<pair<const basic_string<char,string_char_traits<char>,__default_alloc_temp
late<false,0> >,int>,pair<const basic_string<char,string_char_traits<char>,__def
ault_alloc_template<false,0> >,int> &,pair<const basic_string<char,string_char_t
raits<char>,__default_alloc_template<false,0> >,int> *>, ostream_iterator<pair<c
onst basic_string<char,string_char_traits<char>,__default_alloc_template<false,0
> >,int> >, input_iterator_tag, ptrdiff_t *)'
c:\gcc\bin\..\lib\gcc-lib\i386-mingw32msvc\2.95.2\..\..\..\..\include\g++-3\stl_
algobase.h:161:   instantiated from `__copy_dispatch<_Rb_tree_iterator<pair<cons
t basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >
,int>,pair<const basic_string<char,string_char_traits<char>,__default_alloc_temp
late<false,0> >,int> &,pair<const basic_string<char,string_char_traits<char>,__d
efault_alloc_template<false,0> >,int> *>,ostream_iterator<pair<const basic_strin
g<char,string_char_traits<char>,__default_alloc_template<false,0> >,int> >,__fal
se_type>::copy(_Rb_tree_iterator<pair<const basic_string<char,string_char_traits
<char>,__default_alloc_template<false,0> >,int>,pair<const basic_string<char,str
ing_char_traits<char>,__default_alloc_template<false,0> >,int> &,pair<const basi
c_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,int>
*>, _Rb_tree_iterator<pair<const basic_string<char,string_char_traits<char>,__de
fault_alloc_template<false,0> >,int>,pair<const basic_string<char,string_char_tr
aits<char>,__default_alloc_template<false,0> >,int> &,pair<const basic_string<ch
ar,string_char_traits<char>,__default_alloc_template<false,0> >,int> *>, ostream
_iterator<pair<const basic_string<char,string_char_traits<char>,__default_alloc_
template<false,0> >,int> >)'
c:\gcc\bin\..\lib\gcc-lib\i386-mingw32msvc\2.95.2\..\..\..\..\include\g++-3\stl_
algobase.h:188:   instantiated from `copy<_Rb_tree_iterator<pair<const basic_str
ing<char,string_char_traits<char>,__default_alloc_template<false,0> >,int>,pair<
const basic_string<char,string_char_traits<char>,__default_alloc_template<false,
0> >,int> &,pair<const basic_string<char,string_char_traits<char>,__default_allo
c_template<false,0> >,int> *>, ostream_iterator<pair<const basic_string<char,str
ing_char_traits<char>,__default_alloc_template<false,0> >,int> > >(_Rb_tree_iter
ator<pair<const basic_string<char,string_char_traits<char>,__default_alloc_templ
ate<false,0> >,int>,pair<const basic_string<char,string_char_traits<char>,__defa
ult_alloc_template<false,0> >,int> &,pair<const basic_string<char,string_char_tr
aits<char>,__default_alloc_template<false,0> >,int> *>, _Rb_tree_iterator<pair<c
onst basic_string<char,string_char_traits<char>,__default_alloc_template<false,0
> >,int>,pair<const basic_string<char,string_char_traits<char>,__default_alloc_t
emplate<false,0> >,int> &,pair<const basic_string<char,string_char_traits<char>,
__default_alloc_template<false,0> >,int> *>, ostream_iterator<pair<const basic_s
tring<char,string_char_traits<char>,__default_alloc_template<false,0> >,int> >)'

t.cpp:21:   instantiated from here
c:\gcc\bin\..\lib\gcc-lib\i386-mingw32msvc\2.95.2\..\..\..\..\include\g++-3\stl_
iterator.h:890: no match for `ostream & << const pair<const basic_string<char,st
ring_char_traits<char>,__default_alloc_template<false,0> >,int> &'
c:\gcc\bin\..\lib\gcc-lib\i386-mingw32msvc\2.95.2\..\..\..\..\include\g++-3\iost
ream.h:77: candidates are: class ostream & ostream::operator <<(char)
c:\gcc\bin\..\lib\gcc-lib\i386-mingw32msvc\2.95.2\..\..\..\..\include\g++-3\iost
ream.h:78:                 class ostream & ostream::operator <<(unsigned char)
c:\gcc\bin\..\lib\gcc-lib\i386-mingw32msvc\2.95.2\..\..\..\..\include\g++-3\iost
ream.h:79:                 class ostream & ostream::operator <<(signed char)
(Ακολουθούν άλλες 10 γραμμές)

Παράδειγμα λάθους που εμφανίζεται κατά τη μεταγλώττιση προγράμματος C++ με τη χρήση της βιβλιοθήκης STL κάτω από Microsoft C/C++ compiler:

        t.cpp(24) : see reference to function template instantiation 'class std:
:basic_ostream<char,struct std::char_traits<char> > &__cdecl std::operator <<(cl
ass std::basic_ostream<char,struct std::char_traits<char> > &,const char *)' bei
ng compiled
C:\PROGRA~1\MICROS~4\VC98\INCLUDE\iterator(203) : error C2679: binary '<<' : no
operator defined which takes a right-hand operand of type 'const struct std::pai
r<class std::basic_string<char,struct std::char_traits<char>,class std::allocato
r<char> > const ,int>' (or there is no acceptable conversion)
        C:\PROGRA~1\MICROS~4\VC98\INCLUDE\iterator(203) : while compiling class-
template member function 'class std::ostream_iterator<struct std::pair<class std
::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > c
onst ,int>,char,struct std::char_traits<char> > &__thiscall std::ostream_iterato
r<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,cl
ass std::allocator<char> > const ,int>,char,struct std::char_traits<char> >::ope
rator =(const struct std::pair<class std::basic_string<char,struct std::char_tra
its<char>,class std::allocator<char> > const ,int> &)'