Skip to content

Commit

Permalink
disable use of <any> on pre-mojave macos due to missing any_cast ... r…
Browse files Browse the repository at this point in the history
…esolves #134
  • Loading branch information
evaleev committed Jul 9, 2019
1 parent 9859ada commit 1cd0015
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Following is a brief summary of changes made in each release of Libint.

- 2019-xx-yy: 2.6.0-beta.6
- Ten-no Gm evaluation for m=-1,0 does not use interpolation to guarantee ~1e-14 precision
- resolved issue #134: incomplete std::any functionality in libc++ on pre 10.14 macos

- 2019-06-20: 2.6.0-beta.5
- fixed bundled boost unpacking issues in exported lib CMake build
Expand Down
23 changes: 19 additions & 4 deletions include/libint2/util/any.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,30 @@
#include <string>
#include <cassert>

// Include C++17 any header
// Include C++17 any header, if available AND functional
#if __cplusplus >= 201703L
#include <any>
// macos < 10.14 do not have any_cast in their libc++
# include <ciso646> // see https://stackoverflow.com/a/31658120
# if defined(_LIBCPP_VERSION) && defined(__APPLE__)
# include <Availability.h>
# ifdef __MAC_OS_X_VERSION_MIN_ALLOWED
# if __MAC_OS_X_VERSION_MIN_ALLOWED >= 10140
# define LIBINT_HAS_CXX17_ANY
# endif // 10.14 or later
# endif // have macos version
# else // libc++ on macos
# define LIBINT_HAS_CXX17_ANY
# endif // libc++ on macos
#endif // c++17

#ifdef LIBINT_HAS_CXX17_ANY
# include <any>
#endif

namespace libint2 {

// use C++17 std::any, if available
#if __cplusplus >= 201703L
// prefer std::any, if available
#ifdef LIBINT_HAS_CXX17_ANY
using std::any;
using std::any_cast;
using std::bad_any_cast;
Expand Down

0 comments on commit 1cd0015

Please sign in to comment.