I am using the octave library in a C++ project.
#include <octave/oct.h>
Just now I added a header with the any_iterator implemetation from Thomas Becker
#include "any_iterator.hpp"
I just added the header and the project could not be built. Over 20 errors and over 50 warnings appeared. All in the octave headers. For example:
/usr/include/octave/lo-mappers.h:52:
error: expected unqualified-id before ‘(’ token
in code:
#if defined (HAVE_CMATH_ISNAN)
inline bool xisnan (double x)
{ return std::isnan (x); } // line 52
#else
or
/usr/include/octave/ov-base.h:580:
error: expected ‘)’ before ‘void’
in declaration:
virtual octave_value isnan (void) const;
As soon as I removed the header, the problem went away. Also in a separate project, the any_iterator works as expected. It just looks that they cannot coexist.
Any Ideas? I am completely lost. The any_iterator is even protected by namespace.
Of course it can! Why not? It could be anything, really. Just for example – open a namespace in the header and forget to close it, then include this header in your project and you are done. Compiler will go cuckoo and start throwing errors at you pointing to different places that have actually nothing to do with the error.