-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevents unwieldy compilation errors
- Loading branch information
1 parent
0052014
commit 09674c3
Showing
2 changed files
with
64 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef OSRM_STATIC_ASSERT_HPP | ||
#define OSRM_STATIC_ASSERT_HPP | ||
|
||
#include <type_traits> | ||
|
||
namespace osrm | ||
{ | ||
namespace util | ||
{ | ||
|
||
template <typename It, typename Value> inline void static_assert_iter_value() | ||
{ | ||
using IterValueType = typename std::iterator_traits<It>::value_type; | ||
static_assert(std::is_same<IterValueType, Value>::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, ""); | ||
} | ||
|
||
} // ns util | ||
} // ns osrm | ||
|
||
#endif // OSRM_STATIC_ASSERT_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters