Skip to content
Merged
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
5 changes: 2 additions & 3 deletions include/util/alias.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,8 @@ template <typename ToNumeric, typename FromAlias> inline ToNumeric from_alias(co
return {static_cast<ToNumeric>(static_cast<const FromAlias::value_type>(from))};
}

template <typename ToAlias,
typename FromNumeric,
typename = std::enable_if_t<!std::is_same<ToAlias, FromNumeric>::value>>
template <typename ToAlias, typename FromNumeric>
requires(!std::is_same_v<ToAlias, FromNumeric>)
inline ToAlias to_alias(const FromNumeric &from)
{
static_assert(std::is_arithmetic<FromNumeric>::value, "Numeric needs to be an arithmetic type");
Expand Down
10 changes: 4 additions & 6 deletions include/util/filtered_integer_range.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef FILTERED_INTEGER_RANGE_HPP
#define FILTERED_INTEGER_RANGE_HPP

#include <concepts>
#include <cstddef>
#include <iterator>
#include <type_traits>

namespace osrm::util
{
Expand Down Expand Up @@ -80,11 +80,9 @@ template <typename Integer, typename Filter> class filtered_range
};

template <typename Integer, typename Filter>
filtered_range<Integer, Filter> filtered_irange(
const Integer first,
const Integer last,
const Filter &filter,
typename std::enable_if<std::is_integral<Integer>::value>::type * = nullptr) noexcept
filtered_range<Integer, Filter>
filtered_irange(const Integer first, const Integer last, const Filter &filter) noexcept
requires std::integral<Integer>
{
return filtered_range<Integer, Filter>(first, last, filter);
}
Expand Down
31 changes: 14 additions & 17 deletions include/util/indexed_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <boost/assert.hpp>

#include <array>
#include <concepts>
#include <functional>
#include <iterator>
#include <limits>
Expand Down Expand Up @@ -359,24 +360,20 @@ template <typename GroupBlockPolicy, storage::Ownership Ownership> struct Indexe
const IndexedDataImpl &index_data);

private:
template <typename Iter, typename T>
using IsValueIterator = std::enable_if_t<
std::is_same<T,
std::remove_const_t<typename std::iterator_traits<Iter>::value_type>>::value>;

template <typename T = ResultType, typename Iter, typename = IsValueIterator<Iter, ValueType>>
std::enable_if<!std::is_same<T, std::string_view>::value, T>::type adapt(const Iter first,
const Iter last) const
template <typename T = ResultType, typename Iter>
requires std::same_as<std::remove_const_t<typename std::iterator_traits<Iter>::value_type>,
ValueType>
T adapt(const Iter first, const Iter last) const
{
return ResultType(first, last);
}

template <typename T = ResultType, typename Iter, typename = IsValueIterator<Iter, ValueType>>
std::enable_if<std::is_same<T, std::string_view>::value, T>::type adapt(const Iter first,
const Iter last) const
{
auto diff = std::distance(first, last);
return diff == 0 ? ResultType() : ResultType(&*first, diff);
if constexpr (std::is_same_v<T, std::string_view>)
{
auto diff = std::distance(first, last);
return diff == 0 ? ResultType() : ResultType(&*first, diff);
}
else
{
return ResultType(first, last);
}
}

template <typename T> using Vector = util::ViewOrVector<T, Ownership>;
Expand Down
2 changes: 1 addition & 1 deletion include/util/static_rtree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,9 @@ class StaticRTree
/**
* Constructs an empty RTree for de-serialization.
*/
template <typename = std::enable_if<Ownership == storage::Ownership::Container>>
explicit StaticRTree(const std::filesystem::path &on_disk_file_name,
const Vector<Coordinate> &coordinate_list)
requires(Ownership == storage::Ownership::Container)
: m_coordinate_list(coordinate_list.data(), coordinate_list.size()),
m_objects(mmapFile<EdgeDataT>(on_disk_file_name, m_objects_region))
{
Expand Down
Loading