Subject: Re: [boost] [config] request for BOOST_NO_FWD_STD_DECLARATION
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2011-02-22 08:20:14
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.
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk