[Insight-users] Concept checking
David Doria
daviddoria at gmail.com
Wed Jan 4 15:35:02 EST 2012
On Wed, Jan 4, 2012 at 3:23 PM, Bradley Lowekamp <blowekamp at mail.nih.gov>wrote:
> The signature of the concept is as follows:
>
> template< typename T1, typename T2 = T1, typename T3 = T1 >
> struct BracketOperator...
>
> Using grep I found this usage in ITK:
>
> itkConceptMacro( OutputPixelShouldHaveBracketOperator,
> ( Concept::BracketOperator<
> OutputPixelType,
> unsigned int,
> typename OutputPixelType::ValueType > ) );
>
>
> So it looks like you should specify more template arguments to the concept.
>
> You are correct that nameOfCheck can be any unique name for the scope the
> Concept Macro is in.
>
> Hope this helps,
> Brad
>
Thanks Brad, this does indeed work as I'd expect:
itkConceptMacro( nameOfCheck, ( itk::Concept::BracketOperator<T, unsigned
int, typename T::ValueType> ) );
However, in the documentation:
http://www.itk.org/Doxygen/html/structitk_1_1Concept_1_1BracketOperator.html it
states:
"Concept requiring T1 to have operators [] in the form T1 [] T2 = T3."
Is this supposed to read T3 = T1[T2] ?
I.e.
float = VariableLengthVector[unsigned int]
I'm confused because this also works:
itkConceptMacro( nameOfCheck, ( itk::Concept::BracketOperator<T, unsigned
int> ) );
and since the default arguments are:
template< typename T1, typename T2 = T1, typename T3 = T1 >
I would think this means:
VariableLengthVector = VariableLengthVector[unsigned int]
which is not the case. Am I misunderstanding the notation?
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120104/a94bd833/attachment.htm>
More information about the Insight-users
mailing list