Boost.Optional error should be a warning

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Boost.Optional error should be a warning

Boost - Users mailing list
Hello,

I am using Boost.Optional, and, while I do want to "include it in an
output", the library which I am doing so has another mechanism to do
so.

Translation, for Optional purposes, the following assertion should be
a warning, IMO, and not an error:

BOOST_STATIC_ASSERT_MSG(sizeof(CharType) == 0, "If you want to output
boost::optional, include header <boost/optional/optional_io.hpp>");

Cheers,

Michael Powell
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Boost.Optional error should be a warning

Boost - Users mailing list
AMDG

On 1/14/19 12:31 PM, Michael Powell via Boost-users wrote:
> I am using Boost.Optional, and, while I do want to "include it in an
> output", the library which I am doing so has another mechanism to do
> so.
>

It doesn't matter that you have another way to handle
output.  If you get this message, it means that your
code is trying to call optional's stream operator,
for which you must #include optional_io.hpp.

> Translation, for Optional purposes, the following assertion should be
> a warning, IMO, and not an error:
>
> BOOST_STATIC_ASSERT_MSG(sizeof(CharType) == 0, "If you want to output
> boost::optional, include header <boost/optional/optional_io.hpp>");
>

In Christ,
Steven Watanabe
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Boost.Optional error should be a warning

Boost - Users mailing list
On Mon, Jan 14, 2019 at 3:08 PM Steven Watanabe via Boost-users
<[hidden email]> wrote:

>
> AMDG
>
> On 1/14/19 12:31 PM, Michael Powell via Boost-users wrote:
> > I am using Boost.Optional, and, while I do want to "include it in an
> > output", the library which I am doing so has another mechanism to do
> > so.
> >
>
> It doesn't matter that you have another way to handle
> output.  If you get this message, it means that your
> code is trying to call optional's stream operator,
> for which you must #include optional_io.hpp.

Actually, no you do not need to include it. That's the point of
providing my own String Maker to the Catch framework, in this
instance.

> > Translation, for Optional purposes, the following assertion should be
> > a warning, IMO, and not an error:
> >
> > BOOST_STATIC_ASSERT_MSG(sizeof(CharType) == 0, "If you want to output
> > boost::optional, include header <boost/optional/optional_io.hpp>");
> >
>
> In Christ,
> Steven Watanabe
> _______________________________________________
> Boost-users mailing list
> [hidden email]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Boost.Optional error should be a warning

Boost - Users mailing list
AMDG

On 1/14/19 1:10 PM, Michael Powell via Boost-users wrote:

> On Mon, Jan 14, 2019 at 3:08 PM Steven Watanabe via Boost-users
> <[hidden email]> wrote:
>>
>> On 1/14/19 12:31 PM, Michael Powell via Boost-users wrote:
>>> I am using Boost.Optional, and, while I do want to "include it in an
>>> output", the library which I am doing so has another mechanism to do
>>> so.
>>>
>>
>> It doesn't matter that you have another way to handle
>> output.  If you get this message, it means that your
>> code is trying to call optional's stream operator,
>> for which you must #include optional_io.hpp.
>
> Actually, no you do not need to include it.

I'm a bit puzzled about how you reached this
conclusion, when you are clearly getting an
error that is a result of not including it.

> That's the point of
> providing my own String Maker to the Catch framework, in this
> instance.
>

In Christ,
Steven Watanabe
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Boost.Optional error should be a warning

Boost - Users mailing list
On Mon, Jan 14, 2019 at 3:40 PM Steven Watanabe via Boost-users
<[hidden email]> wrote:

>
> AMDG
>
> On 1/14/19 1:10 PM, Michael Powell via Boost-users wrote:
> > On Mon, Jan 14, 2019 at 3:08 PM Steven Watanabe via Boost-users
> > <[hidden email]> wrote:
> >>
> >> On 1/14/19 12:31 PM, Michael Powell via Boost-users wrote:
> >>> I am using Boost.Optional, and, while I do want to "include it in an
> >>> output", the library which I am doing so has another mechanism to do
> >>> so.
> >>>
> >>
> >> It doesn't matter that you have another way to handle
> >> output.  If you get this message, it means that your
> >> code is trying to call optional's stream operator,
> >> for which you must #include optional_io.hpp.
> >
> > Actually, no you do not need to include it.
>
> I'm a bit puzzled about how you reached this
> conclusion, when you are clearly getting an
> error that is a result of not including it.
>
> > That's the point of
> > providing my own String Maker to the Catch framework, in this
> > instance.

I stand corrected; I think it's because String Maker is converting the
Optional to std::string, so the error never materializes in this case.
When I comment out the String Maker include, then the Optional stands
there facing the Catch framework for comparison, reporting (the IO
error), etc. That makes perfect sense now.

> In Christ,
> Steven Watanabe
> _______________________________________________
> Boost-users mailing list
> [hidden email]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users