<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">The signature of the concept is as follows:<div><br></div><div><div>template< typename T1, typename T2 = T1, typename T3 = T1 ></div><div>struct BracketOperator...</div><div><br></div><div>Using grep I found this usage in ITK:</div><div><br></div><div><div> itkConceptMacro( OutputPixelShouldHaveBracketOperator,</div><div> ( Concept::BracketOperator<</div><div> OutputPixelType,</div><div> unsigned int,</div><div> typename OutputPixelType::ValueType > ) );</div></div><div><br></div><div><br></div><div>So it looks like you should specify more template arguments to the concept.</div><div><br></div><div>You are correct that nameOfCheck can be any unique name for the scope the Concept Macro is in.</div><div><br></div><div>Hope this helps,</div><div>Brad</div><div><br></div><div><br></div><div><br></div><div><div>On Jan 4, 2012, at 3:07 PM, David Doria wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>I am trying to ensure the type that my function is instantiated with has a certainly property. I tried this:</div><div><br></div><div>#include <itkConceptChecking.h></div><div>#include <itkImage.h></div><div>
#include <itkVectorImage.h></div><div><br></div><div>template <typename T></div><div>void MyFunction(const T& image)</div><div>{</div><div> // MyFunction should only accept types that have an operator[]</div>
<div> itkConceptMacro( nameOfCheck, ( itk::Concept::BracketOperator< T> ) ); // here, 'nameOfCheck can be anything, right?</div><div><br></div><div>}</div><div><br></div><div>int main(int, char*[])</div><div>{</div>
<div> itk::VariableLengthVector<float> a;</div><div> a[0] = 1;</div><div> MyFunction(a);</div><div><br></div><div> int b;</div><div>// MyFunction(b);</div><div><br></div><div> return EXIT_SUCCESS;</div><div>}</div>
<div><br></div><div>-----------</div><div><br></div><div>VariableLengthVector definitely has operator[], as shown with the assignment a[0] = 1. However, the call to MyFunction(a) produces compiler errors that say "no match for operator[]". Can anyone explain what I'm doing wrong here?</div>
<div><br></div>Thanks,<br><br>David<br>
_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.html<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></blockquote></div><br><div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 12px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">========================================================</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Bradley Lowekamp<span class="Apple-converted-space"> </span><span class="Apple-converted-space"> </span></font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Medical Science and Computing for</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Office of High Performance Computing and Communications</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">National Library of Medicine<span class="Apple-converted-space"> </span></font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; "><a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a></font></p><br class="Apple-interchange-newline"></span></div><br class="Apple-interchange-newline">
</div>
<br></div></body></html>