Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/modules/RootConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ else()
endif()

CHECK_CXX_SOURCE_COMPILES("#include <tuple>
int main() { std::tuple<int> tup;std::apply(tup, [](int){}); return 0;}" found_stdapply)
int main() { std::apply([](int, int){}, std::make_tuple(1,2)); return 0;}" found_stdapply)
if(found_stdapply)
set(hasstdapply define)
else()
Expand Down
2 changes: 2 additions & 0 deletions core/base/v7/inc/ROOT/impl_tuple_apply.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ decltype(auto) invoke(F&& f, ArgTypes&&... args) {
}
#endif // ndef R__HAS_STD_INVOKE

#ifndef R__HAS_STD_APPLY
// From http://en.cppreference.com/w/cpp/experimental/apply
namespace detail {
template<class F, class Tuple, std::size_t... I>
Expand All @@ -82,6 +83,7 @@ constexpr decltype(auto) apply(F &&f, Tuple &&t) {
std::make_index_sequence < std::tuple_size <
std::decay_t < Tuple >> {} > {});
}
#endif // ndef R__HAS_STD_APPLY
} // namespace __ROOT
} // namespace std

Expand Down
1 change: 1 addition & 0 deletions hist/hist/v7/inc/ROOT/THistImpl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define ROOT7_THistImpl

#include <cctype>
#include <functional>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, David!

#include "ROOT/RArrayView.hxx"
#include "ROOT/RTupleApply.hxx"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,11 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
else if (!LangOpts.GNUMode && LangOpts.Digraphs)
Builder.defineMacro("__STDC_VERSION__", "199409L");
} else {
// FIXME: Use correct value for C++17.
// C++17 [cpp.predefined]p1:
// The name __cplusplus is defined to the value 201703L when compiling a
// C++ translation unit.
if (LangOpts.CPlusPlus1z)
Builder.defineMacro("__cplusplus", "201406L");
Builder.defineMacro("__cplusplus", "201703L");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to match clang value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no real need. The compiler will not care as it's not using this value. Clang 3.9 which is embedded in ROOT already supported majority of C++17 features. Changing __cplusplus to a proper value does not mean that C++17 is out experimental land. This is basically for people who use __cplusplus to figure out what C++ features they want to use.

// C++1y [cpp.predefined]p1:
// The name __cplusplus is defined to the value 201402L when compiling a
// C++ translation unit.
Expand Down
2 changes: 1 addition & 1 deletion io/io/v7/inc/ROOT/TFile.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public:

/// Write an object that is already lifetime managed by this TFileImplBase.
void Write(std::string_view name) {
auto dep = Find(name.to_string());
auto dep = Find(std::string(name.data(), name.size()));
WriteMemoryWithType(name, dep.GetPointer().get(), dep.GetType());
}

Expand Down
6 changes: 3 additions & 3 deletions io/io/v7/src/TFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class TV6Storage: public ROOT::Experimental::Internal::TFileStorageInterface {
}

void WriteMemoryWithType(std::string_view name, const void* address, TClass* cl) final {
fOldFile->WriteObjectAny(address, cl, name.to_string().c_str());
fOldFile->WriteObjectAny(address, cl, std::string(name.data(), name.size()).c_str());
}
};
}
Expand Down Expand Up @@ -144,7 +144,7 @@ OpenV6TFile(std::string_view name, const char* mode,
}
} setCacheDirRAII(opts.fCachedRead);

auto v6storage = std::make_unique<TV6Storage>(name.to_string(), GetV6TFileOpts(mode, opts));
auto v6storage = std::make_unique<TV6Storage>(std::string(name.data(), name.size()), GetV6TFileOpts(mode, opts));

using namespace ROOT::Experimental::Internal;
return std::unique_ptr<TFileStorageInterface>{std::move(v6storage)};
Expand Down Expand Up @@ -191,7 +191,7 @@ std::string ROOT::Experimental::TFile::SetCacheDir(std::string_view path) {
std::lock_guard<std::mutex> lock(GetCacheDirMutex());

std::string ret = ::TFile::GetCacheFileDir();
::TFile::SetCacheFileDir(path.to_string().c_str());
::TFile::SetCacheFileDir(std::string(path.data(), path.size()).c_str());
return ret;
}

Expand Down