So I was deep in the depths of my code writing an erase method for my container class when I went to call std::vector::erase
with a const_iterator
and if failed mightily. Just like it did for this person.
Following the links to gnu libstdc++ status shows that this issue has still not been fixed (the original question was early 2013).
So I coded up a horrible hack-around:
#if 1
// horrible hack for gnu libstd++ deficit
// current implementation does not allow erase(const_iterator), so recreate plain iterator
off_t::iterator itx= offsets_.begin() + ( apos.iter() - offsets_.begin() ) ;
#else
// for compliant implementations
auto itx= apos.iter() ;
#endif
But I am wondering if there is #define
I can use the relates to the version of libstdc++
. There are plenty to test for the version of the compiler, but I don't think that gcc
versions are going to be a good indicator for when this is fixed, and since clang
uses the same library by default I need to catch it either way. I took a look at the output of g++ -E -dM - < /dev/null
but the only ones that even mentioned STD
didn't seem to promising:
#define __STDC_HOSTED__ 1
#define __STDC_IEC_559__ 1
#define __STDC_ISO_10646__ 201103L
#define __STDC_NO_THREADS__ 1
#define _STDC_PREDEF_H 1
#define __STDC_IEC_559_COMPLEX__ 1
#define __STDC__ 1