Boost logo

Boost Users :

Subject: [Boost-users] Boost Concept Library - fusion and other libraries
From: Robert Ramey (ramey_at_[hidden])
Date: 2011-03-20 15:18:14


Lately I've been exploring boost/fusion for a project which I have been
thinking about for 25 years. I believe that this might be the tool to do
what I want. In the course of my experiments with this library and it's
associated documentation, I've been interested in understanding the
libraries "concepts" (e.g. AssociativeSequence, etc) and the relationship if
any to the boost concept library. To try to be more clear, when I see
something in the documentation like "AssociativeSequence", I'm sort of
hoping/expecting to write into my code something like

template<typename S>
struct my_type {
    ...
    BOOST_CONCEPT_ASSERT(( <AssociativeSequence<S> > ));
    ...
};

But it seems that I can't do this. Why is this?

a) Can I indeed write something like this if I include some specific headers
that I haven't found?
b) Should I be using some other concept checker such as something in MPL
c) Am I wrong about thinking that it would be useful to have this? That is,
is there some reason
why I shouldn't expect to find this?

In poking around, I don't find a lot I'm expecting to find. For example,
I'm sort of expecting to
find:

boost::std::concepts {
    ... concept checking classes for STL
}

and something similar for all or most of the libraries who make extensive
usage of "concepts"
in their documentation. When I so grep for files which contain
BOOST_CONCEPT (to catch BOOST_CONCEPT_ASSERT, etc.. I get the following:

bash-3.2$ pwd
/cygdrive/c/BoostRelease/boost
bash-3.2$ grep -l BOOST_CONCEPT * */*.hpp
concept_archetype.hpp
concept_check.hpp
concept/assert.hpp
concept/requires.hpp
concept/usage.hpp
concept_check/borland.hpp
concept_check/general.hpp
concept_check/has_constraints.hpp
concept_check/msvc.hpp
graph/bron_kerbosch_all_cliques.hpp
graph/buffer_concepts.hpp
graph/graph_concepts.hpp
graph/graphviz.hpp
graph/metric_tsp_approx.hpp
graph/stoer_wagner_min_cut.hpp
graph/tiernan_all_cycles.hpp
graph/transitive_reduction.hpp
icl/closed_interval.hpp
icl/continuous_interval.hpp
icl/discrete_interval.hpp
icl/interval_base_map.hpp
icl/left_open_interval.hpp
icl/map.hpp
icl/open_interval.hpp
icl/right_open_interval.hpp
iterator/iterator_concepts.hpp
range/concepts.hpp
bash-3.2$

which suggests to me that this idea is only implemented in graph, icl,
iterator and range libraries. Is there a reason for this, or is that it
just hasn't been done. If it's the latter, is there a reason I don't see
anyone on the requesting that libraries include concept checking classes.
Also, reviewers don't seem to mention the lack of these classes in the
code - though they complain about it if it's missing from the documentation.

After sort of struggling with the whole concept concept, I'm think I'm
coming to appreciate it's utility and maybe it's necessity. But given that
no one seems to miss it in the boost libraries, I'm concerned that I'm still
not getting it.

Robert Ramey


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net