Boost logo

Boost :

Subject: Re: [boost] GSoC: Enforcing Code Feature Requirements
From: Joel Falcou (joel.falcou_at_[hidden])
Date: 2010-03-31 08:01:52


> Joel, maybe you can elaborate how the Concept/SFINAE approach manages with this problem.

Sure,

in my head, we can define Concepts callee ThreadSafe, ExceptionSafe etc
and just use BOOST_CONCEPT_REQUIRE on those (or the real C++0x concept
maps) and have Concept Violation error when you try to call one function
with improper settings. Then, IIRC there was planned to have SFINAE
based on concept so we cna alos have function prunning (ie nice 'no such
function f() defined' inthose case.

Using BOOST.CC, I already do that for parallel computing enforcement: i
have a type traits that I can specialize per obejct or function type
basis and the concept class just check for this concept then I write:

template<class F,class A>
BOOST_CONCEPT_REQUIRE( (CalalbleObject<F>)(DataParallel<F>)
                      , std::vector<boost::result_of<F(A)>::type>
                     )
map( F f, std::vector<A>);

if f is not a CallableObjec supporting data-parallelism (here I just
check that is_dataparallel<F>::value is true) then the function is not
permitted.

Such a mechanism can be applied to what's describe in the article, or am
I mistaken ?


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