title: Rcpp: rearrange a vector in an order of another vector
body: <p>I am new in Rcpp. I need to rearrange a vector <code>A</code> in an order of another vector <code>B</code>;
  For example,</p>
  
  <pre><code>A=c(0.5,0.4,0.2,0.9)
  B=c(9,1,3,5)
  </code></pre>
  
  <p>I want to make <code>C=c(0.4,0.2,0.9,0.5)</code> by Rcpp.</p>
  
  <p>I know the simple r code, <code>C=A[order(B)]</code>, but it is necessary for me to use Rcpp code.</p>
  
  <p>I found how to find the order of <code>B</code> by using <code>sort_index</code>, but I fail to arrange <code>A</code> with respect to an order of <code>B</code>.</p>
  
  <p>How can I make it?</p>