This bugzilla service is closed. All entries have been migrated to
Bug 1432 - Bypass memcpy for unsuitable scalar types (aka make a better use of C++11 type-traits)
Summary: Bypass memcpy for unsuitable scalar types (aka make a better use of C++11 typ...
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: 3.3 (current stable)
Hardware: All All
: Normal Crash
Assignee: Nobody
Depends on:
Blocks: 3.3
  Show dependency treegraph
Reported: 2017-06-06 08:49 UTC by Gael Guennebaud
Modified: 2019-12-04 17:01 UTC (History)
3 users (show)


Description Gael Guennebaud 2017-06-06 08:49:33 UTC

basically some types like std::string might not be copiable by memcpy if too short. The proposed fix is to use c++11 type-traits to detect this and bypass memcpy (in Memory.h) in such cases. In c++98, we would document it a known pitfall.

In the same vein, NumTraits::RequireInitialization currently default to:

RequireInitialization = internal::is_arithmetic<T>::value ? 0 : 1

whereas c++11 provides more accurate type-traits for that.
Comment 1 Gael Guennebaud 2017-06-06 08:50:24 UTC
oops, the missing link is:
Comment 2 Gael Guennebaud 2018-07-18 21:35:33 UTC
Summary:     Bug 1432: fix conservativeResize for non-relocatable scalar types. For those we need to by-pass realloc routines and fall-back to allocate as new - copy - delete. The remaining problem is that we don't have any mechanism to accurately determine whether a type is relocatable or not, so currently let's be super conservative using either RequireInitialization or std::is_trivially_copyable
Comment 3 Nobody 2019-12-04 17:01:17 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance:

Note You need to log in before you can comment on or make changes to this bug.