Skip to content

Compiler warning on realloc call within sparsepp. #90

@rob-p

Description

@rob-p

Hi @greg7mdp,

Thanks again for both sparsepp and parallel-hashmap! I wanted to report a (fairly verbose) compiler warning I get when using sparsepp within some of our code. Specifically, I get a a compiler trace that ends in the following warning. It looks like the root cause is using realloc on a type that is not trivially copyable. Any suggestions on how to fix this?

sparsepp/spp_utils.h:425:51: warning: 'void* realloc(void*, size_t)' moving an object of non-trivially copyable type 'struct std::pair<const std::pair<unsigned int, unsigned int>, unsigned int>'; use 'new' and 'delete' instead [-Wclass-memaccess]
  425 |         pointer res = static_cast<pointer>(realloc(p, new_size * sizeof(T)));

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