Boost logo

Boost :

Subject: Re: [boost] [core] Determining interest for two new classes: readonly and newtype
From: Sam Kellett (samkellett_at_[hidden])
Date: 2015-08-18 18:12:04


On 18 August 2015 at 07:57, Vicente J. Botet Escriba <
vicente.botet_at_[hidden]> wrote:

> Le 18/08/15 00:31, Sam Kellett a écrit :
>
>> readonly<T>:
>>>
>>>> [snip]
>>>>
>>>
>>> How both wrappers could work together?
>

i would envision that they should be fine. as readonly is a swapper for
const i would do something like this:

readonly<std::propagate_const<std::string *>> s;

would require testing to make sure that the functionality remains though.

> -----
>>>
>>>> newtype<N, T>
>>>>
>>>> [snip]
>>>>
>>>>
>>> You could take a look at the proposal for Opaque types [1].
>> this is nice. definitely solves the same problem. do you have any idea on
>> the status of that paper? the link is 2013, but i know that doesn't mean
>> much.. is it c++17 expected or later (or ever, atm)?
>>
> See Joel response. I suspect that the last question depends on the work
> the author is able to do.
>
> Any comments about implicit/explicit conversion from/to the opaque type
> and the underlying type?
> Does your class support some of them?
>

it's explicit conversion only, either by casting or dereferencing. the
emphasis is very strict on explicitness as this aims to solve the problem
of accidentally passing, say, a height as a weight or whatever.

> [snip]
>>
>
>>
> that could be quite nice and something i would be happy to look into as
>> part of the move towards boostifying these classes, should people think
>> they have a place here.
>>
>>
> Note that you could also add them conditionally (SFINAE).
>

i'm sorry i'm not sure i follow -- could you elaborate a bit?

> Count with my help if you decide to go on.
>

thanks! i really appreciate it. do you think this should be an extension to
core/utlity? and if so what is the process for that, i know a new library
should be incubated and reviewed, but is that true for extending an
existing library too?


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