osrm-backend/include/util/static_assert.hpp
Siarhei Fedartsou 541d4fa1b4 wip
2024-05-24 13:47:57 +02:00

24 lines
590 B
C++

#ifndef OSRM_STATIC_ASSERT_HPP
#define OSRM_STATIC_ASSERT_HPP
#include <iterator>
#include <type_traits>
namespace osrm::util
{
template <typename It, typename Value> inline void static_assert_iter_value()
{
static_assert(std::is_same_v<std::iter_value_t<It>, Value>, "");
}
template <typename It, typename Category> inline void static_assert_iter_category()
{
using IterCategoryType = typename std::iterator_traits<It>::iterator_category;
static_assert(std::is_base_of<Category, IterCategoryType>::value, "");
}
} // namespace osrm::util
#endif // OSRM_STATIC_ASSERT_HPP