Skip to content

BigMatrix.h uses std::back_inserter/std::copy without including <iterator>/<algorithm> #122

Description

@pbreheny

inst/include/bigmemory/BigMatrix.h calls std::copy and std::back_inserter (in column_names() and row_names()) but only includes <string> and <vector> — it never includes <algorithm> or <iterator>. It has apparently relied on those being pulled in transitively by other headers (e.g. via boost or a downstream package's own includes).

Under newer/stricter standard library implementations (seen with clang built against a recent libc++, e.g. clang-23 as used in an R-devel CRAN test build) that transitive include is no longer guaranteed, and compilation of any downstream package including this header fails with:

BigMatrix.h:62:24: error: no member named 'back_inserter' in namespace 'std'
                  std::back_inserter(ret) );
                       ^~~~~~~~~~~~~
BigMatrix.h:75:24: error: no member named 'back_inserter' in namespace 'std'

This broke the CRAN clang-devel check for at least one downstream package (biglasso). Adding the two missing standard includes would fix it for every package that includes this header:

#include <algorithm>
#include <iterator>

alongside the existing #include <string> / #include <vector> near the top of the file. Happy to send a one-line PR if useful.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions