Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-01-16 09:54:40


On Mon, 14 Jan 2002, David Abrahams wrote:
david.> johnson_all_pairs_shortest.html refers to DistanceMatrix where it should
david.> refer to DistanceMap (I think).

Nope.

david.> In any event DistanceMatrix is not defined anywhere.

Yeah, I was lazy. See below.

BTW, I don't always use the name of the concept for the name of the
template parameter. For example, the DistanceMap parameter is a
ReadWritePropertyMap. There are several reasons why I am getting away from
using the concept name as the name of the parameter:

a) what if you have multiple parameters that model the same concept
b) what if your parameter needs to model multiple concepts
c) what if multiple parameters when combined model a concept
d) what if the requirements for a parameter are more complex than
  simply stating which concept they model. For example, the DistanceMap
  has further requirements about the value_type.

The DistanceMatrix type would model something like the following
SimpleMatrixConcept, which one could concept check like this:

function_requires< SimpleMatrixConcept<DistanceMatrix> >

template <typename Matrix, typename Index, typename Value>
struct SimpleMatrixConcept
{
  void constraints()
  {
    Value& v = A[i][j];
  }
  Matrix A;
  Index i, j;
};

Cheers,
Jeremy

----------------------------------------------------------------------
 Jeremy Siek http://php.indiana.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------


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