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:
Antonio Sanchez
2021-09-15 14:10:29 -07:00
parent 44da7a3b9d
commit 5dac0b53c9
10 changed files with 83 additions and 57 deletions

View File

@@ -10,6 +10,9 @@
#include "main.h"
using Eigen::placeholders::last;
using Eigen::placeholders::all;
template<typename T1,typename T2>
typename internal::enable_if<internal::is_same<T1,T2>::value,bool>::type
is_same_eq(const T1& a, const T2& b)