// or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <algorithm>
-#include <boost/config.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/core/typeinfo.hpp>
#include <boost/histogram/detail/type_name.hpp>
#include <boost/throw_exception.hpp>
+#include <initializer_list>
#include <iostream>
#include <unordered_map>
#include <utility>
template <class... Ts>
void log(Ts&&... ts) {
if (!tracing) return;
- log_impl(std::forward<Ts>(ts)...);
+ // fold trick
+ (void)std::initializer_list<int>{(std::cerr << ts, 0)...};
std::cerr << std::endl;
}
private:
using map_t = std::unordered_map<const boost::core::typeinfo*, std::pair<int, int>>;
map_t map_;
-
- BOOST_ATTRIBUTE_UNUSED inline void log_impl() {}
-
- template <class T, class... Ts>
- void log_impl(T&& t, Ts&&... ts) {
- std::cerr << t;
- log_impl(std::forward<Ts>(ts)...);
- }
};
template <class T>