|
Boost : |
Subject: Re: [boost] Yap's formal review is starting now!
From: Peter Dimov (lists_at_[hidden])
Date: 2018-02-15 22:58:44
Zach Laine wrote:
> > Either way, that's up to the user, isn't it? If he wants to use
> > std::tuple and index with `get(expr, mp_int<0>())` or `get_c<0>(expr)`
> > instead of `get(expr, 0_c)`, let him.
>
> It could be, but that would be a much more complicated interface. As it
> is, the user need only specify an expression kind non-type template
> parameter and a Hana tuple to create a model of Expression.
The interface is not more complicated at all. The user just puts an
std::tuple where he'd have put the hana::tuple. The implementation is more
complicated. :-)
> Adding another point of customization by allowing her to specify anything
> for the tuple that models some Tuple concept is a lot to add, considering
> how simple the status quo is. I think it should be hana::tuple or
> std::tuple rather than any Tuple.
I doubt that anyone would object to that; outside of std::pair and
std::array, arbitrary TupleLike(*) types are rare and nothing supports them
properly. That said, supporting TupleLike instead of std::tuple doesn't seem
much more of an effort to me, but that's only based on intuition and cursory
look, so I may well be wrong on that one.
I just tried and Hana doesn't like any of the standard TupleLikes, not even
std::tuple. This strikes me as odd, given that everything is generic and
properly conceptified. Am I doing something wrong?
std::tuple<int> v1;
std::cout << boost::hana::length( v1 ) << std::endl;
\boost-git\develop/boost/hana/length.hpp:32:9: error: static_assert failed
"hana::length(xs) requires 'xs' to be Foldable"
static_assert(hana::Foldable<S>::value,
^ ~~~~~~~~~~~~~~~~~~~~~~~~
(*) TupleLike: has std::tuple_size<T>, std::tuple_element<T>, get<I>(t)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk