Feature Request: Allow custom DenseBase plugins to use IOFormat
Submitted by Kunal Tyagi
Assigned to Kunal Tyagi
Link to original bugzilla bug (#1391)
Version: 3.5 (future version)
Description
Create plugins which enable the following behavior:
-- file a.h
#define EIGEN_DENSEBASE_PLUGIN "b.h"
-- file b.h
std::ostream& write(std::ostream& stream_) const
{
const int FullPrecision = -2; // required since it does not exist
IOFormat outFormat(FullPrecision, 0, " ", " ", "", "", " ", " ");
stream_ << this->size() << this->format(outFormat);
return stream_;
}
-- expected
No compilation errors
-- error on compilation
error: variable has incomplete type 'Eigen::IOFormat'
IOFormat outFormat(FullPrecision, 0, " ", " ", "", "", " ", " ");
^
/usr/include/eigen3/Eigen/src/Core/util/ForwardDeclarations.h:221:8: note: forward declaration of 'Eigen::IOFormat'
struct IOFormat;
-- resolution
Split IO.h file into 2 parts, one containing IOFormat, WithFormat and related files indep of DenseBase and the other dependent on DenseBase.
Move #include "src/Core/IO.h" to before #include "src/Core/DenseBase.h" and include the newly split file later (or merge it with DenseBase.h)
Should I go ahead and start working on a patch?
-- compilation details (cmake)
set (FLAGS "-std=c++14 -Wall -Wextra -Wformat=2 -Werror")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG ${FLAGS}")
set (CMAKE_BUILD_TYPE Debug) #RelWithDebInfo
-- compiler details
$ c++ -v
clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/5.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/6.0.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda