This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Missing inlines?
----- Original Message -----
From: <Joerg.Richter@pdv-FS.de>
To: <libstdc++@gcc.gnu.org>
Sent: Wednesday, December 10, 2003 11:34 AM
Subject: Missing inlines?
> Hi,
>
> I just looked at some STL header (GCC 3.2.1) and found that there are
> sometimes some 'inline' missing.
>
> For example in my installation the file
> include/bits/stl_tree.h
>
> At line: 1164
>
> template<typename _Key, typename _Val, typename _KeyOfValue,
> typename _Compare, typename _Alloc>
> inline void
> _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::erase(iterator
> __position)
> {
>
> There is an inline
>
> But the next function
>
> template<typename _Key, typename _Val, typename _KeyOfValue,
> typename _Compare, typename _Alloc>
> typename _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::size_type
> _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::erase(const _Key&
__x)
> {
>
> Has no inline.
> I wonder if this is wanted?
Perhaps, but it isn't required for templates.
>
> I ask because I am looking for a bug which can by caused by missing
inlines.
> See http://gcc.gnu.org/ml/gcc/2003-09/msg00472.html for details.
This different. For an ordinary function it is a violation of the One
Definition Rule to define it twice. Inline and template functions may be
defined more than once, as long as the definitions are identical.
>
> I think it should be ok to add this missing inlines.
It is ok, but perhaps not required.
Bo Persson