PROTECT SEXP in stl map

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

PROTECT SEXP in stl map

Hello All,

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

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?


[hidden email] mailing list