|
Boost : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-09-19 15:27:56
On Wed, 19 Sep 2001, Eric Ford wrote:
eford> Is there a way to have a custom concept checking class check that a
eford> class have a member function that has been templatized to take an
eford> arbitrary type?
Yes, you create a separate concept checking class just for that member
function. For example:
template <class Sequence, class Iter>
struct SequenceInsertConcept
{
void constraints() const {
s.insert(first, last);
}
Sequence s;
Iter first, last;
};
In the context of where you are applying the concept check, you will know
what the iterator type is, and will be able to pass it into the check.
function_requires< SequenceInsertConcept<MyContainer, SomeIter> >();
Cheers,
Jeremy
P.S. I'll have to add the above concept checking class to the BCCL...
----------------------------------------------------------------------
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-9761
----------------------------------------------------------------------
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk