Boost logo

Boost :

Subject: Re: [boost] [Better Enums] More complete release - feedbackrequested
From: Anton Bachin (antonbachin_at_[hidden])
Date: 2015-06-12 10:07:21


> On Jun 12, 2015, at 05:51, Peter Dimov <lists_at_[hidden]> wrote:
>
>> Well. <iosfwd> turned out to be not so useful in a header-only library. Including it allows you to declare overloads, but not to (easily) define them, because you need various iostreams definitions and additional declarations. I did timing tests on some headers, and including anything from iostreams except <iosfwd> carried a significant penalty, well within a factor of 2 of <iostream> itself.
>>
>> I may have to move the operators to a separate file, but for now I put their definitions in enum.h, made them into templates, and hid the undefined iostreams types behind templates that depend on the overall template parameter.
>
> Streams are already templated, so artificial templating shouldn't be necessary if you use basic_istream and basic_ostream.

But the compiler is able to instantiate those eagerly if a type argument is
specified (char) that does not depend on the outer template parameter. I did a
little test, and using basic_istream<char> produces the same result as istream -
compilation error if <istream> is not included. It seems I still have to wrap
either basic_istream<char>, or just the type argument char.

Ahh, <iosfwd> :)

Regards,
Anton


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