title: Inlined c++ code in R error.expected unqualified-id before 'while'
body: <p>I receive this error when running the following code aimed at producing a quicksort function. It seems to be the first while call I make that causes the problem. Can someone tell me what I'm doing wrong?</p>
  
  <pre><code>library(Rcpp)
  library(inline)
  
  
  body_sortCpp &lt;- '
  
  NumericVector arr(x);
  int n = arr.size(); 
  double tmp;
  double left = arr[0];
  double right = arr[n-1];
  int pivot = arr[n/2];
  double i = left, j = right;
  while (i &lt;= j){
  while (arr[i] &lt;= pivot)
  i++;
  while (arr[j] &gt; pivot)
  j--;
  if (i &lt;= j) {
  tmp = arr[i];
  arr[i] = arr[j];
  arr[j] = tmp;
  i++;
  j--;
  }
  }
  
  
  if (left &lt; j){
  sortCpp(arr, left, j);
  }
  if (i &lt; right){
  sortCpp(arr, i, right);
  }
  
  return wrap( arr );
  '
  
  
  sortCpp &lt;- cxxfunction( signature( x = "numeric"),
                           body = body_sortCpp,
                           include = body_sortCpp,
                           plugin = "Rcpp")
  </code></pre>