osrm-backend/include/util/static_assert.hpp

24 lines
585 B
C++
Raw Normal View History

2017-04-06 08:28:43 -04:00
#ifndef OSRM_STATIC_ASSERT_HPP
#define OSRM_STATIC_ASSERT_HPP
2024-05-25 12:25:13 -04:00
#include <iterator>
2017-04-06 08:28:43 -04:00
#include <type_traits>
namespace osrm::util
2017-04-06 08:28:43 -04:00
{
template <typename It, typename Value> inline void static_assert_iter_value()
{
2024-05-25 12:25:13 -04:00
static_assert(std::is_same_v<std::iter_value_t<It>, Value>, "");
2017-04-06 08:28:43 -04:00
}
template <typename It, typename Category> inline void static_assert_iter_category()
{
using IterCategoryType = typename std::iterator_traits<It>::iterator_category;
2024-05-25 12:25:13 -04:00
static_assert(std::is_base_of_v<Category, IterCategoryType>, "");
2017-04-06 08:28:43 -04:00
}
2022-12-20 12:00:11 -05:00
} // namespace osrm::util
2017-04-06 08:28:43 -04:00
#endif // OSRM_STATIC_ASSERT_HPP