title: missing template arguments before '[' token
body: <p>I am very new in R and cpp.  These are my cpp codes with Rcpp.</p>
  
  <pre><code>#include &lt;cmath&gt;
  #include &lt;Rcpp.h&gt;
  using namespace Rcpp;
  // [[Rcpp::export]]
  
  NumericVector getPerformance(NumericVector accProfitSeries, NumericVector dateSeries, double capital, double riskFreeRate)
  {
  NumericVector retult(8);
  int Length = accProfitSeries.length();
  double strategyProfit = accProfitSeries[Length - 1];
  double returnRate = log(strategyProfit / capital);
  double tradingPeriod = (dateSeries[dateSeries.length() - 1] - dateSeries[0]) / 365;
  double returnRateYear = returnRate / tradingPeriod;
  double sharpeRatio;
  
  for (int i = 0; i &lt; 8; i++) {
      result[i] = 0;
  }
  
  NumericVector capitalLevel(Length), capitalReturn(Length);
  double meanReturn, sumReturn, stdReturn;
  double tmp;
  
  for (int i = 0; i &lt; Length; i++)
  {
  
      capitalLevel[i] = accProfitSeries[i] + capital;
  
      capitalReturn[i] = log(capitalReturn[i] / capitalReturn[0]);
  
      sumReturn = sumReturn + capitalReturn[i];
  
  }
  
  meanReturn = sumReturn / Length;
  
  
  for (int i = 0; i &lt; Length; i++)
      tmp += pow(capitalReturn[i] - meanReturn, 2);
  stdReturn = sqrt(tmp / Length);
  
  sharpeRatio = (meanReturn - riskFreeRate) / stdReturn;
  
  
  double maxCapital = 0, drawback = 0, maxDrawback = 0, maxDrawbackPercent = 0;
  int drawbackPeriod = 0, maxDrawbackPeriod = 0;
  for (int i = 0; i &lt; Length; i++)
  {
      maxCapital = max(NumericVector::create(maxCapital, capitalLevel[i]));
      drawback = capitalLevel[i] - maxCapital;
      maxDrawback = min(NumericVector::create(maxDrawback, drawback));
  
      maxDrawbackPercent = maxDrawback / (maxCapital - capital);
      if (drawback &gt;= 0)
      {
          drawbackPeriod = 0;
      }
      else
      {
          drawbackPeriod++;
          maxDrawbackPeriod = max(NumericVector::create(maxDrawbackPeriod, drawbackPeriod));
      }
  }
  result[0] = returnRate;
  result[1] = tradingPeriod;
  result[2] = returnRateYear;
  result[3] = sharpeRatio;
  result[4] = maxDrawback;
  result[5] = maxDrawbackPeriod;
  result[6] = strategyProfit;
  result[7] = maxDrawbackPercent;
  return(result);
  }
  </code></pre>
  
  <p>I got one of the error messages, others are similar:</p>
  
  <p>getPerformance.cpp:17:9: error: missing template arguments before '[' token
     result[i] = 0;</p>
  
  <p>How do I solve it?</p>