This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch] std::string::operator[] extension in debug mode
Jonathan Wakely <cow@compsoc.man.ac.uk> writes:
| On Thu, May 19, 2005 at 07:13:27PM +0200, Gabriel Dos Reis wrote:
|
| > Douglas Gregor <doug.gregor@gmail.com> writes:
| >
| >
| > [...]
| >
| > | does the right thing. We might also want to mark operator[] with the
| > | "always_inline" attribute,
| >
| > Ahem, no.
| >
| > | so that we never get two conflicting definitions of the same code.
| >
| > If the names are properly reroutedm we should not get that confilt.
|
| For std::string we don't provide a separate __gnu_norm::basic_string and
| a __gnu_debug::basic_string, we just add some assertions to
| std::basic_string if debug mode is enabled.
|
| This means the names are identical, but the instantiation in the lib
| does not have the assertions, while the implicit instantiation in the
| user's objects has the assertions - i.e. genuine ODR.
Yup, but always_inline is not the solution.
A question I have is why conditionalizing the extern template stuff on
debug does not work.
-- Gaby