Boost logo

Boost :

Subject: Re: [boost] [config] request for BOOST_NO_FWD_STD_DECLARATION
From: Ivan Le Lann (ivan.lelann_at_[hidden])
Date: 2011-02-22 08:48:16


----- "Robert Stewart" <Robert.Stewart_at_[hidden]> a écrit :

> Ivan Le Lann wrote:
> > Le samedi 19 février 2011 à 19:37 +0100, Ion Gaztañaga a écrit :
> > > having to include a lot of std headers to declare a function
> > > with a std::string const reference as input parameter is a
> > > bit too much
> >
> > For a function declaration, even when you pass/return by value,
> > you only need to declare types.
>
> That's true unless, as is the subject of this thread, the type you
> would like to forward declare is in namespace std. Then you get into
> the world of "as if." The implementer may declare std types with
> template parameters beyond those named in the standard, provided the
> extras are defaulted so the types work as if they didn't have the
> extra template parameters. If a type does have extra template
> parameters, however, forward declaring it without them means
> mismatching the declarations while including them means requires that
> they be defaulted correctly. Unfortunately, defaults can be specified
> only once.
>
> Only std types that don't make use of defaulted template parameters
> could be forward declared and, even then, are nonportable, even among
> versions of the same standard library.
>

I think you missed my point. I was basically replying:
s/const reference//
to Ion, and no more than that.

I did not intend to fix the std forwarding problem,
as there is obviously no clean way to fix it, until <stdfwd> appears.

Ivan


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