[Rd] PROTECT SEXP in stl map

finle014 finle014 at umn.edu
Fri Dec 30 17:59:31 CET 2005


Hello All,

Im sure this question is basic but Im just getting started with R/c++
calls.

I would like to use an standard template library (STL) map to organize some
SEXP types in my program.  The map is map<int, SEXP> paramMap.  To insert
values into the value portion of this map I make a call to the function
getListElement (as defined on page 52 in Writing R Extensions). So the
insert looks like:

paramMap.insert(pair<int,SEXP>( some int, getListElement( some args )));

This statement is set in a for loop so that several map elements are
inserted.  On insert the return from getListElement is copied.

My question is, do I need to somehow PROTECT the SEXP value portion of this
map?  Or this this not necessary?

Thanks-
Andy



More information about the R-devel mailing list