Skip to content

Commit

Permalink
[eve7] Include json_fwd.hpp if available
Browse files Browse the repository at this point in the history
Version 3.11 of nlohmann/json introduced "versioned, ABI-tagged inline
namespace"s, which breaks our forward declaration. Fortunately, we can
assume the json_fwd.hpp header to be present starting from that same
version because the JSON_MultipleHeaders option now defaults to ON and
even if not, json_fwd.hpp is installed since patch version 3.11.2. For
earlier versions, both methods work but json_fwd.hpp isn't guaranteed
to be installed. Still use it if available.

Fixes root-project#11130
  • Loading branch information
hahnjo committed Aug 19, 2022
1 parent a927c57 commit ed56a35
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions graf3d/eve7/inc/ROOT/REveElement.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,22 @@
#include <ROOT/REveVector.hxx>
#include <ROOT/REveProjectionBases.hxx>

#include <map>
#include <memory>
#include <list>
#include <ostream>
#include <set>
#include <string>
#include <vector>

class TGeoMatrix;
#if __has_include(<nlohmann/json_fwd.hpp>)
#include <nlohmann/json_fwd.hpp>
#else
// This forward declaration works for versions before 3.11.0, which introduced
// a "versioned, ABI-tagged inline namespace". The json_fwd.hpp header is
// present in multi-header installations (the default as of version 3.11.0), and
// single-header installations of version 3.11.2+.

#include <map>
#include <vector>

namespace nlohmann {
template<typename T, typename SFINAE>
Expand All @@ -41,6 +48,10 @@ using json = basic_json<std::map, std::vector, std::string, bool, std::int64_t,
adl_serializer, std::vector<std::uint8_t>>;
} // namespace nlohmann

#endif

class TGeoMatrix;

namespace ROOT {
namespace Experimental {

Expand Down

0 comments on commit ed56a35

Please sign in to comment.