mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Move Eigen::all,last,lastp1,lastN to Eigen::placeholders::.
These names are so common, IMO they should not exist directly in the `Eigen::` namespace. This prevents us from using the `last` or `all` names for any parameters or local variables, otherwise spitting out warnings about shadowing or hiding the global values. Many external projects (and our own examples) also heavily use ``` using namespace Eigen; ``` which means these conflict with external libraries as well, e.g. `std::fill(first,last,value)`. It seems originally these were placed in a separate namespace `Eigen::placeholders`, which has since been deprecated. I propose to un-deprecate this, and restore the original locations. These symbols are also imported into `Eigen::indexing`, which additionally imports `fix` and `seq`. An alternative is to remove the `placeholders` namespace and stick with `indexing`. NOTE: this is an API-breaking change. Fixes #2321.
This commit is contained in:
@@ -36,7 +36,12 @@
|
||||
#include <vector>
|
||||
#include "main.h"
|
||||
|
||||
using Eigen::placeholders::all;
|
||||
using Eigen::placeholders::last;
|
||||
using Eigen::placeholders::lastp1;
|
||||
|
||||
#if EIGEN_HAS_CXX11
|
||||
using Eigen::placeholders::lastN;
|
||||
#include <array>
|
||||
#endif
|
||||
|
||||
@@ -220,7 +225,7 @@ void check_indexed_view()
|
||||
VERIFY( is_same_seq_type( seqN(2,fix<5>(5),fix<-2>), seqN(2,fix<5>,fix<-2>()) ) );
|
||||
|
||||
VERIFY( is_same_seq_type( seq(2,fix<5>), seqN(2,4) ) );
|
||||
#if EIGEN_HAS_CXX11
|
||||
#if EIGEN_HAS_CXX11
|
||||
VERIFY( is_same_seq_type( seq(fix<2>,fix<5>), seqN(fix<2>,fix<4>) ) );
|
||||
VERIFY( is_same_seq( seqN(2,std::integral_constant<int,5>(),std::integral_constant<int,-2>()), seqN(2,fix<5>,fix<-2>()) ) );
|
||||
VERIFY( is_same_seq( seq(std::integral_constant<int,1>(),std::integral_constant<int,5>(),std::integral_constant<int,2>()),
|
||||
|
||||
Reference in New Issue
Block a user