title: Rcpparmadillo c++ create bool vector
body: <p>I'm trying to pass a vector of bool as an argument to a function using Rcpparmadillo. A silly example looks like this:</p>
  
  <pre><code>// [[Rcpp::depends(RcppArmadillo)]]
  #include &lt;RcppArmadillo.h&gt;
  
  // [[Rcpp::export]]
  arma::mat myfun(arma::mat A, arma::vec mybool)
  {
      int n = A.n_rows;
      arma::vec B(n);
  
      for(unsigned int i = 0; i &lt; n; ++i)
      {
          if(mybool.row(i) &amp;&amp; i &lt; 10) // mybool.row(i) &amp;&amp; throws the error
          {
              B.row(i) = arma::accu(A.row(i));
          }
          else
          {
              B.row(i) = pow(arma::accu(A.row(i)), 0.5);
          }
      }
  
      return B;
  }
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/18899665/armadillo-c-linear-algebra-library-how-to-create-vector-of-boolean">Here</a> a <code>mat&lt;unsigned char&gt;</code> type is suggested but doesn't work for me. I've tried <code>uvec</code> and <code>std::vector&lt;bool&gt;</code> as well but doesn't work either. What is the best way to pass a logical vector as an argument using <code>Rcpparmadillo</code>?</p>