<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="word-wrap:break-word">
Hola Mark,
<div><br>
</div>
<div>I'm not clear on what your objective with this example is, but if I'm right in assuming that your trying to write a growth function that is robust to the permutations of the different arguments, then you might be better of writing a class template.  With
 a class you can overload the constructor such that a number of different combinations could be accommodated.</div>
<div><br>
</div>
<div>Steve<br>
<div><br>
</div>
<div><br>
<div>
<div>On Jul 19, 2014, at 10:18 AM, dave fournier <<a href="mailto:davef@otter-rsch.com">davef@otter-rsch.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div bgcolor="#FFFFFF" style="font-family:Helvetica; font-size:18px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">
<div class="moz-cite-prefix">On 07/14/2014 01:02 PM, Mark Maunder wrote:<br>
<br>
Hi,<br>
<br>
I think you are confusing two things here.  One is to have a single function vonB<br>
which acts on different types in the same way. In this case the code needs to depend on the types.<br>
<br>
Note that in your code it is assumed that age is a vector<br>
<br>
inline<br>
typename Growthvectortrait<T>::GrowthvectorT vonBertalanffy(const T &Linf, const T &K, const T &t0, const T1 &age)<br>
{<br>
        typedef typename Growthvectortrait<T>::GrowthvectorT vonBT;<br>
<br>
        vonBT len;<br>
        cout << "HERE" << endl;<br>
<br>
        len.allocate(age.indexmin(),age.indexmax());<br>
        len.initialize();<br>
<br>
        for(int i = len.indexmin(); i <= len.indexmax(); i++ )<br>
        {<br>
          len(i) = Linf*(1.-mfexp(-K*(age(i)-t0)));<br>
        }<br>
        return len;<br>
}<br>
<br>
I think you have to specialize for when age is a number like this.<br>
<br>
template <typename T><br>
inline<br>
dvariable vonBertalanffy(const T &Linf, const T &K, const T &t0, double &age)<br>
{<br>
<br>
  dvariable len;<br>
  cout << "HERE1" << endl;<br>
  len = Linf*(1.-mfexp(-K*(age-t0)));<br>
  return len;<br>
}<br>
<br>
The original traits examples were for doing the same thing to the passed objects on the<br>
generated code level.  So I'm not exactly sure what yoiu are trying to accomplish here.<br>
<br>
I have attached my code which compiles and runs for what its worth.<br>
<br>
     Dave<br>
<br>
</div>
<blockquote type="cite">
<div class="WordSection1" style="">
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
Hi,</div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
I am working on using traits for growth functions. Steve provided me some example code and I have been trying to extend it. This looks like it uses templates inside templates and gets confusing. Attached is some example code and I would appreciate any help
 on debugging it. I think the problem is that for the same function parameter types I have two different return types, so I made two different traits. I think it is important to get this sorted out because it may be something we will use often in creating libraries
 of functions.</div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
Thanks,</div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
Mark</div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
The selectivity<span class="Apple-converted-space"> </span><span style="">special issue of the journal Fisheries Research is now published</span></div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
<a href="http://www.sciencedirect.com/science/journal/01657836/158/supp/C" style="color:purple; text-decoration:underline"><span style="color:blue">http://www.sciencedirect.com/science/journal/01657836/158/supp/C</span></a></div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<p class="MsoNormal" style="margin:0in 0in 6pt; font-size:11pt; font-family:Calibri,sans-serif; background-color:white">
<span style="">The Stock Synthesis special issue of the journal Fisheries Research</span></p>
<p class="MsoNormal" style="margin:0in 0in 6pt; font-size:11pt; font-family:Calibri,sans-serif; background-color:white">
<span style=""><a href="http://www.sciencedirect.com/science/journal/01657836/142" style="color:purple; text-decoration:underline"><span style="color:blue">http://www.sciencedirect.com/science/journal/01657836/142</span></a></span></p>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
Mark Maunder         </div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
Head of the Stock Assessment Program                                          </div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
<span lang="ES-PE">Inter-American  Tropical Tuna Commission                                      </span></div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
<span lang="ES-TRAD">8901 La Jolla Shores Dr.</span></div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
<span lang="ES-TRAD">La Jolla, CA  92037-1508, USA</span></div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
<span lang="ES-PE">  </span></div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
Tel: (858) 546-7027</div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
Fax: (858) 546-7133</div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
<a href="mailto:mmaunder@iattc.org" style="color:purple; text-decoration:underline"><span style="color:blue">mmaunder@iattc.org</span></a></div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
<a href="http://www.fisheriesstockassessment.com/TikiWiki/tiki-index.php?page=Mark+Maunder" style="color:purple; text-decoration:underline"><span style="color:blue">http://www.fisheriesstockassessment.com/TikiWiki/tiki-index.php?page=Mark+Maunder</span></a></div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
Visit the Center for the Advancement of Population Assessment Methodology at</div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
<a href="http://www.capamresearch.org/" style="color:purple; text-decoration:underline"><span style="color:blue">http://www.capamresearch.org/</span></a></div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
Visit the AD Model Builder project at</div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
 <a href="http://admb-project.org/" style="color:purple; text-decoration:underline"><span style="color:blue">http://admb-project.org/</span></a></div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
See the following website for information on fisheries stock assessment<a href="http://www.fisheriesstockassessment.com/" style="color:purple; text-decoration:underline"><span style="color:blue">http://www.fisheriesstockassessment.com/</span></a></div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
<div style="margin:0in 0in 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif">
 </div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset><br>
<pre>_______________________________________________
Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Developers@admb-project.org" style="color:purple; text-decoration:underline">Developers@admb-project.org</a>
<a class="moz-txt-link-freetext" href="http://lists.admb-project.org/mailman/listinfo/developers" style="color:purple; text-decoration:underline">http://lists.admb-project.org/mailman/listinfo/developers</a>
</pre>
</blockquote>
<br>
<span><capam_growth.hpp></span><span><gtest.tpl></span>_______________________________________________<br>
Developers mailing list<br>
<a href="mailto:Developers@admb-project.org" style="color:purple; text-decoration:underline">Developers@admb-project.org</a><br>
<a href="http://lists.admb-project.org/mailman/listinfo/developers" style="color:purple; text-decoration:underline">http://lists.admb-project.org/mailman/listinfo/developers</a><br>
</div>
</blockquote>
</div>
<br>
</div>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
This internet e-mail message, and any files transmitted with it, contains confidential, privileged information that is intended only for the addressee. If you have received this e-mail message in error, please call us at (206) 634-1838 collect if necessary)
 and ask to speak to the message sender. Nothing in this e-mail or the act of transmitting it, is to be construed as a waiver of any rights or privileges enjoyed by the sender or the International Pacific Halibut Commission pursuant to the International Organizations
 Immunities Act, 22 U.S.C. Sec. 288 et seq.<br>
</font>
</body>
</html>