Boost logo

Boost :

Subject: Re: [boost] sqlpp11, 3rd iteration
From: Bjorn Reese (breese_at_[hidden])
Date: 2014-08-21 06:32:47


On 08/19/2014 02:49 PM, Roland Bock wrote:

> If I understand you correctly, you should be more happy with the current
> implementation then: As of today, depending on the compile-time
> configuration in the connector you have the following possible behaviors:
>
> You can always check for NULL by calling is_null. But if you ignore the
> outcome and try to obtain the value of a field which happens to be NULL
>
> Variant A: an exception is thrown
> Variant B: the "trivial" value is returned, 0 for numbers.
>
> The Variant is chosen at compile time.

I find it a bit worrying that this behavior is changeable at
compile-time, as it makes reviewing and reuse more challenging.

With optional<T> you will get variant A. If you want variant B, then
you use optional<T>::value_or(). This makes your intent clear in the
code.


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