Thank you. I'll send you unit tests for both "as" and "const ctor".
Davor
On 2013-02-10, at 6:06 AM, Romain Francois wrote:
>
> Right. I see what you mean. If it does bot disturbe anything else, i should
> be able to bring it back.
>
> Romain
>
>
> Le 10 févr. 2013 à 04:54, Davor Cubran
Right. I see what you mean. If it does bot disturbe anything else, i should be
able to bring it back.
Romain
Le 10 févr. 2013 à 04:54, Davor Cubranic a écrit :
> On 13-02-09 05:06 AM, Dirk Eddelbuettel wrote:
>>
>> On 8 February 2013 at 20:58, Davor Cubranic wrote:
>>> That fixed just the
On 13-02-09 05:06 AM, Dirk Eddelbuettel wrote:
On 8 February 2013 at 20:58, Davor Cubranic wrote:
That fixed just the runtime fault in "as", right? Or did it somehow
also take care of ctor for const string from an element of const
CharacterVector?
>
Variants with 'const CharacterVector' still
On 8 February 2013 at 20:58, Davor Cubranic wrote:
| That fixed just the runtime fault in "as", right? Or did it somehow also take
care of ctor for const string from an element of const CharacterVector?
The former:
R> sourceCpp("/tmp/davor.cpp")
R> cv <- c("The", "quick", "brown", "fox")
R> get
That fixed just the runtime fault in "as", right? Or did it somehow also take
care of ctor for const string from an element of const CharacterVector?
Davor
On 2013-02-08, at 6:10 AM, Dirk Eddelbuettel wrote:
>
> On 8 February 2013 at 08:11, Romain Francois wrote:
> | Thanks. I will fix it.
>
On 8 February 2013 at 08:11, Romain Francois wrote:
| Thanks. I will fix it.
And proceeds to do so with a one-liner :)
Thanks for putting the fix in.
Dirk
--
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com
___
Rcpp-devel ma
Thanks. I will fix it.
Romain
Le 8 févr. 2013 à 05:28, Davor Cubranic a écrit :
> On 13-02-07 07:24 PM, Davor Cubranic wrote:
>> The version assigning an element of a const CharacterVector to a const
>> std::string (named "bar" below) compiles and works fine in Rcpp 0.9.14,
>> so the problem w
On 13-02-07 07:24 PM, Davor Cubranic wrote:
The version assigning an element of a const CharacterVector to a const
std::string (named "bar" below) compiles and works fine in Rcpp 0.9.14,
so the problem was introduced after that.
To be more precise, it was introduced after 0.10.0 and before 0.10
The version assigning an element of a const CharacterVector to a const
std::string (named "bar" below) compiles and works fine in Rcpp 0.9.14,
so the problem was introduced after that.
On the other hand, "as" (function "baz") fails as in
0.10.2, probably for the same reason Kevin identified in
Perhaps this will narrow down the 'why as seems to fail'. I'm looking at
the Rcpp 0.10.2 source. (hopefully I've got this right):
Rcpp's 'as' uses ::Rf_isString to check whether the item passed is a
string; or more specifically, a STRSXP. However, elements within a
CharacterVector seem to be of 't
I tracked this down to const-ness:
bar <- cxxfunction(signature(xs_="character"), plugin='Rcpp', body='
const CharacterVector xs(xs_);
const std::string x(xs(0));
Rcout << x << std::endl;')
fails with the compile error mentioned in my last message, while
foo <- cxxfunction(signature(xs_="charact
Davor, Kevin,
Allow to get into this intra-Vancouver exchange as I too dislike the sound of
"but this used to work"
A simple modifcation (see below) seems to do the trick:
R> sourceCpp("/tmp/davor.cpp")
R> getString(c("The", "quick", "brown", "fox"), 2)
[1] "brown"
R> getString(c("The", "
On 2013-02-07, at 10:15 AM, Kevin Ushey wrote:
> One trick to get around this is to 'as' the entire CharacterVector into a
> std::vector< std::string >, and then index based off of that.
>
> My guess is though, elements of CharacterVectors are 'const char*' s, so to
> convert them to strings yo
Hi Davor,
One trick to get around this is to 'as' the entire CharacterVector into a
std::vector< std::string >, and then index based off of that.
My guess is though, elements of CharacterVectors are 'const char*' s, so to
convert them to strings you might want to just use std::string constructor,
I have a CharacterVector from which I try to extract an element and assign it
to a std::string:
CharacterVector xs;
...
std::string x = as(xs(0));
This throws exception: "expecting a string". Why? Looking with the debugger at
"xs", this is what I see:
(gdb) print xs
$6 = (CharacterVector &) @0
15 matches
Mail list logo