Skip to content

Commit ed56a35

Browse files
committed
[eve7] Include json_fwd.hpp if available
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
1 parent a927c57 commit ed56a35

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

graf3d/eve7/inc/ROOT/REveElement.hxx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,22 @@
1616
#include <ROOT/REveVector.hxx>
1717
#include <ROOT/REveProjectionBases.hxx>
1818

19-
#include <map>
2019
#include <memory>
2120
#include <list>
2221
#include <ostream>
2322
#include <set>
2423
#include <string>
25-
#include <vector>
2624

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

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

51+
#endif
52+
53+
class TGeoMatrix;
54+
4455
namespace ROOT {
4556
namespace Experimental {
4657

0 commit comments

Comments
 (0)