<div dir="ltr">IIUC, from the build errors you're seeing, the compiler can't decide if it should convert `0U` (unsigned int) to an `unsigned long` or a `char*` (e.g. as a null pointer). In other words, these two overloads are competing:<div><br></div><div><pre style="margin-top:0px;margin-bottom:0px;color:rgb(0,128,0);font-size:12px;background-color:rgb(250,255,250)">   void insert (iterator p, size_t n, char c);</pre><pre style="margin-top:0px;margin-bottom:0px;color:rgb(0,128,0);font-size:12px;background-color:rgb(250,255,250)"><pre style="margin-top:0px;margin-bottom:0px">string& insert (size_t pos, size_t n, char c);</pre></pre><div><br></div><div>Most other standard library implementations have 'iterator' as a completely separate type from a plain `char*` pointer, to avoid things like this (since 0 can implicitly be converted to a pointer).</div><div><br></div><div>To work around this (on Rcpp's side) I think we could cast `0` to a `std::size_t` in each call, or else perform what is essentially a 'push_front' in a separate way.</div><div><br></div><div>Kevin<br><div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 18, 2015 at 7:02 PM, Latchezar (Lucho) Dimitrov <span dir="ltr"><<a href="mailto:ldimitro@wakehealth.edu" target="_blank">ldimitro@wakehealth.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">OK. Here it is.<br>
<br>
Hi All,<br>
<br>
Please see bellow my original e-mail to Mr. Eddelbuettel.<br>
<br>
Help anyone? I do not need necessarily a Solaris user, rather someone who knows the actual types of 0U bellow or another way to resolve the ambiguity.<br>
<br>
Thanks a lot,<br>
Latchezar<br>
<br>
"<br>
Dear Mr. Eddelbuettel,<br>
<br>
I have just built R-3.1.2 on solaris 11.2 with solaris stufio 12.4. Then starting it from the build I tried to install Rcpp. I failed due to the following compilation errors:<br>
<br>
"attributes.cpp", line 1369: Error: Overloading ambiguity between "std::string::insert(char*, unsigned long, char)" and "std::string::insert(unsigned long, unsigned long, char)".<br>
"attributes.cpp", line 1378: Error: Overloading ambiguity between "std::string::insert(char*, unsigned long, char)" and "std::string::insert(unsigned long, unsigned long, char)".<br>
<br>
The lines in the code are:<br>
<br>
                        typeText.insert(0U, 1U, *it);<br>
and<br>
                name.insert(0U, 1U, ch);<br>
<br>
Apparently I have to specify the type of 0U argument. Would you please help?<br>
<br>
Thanks a lot,<br>
<br>
Latchezar Dimitrov,<br>
Analyst/Programmer, Wake Forest Univ. School of Medicine,<br>
Winston-Salem, NC<br>
U.S.A.<br>
"<br>
<br>
<br>
<br>
<br>
-----Original Message-----<br>
From: Dirk Eddelbuettel [mailto:<a href="mailto:edd@debian.org">edd@debian.org</a>]<br>
Sent: Saturday, April 18, 2015 10:15 AM<br>
To: Latchezar (Lucho) Dimitrov<br>
Cc: <a href="mailto:edd@debian.org">edd@debian.org</a><br>
Subject: Re: Rcpp attributes.cpp issue<br>
<br>
<br>
I'd prefer the question on rcpp-devel. You may find a Solaris user there.<br>
<br>
Dirk<br>
<br>
<br>
Thank you for your email concerning Rcpp.<br>
<br>
Due to the number of emails I receive about Rcpp, I can no longer respond to each incoming email individually.  However, documentation is available via:<br>
<br>
  eight pdf "vignette" files which are included in the package, among them a<br>
  FAQ and an introduction to Rcpp<br>
<br>
  the introductory vignette is also published in the Journal of Statistical<br>
  Software (<a href="http://www.jstatsoft.org/v40/i08/" target="_blank">http://www.jstatsoft.org/v40/i08/</a>)<br>
<br>
  my book at Springer (see <a href="http://www.rcpp.org/book" target="_blank">http://www.rcpp.org/book</a>) released in June 2013<br>
<br>
  about 80 examples published in the Rcpp Gallery (<a href="http://gallery.rcpp.org" target="_blank">http://gallery.rcpp.org</a>)<br>
<br>
  numerous answers on the rcpp-devel mailing list<br>
  (<a href="http://lists.r-forge.r-project.org/mailman/listinfo/rcpp-devel" target="_blank">http://lists.r-forge.r-project.org/mailman/listinfo/rcpp-devel</a>) and you are<br>
  invited to ask on the list (but need to subscribe first)<br>
<br>
  numerous posts on the StackOverflow site under the 'rcpp' tag<br>
  (<a href="http://stackoverflow.com/questions/tagged/rcpp" target="_blank">http://stackoverflow.com/questions/tagged/rcpp</a>) and you are invited to ask<br>
  there as well (though the rcpp-devel list may still get better answers)<br>
<br>
  posts on my blog (<a href="http://dirk.eddelbuettel.com/blog" target="_blank">http://dirk.eddelbuettel.com/blog</a>)<br>
<br>
  the code archive itself at GitHub <a href="https://github.com/RcppCore/Rcpp" target="_blank">https://github.com/RcppCore/Rcpp</a> and the<br>
  package itself on CRAN (<a href="http://cran.r-project.org/web/packages/Rcpp/index.html" target="_blank">http://cran.r-project.org/web/packages/Rcpp/index.html</a>),<br>
  in particular the unitTest examples can be instructive<br>
<br>
  the over 320 packages on CRAN (and 41 more on BioConductor) using Rcpp<br>
<br>
Additionally, the introductory vignettes for RcppArmadillo and RcppEigen have now been published as well (<a href="http://dx.doi.org/10.1016/j.csda.2013.02.005" target="_blank">http://dx.doi.org/10.1016/j.csda.2013.02.005</a>;<br>
<a href="http://www.jstatsoft.org/v52/i05/" target="_blank">http://www.jstatsoft.org/v52/i05/</a>)<br>
<br>
In particular, the  rcpp-devel  mailing list is the perfect place for questions (but please register in order to post, a measure required to keep spammers away).<br>
<br>
Sincerely,  Dirk Eddelbuettel<br>
<br>
--<br>
<a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a><br>
<br>
_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
</blockquote></div><br></div></div></div></div></div>