Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2026-03-27 Iñaki Ucar <iucar@fedoraproject.org>

* inst/include/Rcpp/vector/ListOf.h: Fix inheritance
* inst/include/Rcpp/proxy/NamesProxy.h: Fix compatibility

2026-03-26 Dirk Eddelbuettel <edd@debian.org>

* inst/bib/Rcpp.bib: Refreshed a few more references
Expand Down
21 changes: 5 additions & 16 deletions inst/include/Rcpp/proxy/NamesProxy.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (C) 2013 Romain Francois
// Copyright (C) 2013 - 2025 Romain François
// Copyright (C) 2026 Romain François and Iñaki Ucar
//
// This file is part of Rcpp.
//
Expand Down Expand Up @@ -43,23 +44,11 @@ class NamesProxyPolicy{
CLASS& parent;

SEXP get() const {
return RCPP_GET_NAMES(parent.get__()) ;
return RCPP_GET_NAMES(parent) ;
}

void set(SEXP x) {
Shield<SEXP> safe_x(x);

/* check if we can use a fast version */
if( TYPEOF(x) == STRSXP && parent.size() == Rf_length(x) ){ // #nocov start
Rf_namesgets(parent, x);
} else {
/* use the slower and more flexible version (callback to R) */
SEXP namesSym = Rf_install( "names<-" );
Shield<SEXP> call(Rf_lang3(namesSym, parent, x));
Shield<SEXP> new_vec(Rcpp_fast_eval(call, R_GlobalEnv));
parent.set__(new_vec); // #nocov end
}

Rf_namesgets(parent, Shield<SEXP>(x));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks like a great simplification we can do now / could not do then.

}

} ;
Expand All @@ -74,7 +63,7 @@ class NamesProxyPolicy{
const CLASS& parent;

SEXP get() const {
return RCPP_GET_NAMES(parent.get__()) ;
return RCPP_GET_NAMES(parent) ;
}

} ;
Expand Down
9 changes: 5 additions & 4 deletions inst/include/Rcpp/vector/ListOf.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// ListOf.h: Rcpp R/C++ interface class library -- templated List container
//
// Copyright (C) 2014 Dirk Eddelbuettel, Romain Francois and Kevin Ushey
// Copyright (C) 2014 - 2025 Dirk Eddelbuettel, Romain François and Kevin Ushey
// Copyright (C) 2026 Dirk Eddelbuettel, Romain François, Kevin Ushey and Iñaki Ucar
//
// This file is part of Rcpp.
//
Expand All @@ -24,9 +25,9 @@ namespace Rcpp {

template <typename T>
class ListOf
: public NamesProxyPolicy<T>
, public AttributeProxyPolicy<T>
, public RObjectMethods<T>
: public NamesProxyPolicy<ListOf<T>>
, public AttributeProxyPolicy<ListOf<T>>
, public RObjectMethods<ListOf<T>>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit surprised how this suddenly becomes recursive (in the usual 'curious' manner) but does not require code changes. That seems like a free lunch. I am probably missing something.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention here was to make use of CRTP; I think I erred in leaving out the ListOf in the inheritance.

{

public:
Expand Down
Loading