[ConceptGCC] |
ConceptGCC :Constrained concept maps |
From: Bonderer Rolf (rolfbo_at_[hidden])
Date: 2006-07-18 14:49:42
Dear all,
I intend to write concept maps for std::Multiplicable with ublas Matrices and Vectors. As you see below, I just use a concept map to declare that a certain type is a ublas Vector (Should I rather use SameType constraints etc.?!).
Do you have an idea why the following doesn't compile:
#include <concepts>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/symmetric.hpp>
#include <boost/numeric/ublas/vector.hpp>
namespace ublas = boost::numeric::ublas;
concept UblasMatrix<typename Matrix>
{ typename value_type = Matrix::value_type; };
concept_map UblasMatrix<ublas::matrix<double> > {};
// More maps of the form "concept_map UblasMatrix<ublas::symmetric_matrix<double> > {};" will be added, once this sample compiles
concept UblasVector<typename Vector>
{ typename value_type = Vector::value_type; };
concept_map UblasVector<ublas::vector<double> > {};
namespace std {
template<UblasMatrix Matrix, UblasVector Vector>
concept_map std::Multiplicable<Matrix, Vector>
{
typedef typename ublas::matrix_vector_binary1_traits<Matrix::value_type, Matrix,
Vector::value_type, Vector>::result_type result_type;
inline result_type operator*(const Matrix& m, const Vector& v)
{
return ublas::prod(m,v);
}
}
} //namespace std
int main() {}
Thank you for your support.
Kind regards,
Rolf Bonderer