Skip to content
Snippets Groups Projects
Commit 2954240a authored by Marco Clemencic's avatar Marco Clemencic
Browse files
parent 329eab31
No related branches found
No related tags found
1 merge request!4143Fixes for LCG 104
......@@ -20,11 +20,23 @@
#include "Kernel/STLExtensions.h"
#include "Kernel/meta_enum.h"
#include "TrackEnums.h"
#include "range/v3/range/traits.hpp"
#include <ostream>
#include <type_traits>
#include <vector>
#if __cplusplus >= 202002
# include <ranges>
namespace LHCb::Event::v2::details {
template <typename Range>
using range_value_t = std::ranges::range_value_t<Range>;
}
#else
# include "range/v3/range/traits.hpp"
namespace LHCb::Event::v2::details {
template <typename Range>
using range_value_t = ranges::range_value_t<Range>;
}
#endif
/**
*
* Track v2 is the base class for offline and online tracks.
......@@ -232,7 +244,7 @@ namespace LHCb::Event::v2 {
/// Sets the list of LHCbIDs associated to this track
template <typename Range, typename Tg,
typename = std::enable_if_t<std::is_convertible_v<LHCbID, ranges::range_value_type_t<Range>>>,
typename = std::enable_if_t<std::is_convertible_v<LHCbID, details::range_value_t<Range>>>,
typename = std::enable_if_t<std::is_base_of_v<Tag::Unordered_tag, std::decay_t<Tg>>>>
Track& setLhcbIDs( const Range& ids, Tg = Tag::Unordered ) {
m_lhcbIDs.assign( ids.begin(), ids.end() );
......
......@@ -14,13 +14,23 @@
#include <array>
#include <cassert>
#include <numeric>
#include <range/v3/view/subrange.hpp>
#include <tuple>
#include <vector>
#ifndef NDEBUG
# include <range/v3/algorithm.hpp>
# include <range/v3/version.hpp>
# include <range/v3/view.hpp>
#if __cplusplus >= 202002
# include <ranges>
namespace LHCb::Container::detail {
namespace ranges = std::ranges;
}
#else
# include <range/v3/view/subrange.hpp>
# ifndef NDEBUG
# include <range/v3/algorithm.hpp>
# include <range/v3/version.hpp>
# include <range/v3/view.hpp>
# endif
namespace LHCb::Container::detail {
namespace ranges = ::ranges;
}
#endif
namespace LHCb::Container {
......@@ -129,7 +139,7 @@ namespace LHCb::Container {
using Offsets = std::array<std::pair<offset_t, offset_t>, ( ... * sizes )>;
using Ids = std::array<size_t, ( ... * sizes )>;
using HitRange = ranges::subrange<const_iterator>;
using HitRange = detail::ranges::subrange<const_iterator>;
/**
* Constructor for a relatively empty hit container.
......@@ -287,8 +297,16 @@ namespace LHCb::Container {
bool is_sorted( const COMPARE& compare ) const {
//
// Zip the ids and hits together
auto zipped = ranges::views::zip( m_ids, m_hits );
# if __cplusplus == 202002
// workaround for https://github.com/root-project/root/issues/13001 until fixed or C++23
const std::size_t count = std::min( m_ids.size(), m_hits.size() );
std::vector<std::tuple<unsigned, const_reference>> zipped;
zipped.reserve( count );
for ( std::size_t i = 0; i < count; ++i ) { zipped.emplace_back( m_ids[i], m_hits[i] ); }
# else
auto zipped = detail::ranges::views::zip( m_ids, m_hits );
# endif
// Sorting predicate that defers hit base sorting to the compare
// function passed in
auto pred = [&compare]( const std::tuple<unsigned, Hit>& t1, const std::tuple<unsigned, Hit>& t2 ) {
......
......@@ -34,7 +34,10 @@
#include "RichUtils/RichMirrorSegPosition.h"
#include "RichUtils/RichSIMDRayTracing.h"
#include "RichUtils/RichSIMDTypes.h"
#include "RichUtils/ZipRange.h"
#ifndef __CLING__
// this is not needed in dictionaries and causes problems with https://github.com/root-project/root/issues/13001
# include "RichUtils/ZipRange.h"
#endif
// Local
#include "RichDetectors/RichBeamPipe.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment