Boost logo

Boost :

Subject: Re: [boost] Should I use std::get or boost::get (or both) in Boost.Array
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2012-12-18 17:03:07


On Dec 18, 2012, at 1:27 PM, Jeremiah Willcock <jewillco_at_[hidden]> wrote:

> On Tue, 18 Dec 2012, Marshall Clow wrote:
>
>> I've got a feature request for Boost.Array to provide compile-time checked access to the members of an array.
>>
>> In C++11, this is done using std::get<Idx> (std::array).
>> Fine, I can specialize this in Boost.Array - well, for C++11.
>> I can't specialize a nonexistent template in namespace std for C++03 (well, I _can_ but the standard says I must not).
>>
>> But Boost.Tuple has a get<> template.
>> I believe I can specialize that for Boost.Array, w/o stepping on Boost.Tuples code.
>>
>> What do people think?
>> boost::get?
>> std::get?
>>
>> Both?
>
> Boost.Graph also has functions named boost::get (without any explicit template parameters needing to be specified); that has caused trouble before. If you avoid conflicting with Boost.Variant's use of boost::get, though, you are likely to avoid Boost.Graph's uses as well. That may not be an issue if you are overloading existing implementations that already work (albeit with tuple types, not arrays), though. Please be sure your changes work in the libs/graph/test/grid_graph_cc.cpp and libs/graph/test/grid_graph_test.cpp tests; boost/graph/grid_graph.hpp already defines functions named boost::get with boost::arrays and pairs of them as parameters (but with other parameter types that do not conflict with yours).

First results:

I ran the Boost.Graph tests with three different setups:
        * gcc 4.2.1 -- all tests pass
        * Apple clang 4.1 -- all tests pass
        * Apple clang 4.1 in C++11 mode -- 11 tests fail (26 skipped). Adding/removing boost::get overloads does not change the number here.

In particular, the grid_graph_cc.cpp and grid_graph_test.cpp tests both succeeded (albeit with lots of compile-time warnings from both clang setups)

Boost.Variant tests:
        * gcc 4.2.1 -- all tests pass
        * Apple clang 4.1 -- all tests pass
        * Apple clang 4.1 in C++11 mode -- all tests pass

-- Marshall

Marshall Clow Idio Software <mailto:mclow.lists_at_[hidden]>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki


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