Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladiMihaylenko <vxmihaylenko@gmail.com>2018-03-05 15:05:06 +0300
committerDaria Volvenkova <d.volvenkova@corp.mail.ru>2018-03-06 12:17:41 +0300
commita0e432bf6814a1fae8e41c02e5f97ae6642385a1 (patch)
tree73ea27492b1f0b49efa1b25d41d6123aff22bcd6 /routing
parentfe4a26a2e1925003234f624b4db25deabdadee1b (diff)
Using _t suffix instead of ::type in whole project + using std:: somewhere.
Diffstat (limited to 'routing')
-rw-r--r--routing/coding.hpp12
-rw-r--r--routing/route_weight.cpp3
2 files changed, 6 insertions, 9 deletions
diff --git a/routing/coding.hpp b/routing/coding.hpp
index 7136333675..804f4f3048 100644
--- a/routing/coding.hpp
+++ b/routing/coding.hpp
@@ -72,7 +72,7 @@ void WriteGamma(BitWriter<Sink> & writer, T value)
// ModularCast makes unambiguous conversion from unsigned value to signed.
// The resulting value is the least signed integer congruent to the source integer
// (modulo 2^n where n is the number of bits used to represent the unsigned type)
-template <typename Unsigned, typename Signed = typename std::make_signed<Unsigned>::type>
+template <typename Unsigned, typename Signed = std::make_signed_t<Unsigned>>
Signed ModularCast(Unsigned value)
{
static_assert(std::is_unsigned<Unsigned>::value, "T should be an unsigned type");
@@ -85,16 +85,15 @@ Signed ModularCast(Unsigned value)
}
// Encodes current as delta compared with prev.
-template <typename T, typename UnsignedT = typename std::make_unsigned<T>::type>
+template <typename T, typename UnsignedT = std::make_unsigned_t<T>>
UnsignedT EncodeZigZagDelta(T prev, T current)
{
static_assert(std::is_integral<T>::value, "T should be an integral type");
- using SignedT = typename std::make_signed<T>::type;
auto const unsignedPrev = static_cast<UnsignedT>(prev);
auto const unsignedCurrent = static_cast<UnsignedT>(current);
auto originalDelta = ModularCast(static_cast<UnsignedT>(unsignedCurrent - unsignedPrev));
- static_assert(std::is_same<decltype(originalDelta), SignedT>::value,
+ static_assert(std::is_same<decltype(originalDelta), std::make_signed_t<T>>::value,
"It's expected that ModuleCast returns SignedT");
auto encodedDelta = bits::ZigZagEncode(originalDelta);
@@ -104,14 +103,13 @@ UnsignedT EncodeZigZagDelta(T prev, T current)
}
// Reverse function for EncodeZigZagDelta.
-template <typename T, typename UnsignedT = typename std::make_unsigned<T>::type>
+template <typename T, typename UnsignedT = std::make_unsigned_t<T>>
T DecodeZigZagDelta(T prev, UnsignedT delta)
{
static_assert(std::is_integral<T>::value, "T should be an integral type");
- using SignedT = typename std::make_signed<T>::type;
auto decoded = bits::ZigZagDecode(delta);
- static_assert(std::is_same<decltype(decoded), SignedT>::value,
+ static_assert(std::is_same<decltype(decoded), std::make_signed_t<T>>::value,
"It's expected that bits::ZigZagDecode returns SignedT");
return prev + static_cast<T>(decoded);
}
diff --git a/routing/route_weight.cpp b/routing/route_weight.cpp
index f4ade713ab..0e6e50f2c2 100644
--- a/routing/route_weight.cpp
+++ b/routing/route_weight.cpp
@@ -8,8 +8,7 @@ using namespace std;
namespace
{
-template <typename Number,
- typename EnableIf = typename enable_if<is_integral<Number>::value, void>::type>
+template <typename Number, typename EnableIf = enable_if_t<is_integral<Number>::value, void>>
bool SumWillOverflow(Number lhs, Number rhs)
{
if (lhs > 0)