Is there a GSL implementation I can use with GCC 4.9.x?

1.4k Views Asked by At

Microsoft's (Core) Guidelines Support Library implementation is said to support GCC 5.1 - but does not specify support for other versions. Higher versions seem to be ok (anyway, 5.3.1 on my Debian Stretch) - but building the tests with GCC 4.9.3 fails.

  • Has anybody else implemented the GSL?
  • Can I use MS GSL anyway, somehow?
  • If not, can I use some safe subset of it? (Probably not, I know)
  • If not, isn't it a problem that only people with newer compilers can have a guidelines support libraries? Even though their older compilers support C++11 or even C++14?
1

There are 1 best solutions below

2
On BEST ANSWER

Yes, there is one I know of: gsl-lite.

It worked fine for me so far. But I changed my compiler to a newer version and did not need it anymore.

You can also use (a rather small) subset of Microsofts implementation. If you do not need the span-classes. These are gsl_assert.h (Expects, Ensures) and gsl_utils.h (narrow, final_act, ...). I think I might have adjusted just some constexpr related things.