This bugzilla service is closed. All entries have been migrated to

Bug 1692

Summary: pass enumeration argument to constructor of VectorXd
Product: Eigen Reporter: Huang Qinjin <huangqinjin>
Component: Core - generalAssignee: Nobody <eigen.nobody>
Severity: Unknown CC: chtz, gael.guennebaud, jacob.benoit.1
Priority: Normal    
Version: 3.3 (current stable)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 814    

Description Huang Qinjin 2019-03-17 15:07:19 UTC
Currently, the constructor of VectorXd requires Integer by the assertion of NumTraits<T>::IsInteger to specify the length. Will it be fine to releax to any type  that convertible to int, such as a enumeration. The following code gets compilation

    enum : int {
        Size = 2,

    VectorXd V(Size);
Comment 1 Gael Guennebaud 2019-03-17 15:56:27 UTC
In the devel branch we already have internal::is_valid_index_type<T> for that purposes. It is used to detect singletons in operator(row_indices,col_indices), so we would just have to use that.
Comment 2 Gael Guennebaud 2019-03-17 21:03:40 UTC

and backported to 3.3.

Thank you for reporting.
Comment 3 Christoph Hertzberg 2019-03-18 09:50:09 UTC
The unit test does not compile in C++03 mode (due to using anonymous enums, similar to Bug 1549).
But since this was not possible before, we could just disable this test in that case.
Comment 4 Gael Guennebaud 2019-03-18 10:08:42 UTC
yes, I've seen that this morning.
Comment 5 Christoph Hertzberg 2019-03-19 14:00:50 UTC
I think this is also due to that change: smallvectors fails in C++03 mode:

Also in C++11 mode with gcc-4.8, but that might as well be an error in gcc.
Comment 6 Nobody 2019-12-04 18:33:37 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: