|
Boost : |
Subject: Re: [boost] [Modularization][optional][functional] boost::none - what do we want it to be?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-09-30 03:55:10
On Mon, Sep 29, 2014 at 8:49 PM, Andrzej Krzemienski <akrzemi1_at_[hidden]> wrote:
> Hi Everyone,
> I know it may be premature to to think about removing every cycle in Boost,
> but while looking at the cycle reports I found that at least one library is
> using boost::none, for a purpose different than indicating an uninitialized
> boost::optional. It is in Boost.Functional:
>
> https://github.com/boostorg/functional/blob/master/include/boost/functional/factory.hpp
>
> It uses none_t as a default type for a template type parameter Allocator.
>
> My question is: what do we want boost::none_t to indicate, at least in
> Boost?
> 1. A value-semantic alternative to void, that anyone can use?
> 2. A tag indicating boost::optional<T> without a value?
>
> The answer to this question dictates how we should untie the cycle. I know
> it is too soon to care about small cycles right now, but my question is
> more about "the principles".
In my view that use of none_t is not justified. I'm not sure if it can
be safely replaced with something different to remove the dependency,
but I think it should be done, even if it means breaking some code.
There are many different placeholders for "unspecified" template
parameters, such as mpl::na_, iterators::use_default, fusion::void_,
etc. Historically, every library used its own placeholder type for
that purpose. I, for one, usually use void for that, when possible
(and I guess it should be used for all but purely type manipulation
libraries).
We could have a common "empty" placeholder type, and if we have one,
Boost.Core is probably the best place for it. But that would require
modification of the libraries that currently use their own types for
that.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk