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:
-rw-r--r--base/bits.hpp8
-rw-r--r--base/buffer_vector.hpp13
-rw-r--r--base/collection_cast.hpp2
-rw-r--r--base/control_flow.hpp8
-rw-r--r--base/newtype.hpp2
-rw-r--r--base/range_iterator.hpp5
-rw-r--r--base/stl_helpers.hpp6
-rw-r--r--coding/dd_vector.hpp5
-rw-r--r--coding/huffman.cpp2
-rw-r--r--coding/huffman.hpp32
-rw-r--r--coding/streams_sink.hpp6
-rw-r--r--coding/succinct_mapper.hpp29
-rw-r--r--coding/varint.hpp6
-rw-r--r--coding/write_to_sink.hpp7
-rw-r--r--drape/attribute_buffer_mutator.hpp16
-rw-r--r--drape/drape_tests/uniform_value_tests.cpp2
-rw-r--r--drape/glsl_types.hpp5
-rw-r--r--drape/gpu_program_manager.hpp2
-rw-r--r--drape/pointers.cpp8
-rw-r--r--drape/pointers.hpp35
-rw-r--r--drape/stipple_pen_resource.cpp24
-rw-r--r--drape/stipple_pen_resource.hpp18
-rw-r--r--drape/texture_of_colors.cpp9
-rw-r--r--drape/texture_of_colors.hpp9
-rw-r--r--drape_frontend/animation/animation.cpp2
-rw-r--r--drape_frontend/animation/animation.hpp12
-rw-r--r--drape_frontend/animation/parallel_animation.hpp12
-rw-r--r--drape_frontend/animation/sequence_animation.cpp10
-rw-r--r--drape_frontend/animation/sequence_animation.hpp14
-rw-r--r--drape_frontend/animation/value_mapping.hpp4
-rw-r--r--drape_frontend/animation_system.cpp35
-rw-r--r--drape_frontend/animation_system.hpp29
-rw-r--r--drape_frontend/base_renderer.cpp26
-rw-r--r--drape_frontend/base_renderer.hpp23
-rw-r--r--drape_frontend/message_acceptor.hpp7
-rw-r--r--drape_frontend/message_queue.cpp22
-rw-r--r--drape_frontend/message_queue.hpp20
-rw-r--r--drape_frontend/threads_commutator.cpp6
-rw-r--r--drape_frontend/threads_commutator.hpp5
-rw-r--r--drape_frontend/user_event_stream.cpp16
-rw-r--r--drape_frontend/user_event_stream.hpp41
-rw-r--r--generator/intermediate_data.hpp49
-rw-r--r--generator/osm_o5m_source.hpp5
-rw-r--r--generator/osm_source.cpp2
-rw-r--r--geometry/algorithm.hpp33
-rw-r--r--indexer/cities_boundaries_serdes.hpp9
-rw-r--r--local_ads/campaign_serialization.cpp2
-rw-r--r--openlr/helpers.hpp7
-rw-r--r--routing/coding.hpp12
-rw-r--r--routing/route_weight.cpp3
-rw-r--r--search/query_params.hpp10
-rw-r--r--search/search_quality/assessment_tool/edits.hpp2
-rw-r--r--storage/country_info_getter.cpp43
-rw-r--r--storage/country_info_getter.hpp27
-rw-r--r--transit/transit_serdes.hpp56
-rw-r--r--ugc/binary/serdes.cpp6
-rw-r--r--ugc/binary/visitors.hpp13
57 files changed, 412 insertions, 410 deletions
diff --git a/base/bits.hpp b/base/bits.hpp
index 3d03c9d505..26a742a794 100644
--- a/base/bits.hpp
+++ b/base/bits.hpp
@@ -110,16 +110,18 @@ namespace bits
return (x << 1) | (x >> (sizeof(T) * 8 - 1));
}
- template <typename T> inline typename std::make_unsigned<T>::type ZigZagEncode(T x)
+ template <typename T>
+ inline std::make_unsigned_t<T> ZigZagEncode(T x)
{
static_assert(std::is_signed<T>::value, "Type should be signed");
return (x << 1) ^ (x >> (sizeof(x) * 8 - 1));
}
- template <typename T> inline typename std::make_signed<T>::type ZigZagDecode(T x)
+ template <typename T>
+ inline std::make_signed_t<T> ZigZagDecode(T x)
{
static_assert(std::is_unsigned<T>::value, "Type should be unsigned.");
- return (x >> 1) ^ -static_cast<typename std::make_signed<T>::type>(x & 1);
+ return (x >> 1) ^ -static_cast<std::make_signed_t<T>>(x & 1);
}
inline uint32_t PerfectShuffle(uint32_t x)
diff --git a/base/buffer_vector.hpp b/base/buffer_vector.hpp
index 377a1f4777..4991a74263 100644
--- a/base/buffer_vector.hpp
+++ b/base/buffer_vector.hpp
@@ -31,28 +31,25 @@ private:
/// @todo clang on linux doesn't have is_trivially_copyable.
#ifndef OMIM_OS_LINUX
template <class U = T>
- typename std::enable_if<std::is_trivially_copyable<U>::value, void>::type
- MoveStatic(buffer_vector<T, N> & rhs)
+ std::enable_if_t<std::is_trivially_copyable<U>::value, void> MoveStatic(buffer_vector<T, N> & rhs)
{
memcpy(m_static, rhs.m_static, rhs.m_size*sizeof(T));
}
template <class U = T>
- typename std::enable_if<!std::is_trivially_copyable<U>::value, void>::type
- MoveStatic(buffer_vector<T, N> & rhs)
+ std::enable_if_t<!std::is_trivially_copyable<U>::value, void> MoveStatic(
+ buffer_vector<T, N> & rhs)
{
for (size_t i = 0; i < rhs.m_size; ++i)
Swap(m_static[i], rhs.m_static[i]);
}
#else
template <class U = T>
- typename std::enable_if<std::is_pod<U>::value, void>::type
- MoveStatic(buffer_vector<T, N> & rhs)
+ std::enable_if<std::is_pod<U>::value, void> MoveStatic(buffer_vector<T, N> & rhs)
{
memcpy(m_static, rhs.m_static, rhs.m_size*sizeof(T));
}
template <class U = T>
- typename std::enable_if<!std::is_pod<U>::value, void>::type
- MoveStatic(buffer_vector<T, N> & rhs)
+ std::enable_if<!std::is_pod<U>::value, void> j MoveStatic(buffer_vector<T, N> & rhs)
{
for (size_t i = 0; i < rhs.m_size; ++i)
Swap(m_static[i], rhs.m_static[i]);
diff --git a/base/collection_cast.hpp b/base/collection_cast.hpp
index 8ba6844bbb..28caa0e34d 100644
--- a/base/collection_cast.hpp
+++ b/base/collection_cast.hpp
@@ -9,7 +9,7 @@ namespace details
template <typename T>
struct ValueType
{
- using TType = typename std::remove_reference<T>::type::value_type;
+ using TType = typename std::remove_reference_t<T>::value_type;
};
template <typename T>
diff --git a/base/control_flow.hpp b/base/control_flow.hpp
index 98e140a974..78e61985c2 100644
--- a/base/control_flow.hpp
+++ b/base/control_flow.hpp
@@ -25,17 +25,15 @@ public:
}
template <typename... Args>
- typename std::enable_if<
- std::is_same<typename std::result_of<Fn(Args...)>::type, base::ControlFlow>::value,
- base::ControlFlow>::type
+ std::enable_if_t<std::is_same<std::result_of_t<Fn(Args...)>, base::ControlFlow>::value,
+ base::ControlFlow>
operator()(Args &&... args)
{
return m_fn(std::forward<Args>(args)...);
}
template <typename... Args>
- typename std::enable_if<std::is_same<typename std::result_of<Fn(Args...)>::type, void>::value,
- base::ControlFlow>::type
+ std::enable_if_t<std::is_same<std::result_of_t<Fn(Args...)>, void>::value, base::ControlFlow>
operator()(Args &&... args)
{
m_fn(std::forward<Args>(args)...);
diff --git a/base/newtype.hpp b/base/newtype.hpp
index 5c047cbdff..644f29314e 100644
--- a/base/newtype.hpp
+++ b/base/newtype.hpp
@@ -9,7 +9,7 @@ namespace my
namespace impl
{
template <typename From, typename To>
-using IsConvertibleGuard = typename std::enable_if<std::is_convertible<From, To>::value>::type *;
+using IsConvertibleGuard = std::enable_if_t<std::is_convertible<From, To>::value> *;
} // namespace impl
/// Creates a typesafe alias to a given numeric Type.
diff --git a/base/range_iterator.hpp b/base/range_iterator.hpp
index 26e5270a98..d16fee4581 100644
--- a/base/range_iterator.hpp
+++ b/base/range_iterator.hpp
@@ -47,10 +47,9 @@ namespace my
template <typename TCounter, bool forward>
struct RangeWrapper
{
- using value_type = typename std::remove_cv<TCounter>::type;
+ using value_type = std::remove_cv_t<TCounter>;
using iterator_base = RangeIterator<value_type>;
- using iterator =
- typename std::conditional<forward, iterator_base, std::reverse_iterator<iterator_base>>::type;
+ using iterator = std::conditional_t<forward, iterator_base, std::reverse_iterator<iterator_base>>;
RangeWrapper(TCounter const from, TCounter const to):
m_begin(from),
diff --git a/base/stl_helpers.hpp b/base/stl_helpers.hpp
index 5ee22b6897..b8101231a3 100644
--- a/base/stl_helpers.hpp
+++ b/base/stl_helpers.hpp
@@ -134,9 +134,9 @@ impl::Equals<false, T, C> EqualsBy(T (C::*p)() const)
}
template <typename T>
-typename std::underlying_type<T>::type Key(T value)
+std::underlying_type_t<T> Key(T value)
{
- return static_cast<typename std::underlying_type<T>::type>(value);
+ return static_cast<std::underlying_type_t<T>>(value);
}
// Use this if you want to make a functor whose first
@@ -149,7 +149,7 @@ public:
IgnoreFirstArgument(Gn && gn) : m_fn(std::forward<Gn>(gn)) {}
template <typename Arg, typename... Args>
- typename std::result_of<Fn(Args &&...)>::type operator()(Arg && arg, Args &&... args)
+ std::result_of_t<Fn(Args &&...)> operator()(Arg && arg, Args &&... args)
{
return m_fn(std::forward<Args>(args)...);
}
diff --git a/coding/dd_vector.hpp b/coding/dd_vector.hpp
index 5e0195b599..0f65a5a24c 100644
--- a/coding/dd_vector.hpp
+++ b/coding/dd_vector.hpp
@@ -4,9 +4,10 @@
#include "base/assert.hpp"
#include "base/exception.hpp"
-#include "std/type_traits.hpp"
#include "std/iterator_facade.hpp"
+#include <type_traits>
+
// Disk-driven vector.
template <typename T, class TReader, typename TSize = uint32_t>
class DDVector
@@ -14,7 +15,7 @@ class DDVector
public:
typedef T value_type;
typedef TSize size_type;
- typedef typename make_signed<size_type>::type difference_type;
+ typedef std::make_signed_t<size_type> difference_type;
typedef TReader ReaderType;
DECLARE_EXCEPTION(OpenException, RootException);
diff --git a/coding/huffman.cpp b/coding/huffman.cpp
index aa92e8ad49..e663a2b80c 100644
--- a/coding/huffman.cpp
+++ b/coding/huffman.cpp
@@ -61,7 +61,7 @@ void HuffmanCoder::DeleteHuffmanTree(Node * root)
void HuffmanCoder::BuildHuffmanTree(Freqs const & freqs)
{
- priority_queue<Node *, vector<Node *>, NodeComparator> pq;
+ std::priority_queue<Node *, std::vector<Node *>, NodeComparator> pq;
for (auto const & e : freqs.GetTable())
pq.push(new Node(e.first, e.second, true /* isLeaf */));
diff --git a/coding/huffman.hpp b/coding/huffman.hpp
index a9356253aa..47f9a3f438 100644
--- a/coding/huffman.hpp
+++ b/coding/huffman.hpp
@@ -7,13 +7,13 @@
#include "base/checked_cast.hpp"
#include "base/string_utils.hpp"
-#include "std/algorithm.hpp"
-#include "std/iterator.hpp"
-#include "std/map.hpp"
-#include "std/queue.hpp"
-#include "std/type_traits.hpp"
-#include "std/unique_ptr.hpp"
-#include "std/vector.hpp"
+#include <algorithm>
+#include <iterator>
+#include <map>
+#include <memory>
+#include <queue>
+#include <type_traits>
+#include <vector>
namespace coding
{
@@ -23,7 +23,7 @@ public:
class Freqs
{
public:
- using Table = map<uint32_t, uint32_t>;
+ using Table = std::map<uint32_t, uint32_t>;
Freqs() = default;
@@ -35,7 +35,7 @@ public:
void Add(strings::UniString const & s) { Add(s.begin(), s.end()); }
- void Add(string const & s) { Add(s.begin(), s.end()); }
+ void Add(std::string const & s) { Add(s.begin(), s.end()); }
template <typename T>
void Add(T const * begin, T const * const end)
@@ -47,15 +47,15 @@ public:
template <typename It>
void Add(It begin, It const end)
{
- static_assert(is_integral<typename It::value_type>::value, "");
+ static_assert(std::is_integral<typename It::value_type>::value, "");
AddImpl(begin, end);
}
template <typename T>
- void Add(vector<T> const & v)
+ void Add(std::vector<T> const & v)
{
for (auto const & e : v)
- Add(begin(e), end(e));
+ Add(std::begin(e), std::end(e));
}
Table const & GetTable() const { return m_table; }
@@ -182,7 +182,7 @@ public:
}
template <typename TWriter>
- uint32_t EncodeAndWrite(TWriter & writer, string const & s) const
+ uint32_t EncodeAndWrite(TWriter & writer, std::string const & s) const
{
return EncodeAndWrite(writer, s.begin(), s.end());
}
@@ -200,7 +200,7 @@ public:
{
BitReader<TSource> bitReader(src);
size_t sz = static_cast<size_t>(ReadVarUint<uint32_t, TSource>(src));
- vector<strings::UniChar> v(sz);
+ std::vector<strings::UniChar> v(sz);
for (size_t i = 0; i < sz; ++i)
*out++ = ReadAndDecode(bitReader);
return out;
@@ -302,7 +302,7 @@ private:
void SetDepths(Node * root, uint32_t depth);
Node * m_root;
- map<Code, uint32_t> m_decoderTable;
- map<uint32_t, Code> m_encoderTable;
+ std::map<Code, uint32_t> m_decoderTable;
+ std::map<uint32_t, Code> m_encoderTable;
};
} // namespace coding
diff --git a/coding/streams_sink.hpp b/coding/streams_sink.hpp
index 0bdacc1cc1..7ec514b446 100644
--- a/coding/streams_sink.hpp
+++ b/coding/streams_sink.hpp
@@ -17,8 +17,7 @@ namespace stream
SinkReaderStream(TReader & reader) : m_reader(reader) {}
template <typename T>
- typename enable_if<is_integral<T>::value, SinkReaderStream &>::type
- operator >> (T & t)
+ enable_if_t<is_integral<T>::value, SinkReaderStream &> operator>>(T & t)
{
t = ReadPrimitiveFromSource<T>(m_reader);
return (*this);
@@ -53,8 +52,7 @@ namespace stream
SinkWriterStream(TWriter & writer) : m_writer(writer) {}
template <typename T>
- typename enable_if<is_integral<T>::value, SinkWriterStream &>::type
- operator << (T const & t)
+ enable_if_t<is_integral<T>::value, SinkWriterStream &> operator<<(T const & t)
{
WriteToSink(m_writer, t);
return (*this);
diff --git a/coding/succinct_mapper.hpp b/coding/succinct_mapper.hpp
index 7ff21d2254..c99c6a223d 100644
--- a/coding/succinct_mapper.hpp
+++ b/coding/succinct_mapper.hpp
@@ -5,7 +5,7 @@
#include "base/assert.hpp"
#include "base/macros.hpp"
-#include "std/type_traits.hpp"
+#include <type_traits>
#if defined(__clang__)
#pragma clang diagnostic push
@@ -50,16 +50,15 @@ public:
explicit MapVisitor(uint8_t const * base) : m_base(base), m_cur(m_base) {}
template <typename T>
- typename enable_if<!is_pod<T>::value, MapVisitor &>::type operator()(T & val,
- char const * /* name */)
+ std::enable_if_t<!std::is_pod<T>::value, MapVisitor &> operator()(T & val,
+ char const * /* name */)
{
val.map(*this);
return *this;
}
template <typename T>
- typename enable_if<is_pod<T>::value, MapVisitor &>::type operator()(T & val,
- char const * /* name */)
+ std::enable_if_t<std::is_pod<T>::value, MapVisitor &> operator()(T & val, char const * /* name */)
{
T const * valPtr = reinterpret_cast<T const *>(m_cur);
val = *valPtr;
@@ -94,16 +93,16 @@ public:
explicit ReverseMapVisitor(uint8_t * base) : m_base(base), m_cur(m_base) {}
template <typename T>
- typename enable_if<!is_pod<T>::value, ReverseMapVisitor &>::type operator()(
- T & val, char const * /* name */)
+ std::enable_if_t<!std::is_pod<T>::value, ReverseMapVisitor &> operator()(T & val,
+ char const * /* name */)
{
val.map(*this);
return *this;
}
template <typename T>
- typename enable_if<is_pod<T>::value, ReverseMapVisitor &>::type operator()(
- T & val, char const * /* name */)
+ std::enable_if_t<std::is_pod<T>::value, ReverseMapVisitor &> operator()(T & val,
+ char const * /* name */)
{
T * valPtr = reinterpret_cast<T *>(m_cur);
*valPtr = ReverseByteOrder(*valPtr);
@@ -145,8 +144,8 @@ public:
explicit FreezeVisitor(TWriter & writer) : m_writer(writer), m_bytesWritten(0) {}
template <typename T>
- typename enable_if<!is_pod<T>::value, FreezeVisitor &>::type operator()(T & val,
- char const * /* name */)
+ std::enable_if_t<!std::is_pod<T>::value, FreezeVisitor &> operator()(T & val,
+ char const * /* name */)
{
ASSERT(IsAlign8(m_writer.Pos()), ());
val.map(*this);
@@ -154,8 +153,8 @@ public:
}
template <typename T>
- typename enable_if<is_pod<T>::value, FreezeVisitor &>::type operator()(T & val,
- char const * /* name */)
+ std::enable_if_t<std::is_pod<T>::value, FreezeVisitor &> operator()(T & val,
+ char const * /* name */)
{
ASSERT(IsAlign8(m_writer.Pos()), ());
m_writer.Write(&val, sizeof(T));
@@ -193,7 +192,7 @@ public:
explicit ReverseFreezeVisitor(TWriter & writer) : m_writer(writer), m_bytesWritten(0) {}
template <typename T>
- typename enable_if<!is_pod<T>::value, ReverseFreezeVisitor &>::type operator()(
+ std::enable_if_t<!std::is_pod<T>::value, ReverseFreezeVisitor &> operator()(
T & val, char const * /* name */)
{
ASSERT(IsAlign8(m_writer.Pos()), ());
@@ -202,7 +201,7 @@ public:
}
template <typename T>
- typename enable_if<is_pod<T>::value, ReverseFreezeVisitor &>::type operator()(
+ std::enable_if_t<std::is_pod<T>::value, ReverseFreezeVisitor &> operator()(
T & val, char const * /* name */)
{
ASSERT(IsAlign8(m_writer.Pos()), ());
diff --git a/coding/varint.hpp b/coding/varint.hpp
index a22b77e703..fe0090436f 100644
--- a/coding/varint.hpp
+++ b/coding/varint.hpp
@@ -8,9 +8,7 @@
#include "base/exception.hpp"
#include "base/stl_add.hpp"
-#include "std/string.hpp"
-#include "std/type_traits.hpp"
-
+#include <type_traits>
/// This function writes, using optimal bytes count.
/// Pass any integral type and it will write platform-independent.
@@ -176,7 +174,7 @@ template <typename T, typename TSink> void WriteVarInt(TSink & dst, T value)
template <typename T, typename TSource> T ReadVarInt(TSource & src)
{
static_assert(is_signed<T>::value, "");
- return bits::ZigZagDecode(ReadVarUint<typename make_unsigned<T>::type>(src));
+ return bits::ZigZagDecode(ReadVarUint<std::make_unsigned_t<T>>(src));
}
DECLARE_EXCEPTION(ReadVarIntException, RootException);
diff --git a/coding/write_to_sink.hpp b/coding/write_to_sink.hpp
index 9ae0ab0750..2943f03255 100644
--- a/coding/write_to_sink.hpp
+++ b/coding/write_to_sink.hpp
@@ -2,12 +2,11 @@
#include "coding/endianness.hpp"
-#include "std/type_traits.hpp"
-
+#include <type_traits>
template <class TSink, typename T>
-typename enable_if<is_integral<T>::value || is_enum<T>::value, void>::type
-WriteToSink(TSink & sink, T const & v)
+std::enable_if_t<std::is_integral<T>::value || std::is_enum<T>::value, void> WriteToSink(
+ TSink & sink, T const & v)
{
T const t = SwapIfBigEndian(v);
sink.Write(&t, sizeof(T));
diff --git a/drape/attribute_buffer_mutator.hpp b/drape/attribute_buffer_mutator.hpp
index a215e64c7f..330ec616a4 100644
--- a/drape/attribute_buffer_mutator.hpp
+++ b/drape/attribute_buffer_mutator.hpp
@@ -5,9 +5,10 @@
#include "base/shared_buffer_manager.hpp"
-#include "std/cstdint.hpp"
-#include "std/map.hpp"
-#include "std/vector.hpp"
+#include <cstdint>
+#include <map>
+#include <utility>
+#include <vector>
namespace dp
{
@@ -29,10 +30,11 @@ struct MutateNode
class AttributeBufferMutator
{
- typedef pair<SharedBufferManager::shared_buffer_ptr_t, size_t> TBufferNode;
- typedef vector<TBufferNode> TBufferArray;
- typedef vector<MutateNode> TMutateNodes;
- typedef map<BindingInfo, TMutateNodes> TMutateData;
+ typedef std::pair<SharedBufferManager::shared_buffer_ptr_t, size_t> TBufferNode;
+ typedef std::vector<TBufferNode> TBufferArray;
+ typedef std::vector<MutateNode> TMutateNodes;
+ typedef std::map<BindingInfo, TMutateNodes> TMutateData;
+
public:
~AttributeBufferMutator();
void AddMutation(BindingInfo const & info, MutateNode const & node);
diff --git a/drape/drape_tests/uniform_value_tests.cpp b/drape/drape_tests/uniform_value_tests.cpp
index 3a100fe9cb..4d24c86681 100644
--- a/drape/drape_tests/uniform_value_tests.cpp
+++ b/drape/drape_tests/uniform_value_tests.cpp
@@ -9,6 +9,7 @@
#include <cstring>
#include <string>
+#include <utility>
#include <gmock/gmock.h>
#include <drape/drape_global.hpp>
@@ -20,6 +21,7 @@ using ::testing::IgnoreResult;
using ::testing::Invoke;
using ::testing::InSequence;
using namespace dp;
+using namespace std;
namespace
{
diff --git a/drape/glsl_types.hpp b/drape/glsl_types.hpp
index 5229358bd4..a4ba6b65c6 100644
--- a/drape/glsl_types.hpp
+++ b/drape/glsl_types.hpp
@@ -4,7 +4,7 @@
#include "drape/color.hpp"
-#include "std/type_traits.hpp"
+#include <type_traits>
#include <glm_config.hpp>
#include <glm/vec2.hpp>
@@ -71,7 +71,8 @@ inline vec4 ToVec4(dp::Color const & color)
double(color.GetAlpha()) / 255);
}
-template<typename T, class = typename enable_if<is_integral<T>::value || is_floating_point<T>::value>::type>
+template <typename T, typename = std::enable_if_t<std::is_integral<T>::value ||
+ std::is_floating_point<T>::value>>
inline uint8_t GetArithmeticComponentCount()
{
return 1;
diff --git a/drape/gpu_program_manager.hpp b/drape/gpu_program_manager.hpp
index bd70af5657..80e2ed3188 100644
--- a/drape/gpu_program_manager.hpp
+++ b/drape/gpu_program_manager.hpp
@@ -23,7 +23,7 @@ public:
ref_ptr<GpuProgram> GetProgram(int index);
private:
- ref_ptr<Shader> GetShader(int index, string const & source, Shader::Type t);
+ ref_ptr<Shader> GetShader(int index, std::string const & source, Shader::Type t);
using ProgramMap = std::map<int, drape_ptr<GpuProgram>>;
using ShaderMap = std::map<int, drape_ptr<Shader>>;
diff --git a/drape/pointers.cpp b/drape/pointers.cpp
index 5b8c28c205..d0c4d5dfe8 100644
--- a/drape/pointers.cpp
+++ b/drape/pointers.cpp
@@ -12,9 +12,9 @@ DpPointerTracker::~DpPointerTracker()
ASSERT(m_alivePointers.empty(), ());
}
-void DpPointerTracker::RefPtrNamed(void * refPtr, string const & name)
+void DpPointerTracker::RefPtrNamed(void * refPtr, std::string const & name)
{
- lock_guard<mutex> lock(m_mutex);
+ std::lock_guard<std::mutex> lock(m_mutex);
if (refPtr != nullptr)
{
auto it = m_alivePointers.find(refPtr);
@@ -27,7 +27,7 @@ void DpPointerTracker::RefPtrNamed(void * refPtr, string const & name)
void DpPointerTracker::DestroyPtr(void * p)
{
- lock_guard<mutex> lock(m_mutex);
+ std::lock_guard<std::mutex> lock(m_mutex);
ASSERT(p != nullptr, ());
auto it = m_alivePointers.find(p);
if (it != m_alivePointers.end())
@@ -41,7 +41,7 @@ void DpPointerTracker::DestroyPtr(void * p)
void DpPointerTracker::DerefPtr(void * p)
{
- lock_guard<mutex> lock(m_mutex);
+ std::lock_guard<std::mutex> lock(m_mutex);
if (p != nullptr)
{
auto it = m_alivePointers.find(p);
diff --git a/drape/pointers.hpp b/drape/pointers.hpp
index f7d956dfa5..a6f6eadc3d 100644
--- a/drape/pointers.hpp
+++ b/drape/pointers.hpp
@@ -3,14 +3,13 @@
#include "base/assert.hpp"
#include "base/mutex.hpp"
-#include "std/map.hpp"
-#include "std/mutex.hpp"
-#include "std/string.hpp"
-#include "std/type_traits.hpp"
-#include "std/typeinfo.hpp"
-#include "std/utility.hpp"
-#include "std/unique_ptr.hpp"
-
+#include <map>
+#include <memory>
+#include <mutex>
+#include <string>
+#include <type_traits>
+#include <typeinfo>
+#include <utility>
//#define TRACK_POINTERS
@@ -18,7 +17,7 @@
class DpPointerTracker
{
public:
- typedef map<void *, pair<int, string> > TAlivePointers;
+ typedef std::map<void *, std::pair<int, std::string>> TAlivePointers;
static DpPointerTracker & Instance();
@@ -38,10 +37,10 @@ private:
DpPointerTracker() = default;
~DpPointerTracker();
- void RefPtrNamed(void * refPtr, string const & name);
+ void RefPtrNamed(void * refPtr, std::string const & name);
TAlivePointers m_alivePointers;
- mutex m_mutex;
+ std::mutex m_mutex;
};
// Custom deleter for unique_ptr
@@ -59,7 +58,8 @@ public:
#if defined(TRACK_POINTERS)
template<typename T> using drape_ptr = unique_ptr<T, DpPointerDeleter>;
#else
-template<typename T> using drape_ptr = unique_ptr<T>;
+template <typename T>
+using drape_ptr = std::unique_ptr<T>;
#endif
template <typename T, typename... Args>
@@ -117,8 +117,9 @@ public:
template<typename TResult>
operator ref_ptr<TResult>() const
{
- static_assert(is_base_of<TResult, T>::value || is_base_of<T, TResult>::value ||
- is_void<T>::value || is_void<TResult>::value, "");
+ static_assert(std::is_base_of<TResult, T>::value || std::is_base_of<T, TResult>::value ||
+ std::is_void<T>::value || std::is_void<TResult>::value, "");
+
return ref_ptr<TResult>(static_cast<TResult *>(m_ptr), m_isOwnerUnique);
}
@@ -141,7 +142,7 @@ public:
bool operator<(ref_ptr const & rhs) const { return m_ptr < rhs.m_ptr; }
- template<typename TResult, class = typename enable_if<!is_void<TResult>::value>::type>
+ template <typename TResult, typename = std::enable_if_t<!std::is_void<TResult>::value>>
TResult & operator*() const
{
return *m_ptr;
@@ -194,11 +195,11 @@ private:
bool m_isOwnerUnique;
template <typename TResult>
- friend inline string DebugPrint(ref_ptr<TResult> const & v);
+ friend inline std::string DebugPrint(ref_ptr<TResult> const & v);
};
template <typename T>
-inline string DebugPrint(ref_ptr<T> const & v)
+inline std::string DebugPrint(ref_ptr<T> const & v)
{
return DebugPrint(v.m_ptr);
}
diff --git a/drape/stipple_pen_resource.cpp b/drape/stipple_pen_resource.cpp
index ceb1957c9d..c8a8762dca 100644
--- a/drape/stipple_pen_resource.cpp
+++ b/drape/stipple_pen_resource.cpp
@@ -4,10 +4,10 @@
#include "base/shared_buffer_manager.hpp"
-#include "std/numeric.hpp"
-#include "std/iomanip.hpp"
-#include "std/sstream.hpp"
-#include "std/cstring.hpp"
+#include <cstring>
+#include <iomanip>
+#include <numeric>
+#include <sstream>
namespace dp
{
@@ -78,7 +78,7 @@ void StipplePenHandle::Init(buffer_vector<uint8_t, 8> const & pattern)
StipplePenRasterizator::StipplePenRasterizator(StipplePenKey const & key)
: m_key(key)
{
- m_patternLength = accumulate(m_key.m_pattern.begin(), m_key.m_pattern.end(), 0);
+ m_patternLength = std::accumulate(m_key.m_pattern.begin(), m_key.m_pattern.end(), 0);
uint32_t const availableSize = kMaxStipplePenLength - 2; // the first and the last pixel reserved
ASSERT_LESS(m_patternLength, availableSize, ());
uint32_t const count = floor(availableSize / m_patternLength);
@@ -126,7 +126,7 @@ void StipplePenRasterizator::Rasterize(void * buffer)
ref_ptr<Texture::ResourceInfo> StipplePenIndex::ReserveResource(bool predefined, StipplePenKey const & key,
bool & newResource)
{
- lock_guard<mutex> g(m_mappingLock);
+ std::lock_guard<std::mutex> g(m_mappingLock);
newResource = false;
StipplePenHandle handle(key);
@@ -140,8 +140,8 @@ ref_ptr<Texture::ResourceInfo> StipplePenIndex::ReserveResource(bool predefined,
StipplePenRasterizator resource(key);
m2::RectU pixelRect = m_packer.PackResource(resource.GetSize());
{
- lock_guard<mutex> g(m_lock);
- m_pendingNodes.push_back(make_pair(pixelRect, resource));
+ std::lock_guard<std::mutex> g(m_lock);
+ m_pendingNodes.push_back(std::make_pair(pixelRect, resource));
}
auto res = resourceMapping.emplace(handle, StipplePenResourceInfo(m_packer.MapTextureCoords(pixelRect),
@@ -169,7 +169,7 @@ void StipplePenIndex::UploadResources(ref_ptr<Texture> texture)
ASSERT(texture->GetFormat() == dp::ALPHA, ());
TPendingNodes pendingNodes;
{
- lock_guard<mutex> g(m_lock);
+ std::lock_guard<std::mutex> g(m_lock);
if (m_pendingNodes.empty())
return;
m_pendingNodes.swap(pendingNodes);
@@ -196,10 +196,10 @@ void StipplePenTexture::ReservePattern(buffer_vector<uint8_t, 8> const & pattern
m_indexer->ReserveResource(true /* predefined */, StipplePenKey(pattern), newResource);
}
-string DebugPrint(StipplePenHandle const & key)
+std::string DebugPrint(StipplePenHandle const & key)
{
- ostringstream out;
- out << "0x" << hex << key.m_keyValue;
+ std::ostringstream out;
+ out << "0x" << std::hex << key.m_keyValue;
return out.str();
}
} // namespace dp
diff --git a/drape/stipple_pen_resource.hpp b/drape/stipple_pen_resource.hpp
index ba01731591..02e97abe94 100644
--- a/drape/stipple_pen_resource.hpp
+++ b/drape/stipple_pen_resource.hpp
@@ -10,8 +10,10 @@
#include "geometry/point2d.hpp"
#include "geometry/rect2d.hpp"
-#include "std/map.hpp"
-#include "std/mutex.hpp"
+#include <map>
+#include <mutex>
+#include <string>
+#include <utility>
namespace dp
{
@@ -39,7 +41,7 @@ private:
void Init(buffer_vector<uint8_t, 8> const & pattern);
private:
- friend string DebugPrint(StipplePenHandle const & );
+ friend std::string DebugPrint(StipplePenHandle const &);
uint64_t m_keyValue;
};
@@ -101,8 +103,8 @@ public:
void UploadResources(ref_ptr<Texture> texture);
private:
- typedef map<StipplePenHandle, StipplePenResourceInfo> TResourceMapping;
- typedef pair<m2::RectU, StipplePenRasterizator> TPendingNode;
+ typedef std::map<StipplePenHandle, StipplePenResourceInfo> TResourceMapping;
+ typedef std::pair<m2::RectU, StipplePenRasterizator> TPendingNode;
typedef buffer_vector<TPendingNode, 32> TPendingNodes;
TResourceMapping m_predefinedResourceMapping;
@@ -110,11 +112,11 @@ private:
TPendingNodes m_pendingNodes;
StipplePenPacker m_packer;
- mutex m_lock;
- mutex m_mappingLock;
+ std::mutex m_lock;
+ std::mutex m_mappingLock;
};
-string DebugPrint(StipplePenHandle const & key);
+std::string DebugPrint(StipplePenHandle const & key);
class StipplePenTexture : public DynamicTexture<StipplePenIndex, StipplePenKey, Texture::StipplePen>
{
diff --git a/drape/texture_of_colors.cpp b/drape/texture_of_colors.cpp
index 6164159cc1..4d1f37be4b 100644
--- a/drape/texture_of_colors.cpp
+++ b/drape/texture_of_colors.cpp
@@ -3,8 +3,7 @@
#include "base/shared_buffer_manager.hpp"
#include "base/stl_add.hpp"
-#include "std/cstring.hpp"
-
+#include <cstring>
namespace dp
{
@@ -22,7 +21,7 @@ ColorPalette::ColorPalette(m2::PointU const & canvasSize)
ref_ptr<Texture::ResourceInfo> ColorPalette::ReserveResource(bool predefined, ColorKey const & key, bool & newResource)
{
- lock_guard<mutex> lock(m_mappingLock);
+ std::lock_guard<std::mutex> lock(m_mappingLock);
TPalette & palette = predefined ? m_predefinedPalette : m_palette;
TPalette::iterator itm = palette.find(key.m_color);
@@ -34,7 +33,7 @@ ref_ptr<Texture::ResourceInfo> ColorPalette::ReserveResource(bool predefined, Co
pendingColor.m_rect = m2::RectU(m_cursor.x, m_cursor.y,
m_cursor.x + kResourceSize, m_cursor.y + kResourceSize);
{
- lock_guard<mutex> g(m_lock);
+ std::lock_guard<std::mutex> g(m_lock);
m_pendingNodes.push_back(pendingColor);
}
@@ -76,7 +75,7 @@ void ColorPalette::UploadResources(ref_ptr<Texture> texture)
ASSERT(texture->GetFormat() == dp::RGBA8, ());
buffer_vector<PendingColor, 16> pendingNodes;
{
- lock_guard<mutex> g(m_lock);
+ std::lock_guard<std::mutex> g(m_lock);
if (m_pendingNodes.empty())
return;
m_pendingNodes.swap(pendingNodes);
diff --git a/drape/texture_of_colors.hpp b/drape/texture_of_colors.hpp
index fcf2bc0302..619b73314b 100644
--- a/drape/texture_of_colors.hpp
+++ b/drape/texture_of_colors.hpp
@@ -6,7 +6,8 @@
#include "base/buffer_vector.hpp"
-#include "std/mutex.hpp"
+#include <map>
+#include <mutex>
namespace dp
{
@@ -38,7 +39,7 @@ public:
void SetIsDebug(bool isDebug) { m_isDebug = isDebug; }
private:
- typedef map<Color, ColorResourceInfo> TPalette;
+ typedef std::map<Color, ColorResourceInfo> TPalette;
struct PendingColor
{
@@ -52,8 +53,8 @@ private:
m2::PointU m_textureSize;
m2::PointU m_cursor;
bool m_isDebug = false;
- mutex m_lock;
- mutex m_mappingLock;
+ std::mutex m_lock;
+ std::mutex m_mappingLock;
};
class ColorTexture : public DynamicTexture<ColorPalette, ColorKey, Texture::Color>
diff --git a/drape_frontend/animation/animation.cpp b/drape_frontend/animation/animation.cpp
index 4f6efb29f5..ddff6aa314 100644
--- a/drape_frontend/animation/animation.cpp
+++ b/drape_frontend/animation/animation.cpp
@@ -6,7 +6,7 @@ namespace df
// static
bool Animation::GetCachedProperty(TPropertyCache const & properties, Object object, ObjectProperty property, PropertyValue & value)
{
- auto const it = properties.find(make_pair(object, property));
+ auto const it = properties.find(std::make_pair(object, property));
if (it != properties.end())
{
value = it->second;
diff --git a/drape_frontend/animation/animation.hpp b/drape_frontend/animation/animation.hpp
index 209e746568..4aac4bcbdb 100644
--- a/drape_frontend/animation/animation.hpp
+++ b/drape_frontend/animation/animation.hpp
@@ -7,7 +7,11 @@
#include "geometry/point2d.hpp"
#include "geometry/screenbase.hpp"
-#include "std/unordered_set.hpp"
+#include <functional>
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
namespace df
{
@@ -71,8 +75,8 @@ public:
using TAnimObjects = std::set<Object>;
using TObjectProperties = std::set<ObjectProperty>;
- using TAction = function<void(ref_ptr<Animation>)>;
- using TPropertyCache = map<pair<Object, ObjectProperty>, Animation::PropertyValue>;
+ using TAction = std::function<void(ref_ptr<Animation>)>;
+ using TPropertyCache = std::map<std::pair<Object, ObjectProperty>, Animation::PropertyValue>;
Animation(bool couldBeInterrupted, bool couldBeBlended)
: m_couldBeInterrupted(couldBeInterrupted)
@@ -89,7 +93,7 @@ public:
virtual void Interrupt() { if (m_onInterruptAction != nullptr) m_onInterruptAction(this); }
virtual Type GetType() const = 0;
- virtual string GetCustomType() const { return string(); }
+ virtual std::string GetCustomType() const { return std::string(); }
virtual TAnimObjects const & GetObjects() const = 0;
virtual bool HasObject(Object object) const = 0;
diff --git a/drape_frontend/animation/parallel_animation.hpp b/drape_frontend/animation/parallel_animation.hpp
index 6091a75af1..82b71d5ce1 100644
--- a/drape_frontend/animation/parallel_animation.hpp
+++ b/drape_frontend/animation/parallel_animation.hpp
@@ -4,7 +4,7 @@
#include "drape/pointers.hpp"
-#include "std/list.hpp"
+#include <list>
namespace df
{
@@ -25,8 +25,8 @@ public:
bool HasProperty(Object object, ObjectProperty property) const override;
bool HasTargetProperty(Object object, ObjectProperty property) const override;
- string GetCustomType() const override;
- void SetCustomType(string const & type);
+ std::string GetCustomType() const override;
+ void SetCustomType(std::string const & type);
void AddAnimation(drape_ptr<Animation> && animation);
@@ -63,11 +63,11 @@ public:
private:
void ObtainObjectProperties();
- list<drape_ptr<Animation>> m_animations;
+ std::list<drape_ptr<Animation>> m_animations;
TAnimObjects m_objects;
- map<Object, TObjectProperties> m_properties;
+ std::map<Object, TObjectProperties> m_properties;
- string m_customType;
+ std::string m_customType;
};
} // namespace df
diff --git a/drape_frontend/animation/sequence_animation.cpp b/drape_frontend/animation/sequence_animation.cpp
index 18a6d354b4..9ad3e672d9 100644
--- a/drape_frontend/animation/sequence_animation.cpp
+++ b/drape_frontend/animation/sequence_animation.cpp
@@ -18,15 +18,9 @@ void SequenceAnimation::Init(ScreenBase const & screen, TPropertyCache const & p
m_animations.front()->Init(screen, properties);
}
-string SequenceAnimation::GetCustomType() const
-{
- return m_customType;
-}
+std::string SequenceAnimation::GetCustomType() const { return m_customType; }
-void SequenceAnimation::SetCustomType(string const & type)
-{
- m_customType = type;
-}
+void SequenceAnimation::SetCustomType(std::string const & type) { m_customType = type; }
Animation::TAnimObjects const & SequenceAnimation::GetObjects() const
{
diff --git a/drape_frontend/animation/sequence_animation.hpp b/drape_frontend/animation/sequence_animation.hpp
index 835e29b0dc..c5116c4bac 100644
--- a/drape_frontend/animation/sequence_animation.hpp
+++ b/drape_frontend/animation/sequence_animation.hpp
@@ -4,7 +4,9 @@
#include "drape/pointers.hpp"
-#include "std/deque.hpp"
+#include <deque>
+#include <map>
+#include <string>
namespace df
{
@@ -23,8 +25,8 @@ public:
bool HasProperty(Object object, ObjectProperty property) const override;
bool HasTargetProperty(Object object, ObjectProperty property) const override;
- string GetCustomType() const override;
- void SetCustomType(string const & type);
+ std::string GetCustomType() const override;
+ void SetCustomType(std::string const & type);
void SetMaxDuration(double maxDuration) override;
void SetMinDuration(double minDuration) override;
@@ -47,11 +49,11 @@ public:
private:
void ObtainObjectProperties();
- deque<drape_ptr<Animation>> m_animations;
+ std::deque<drape_ptr<Animation>> m_animations;
TAnimObjects m_objects;
- map<Object, TObjectProperties> m_properties;
+ std::map<Object, TObjectProperties> m_properties;
- string m_customType;
+ std::string m_customType;
};
} // namespace df
diff --git a/drape_frontend/animation/value_mapping.hpp b/drape_frontend/animation/value_mapping.hpp
index 5c8cbe2360..8dc6f21463 100644
--- a/drape_frontend/animation/value_mapping.hpp
+++ b/drape_frontend/animation/value_mapping.hpp
@@ -3,6 +3,8 @@
#include "base/buffer_vector.hpp"
#include "base/logging.hpp"
+#include <utility>
+
namespace df
{
@@ -11,7 +13,7 @@ class ValueMapping
{
/// double = interpolation point [0.0, 1.0]
/// TValue = output value
- using TRangePoint = pair<double, TValue>;
+ using TRangePoint = std::pair<double, TValue>;
using TRangeVector = buffer_vector<TRangePoint, 8>;
using TRangeIter = typename TRangeVector::const_iterator;
public:
diff --git a/drape_frontend/animation_system.cpp b/drape_frontend/animation_system.cpp
index 24f380caae..90a8d260f2 100644
--- a/drape_frontend/animation_system.cpp
+++ b/drape_frontend/animation_system.cpp
@@ -2,9 +2,9 @@
#include "base/logging.hpp"
-#include "std/bind.hpp"
-#include "std/vector.hpp"
-#include "std/weak_ptr.hpp"
+#include <vector>
+
+using namespace std::placeholders;
namespace df
{
@@ -75,12 +75,14 @@ void AnimationSystem::UpdateLastScreen(ScreenBase const & currentScreen)
bool AnimationSystem::GetScreen(ScreenBase const & currentScreen, ScreenBase & screen)
{
- return GetScreen(currentScreen, bind(&AnimationSystem::GetProperty, this, _1, _2, _3), screen);
+ return GetScreen(currentScreen, std::bind(&AnimationSystem::GetProperty, this, _1, _2, _3),
+ screen);
}
void AnimationSystem::GetTargetScreen(ScreenBase const & currentScreen, ScreenBase & screen)
{
- GetScreen(currentScreen, bind(&AnimationSystem::GetTargetProperty, this, _1, _2, _3), screen);
+ GetScreen(currentScreen, std::bind(&AnimationSystem::GetTargetProperty, this, _1, _2, _3),
+ screen);
}
bool AnimationSystem::GetScreen(ScreenBase const & currentScreen, TGetPropertyFn const & getPropertyFn, ScreenBase & screen)
@@ -240,7 +242,7 @@ void AnimationSystem::PushAnimation(drape_ptr<Animation> && animation)
LOG(LINFO, ("Push animation", animation->GetType()));
#endif
- shared_ptr<TAnimationList> pList(new TAnimationList());
+ auto pList = std::make_shared<TAnimationList>();
pList->emplace_back(move(animation));
bool startImmediately = m_animationChain.empty();
@@ -253,7 +255,7 @@ void AnimationSystem::PushAnimation(drape_ptr<Animation> && animation)
#endif
}
-void AnimationSystem::FinishAnimations(function<bool(shared_ptr<Animation> const &)> const & predicate,
+void AnimationSystem::FinishAnimations(std::function<bool(std::shared_ptr<Animation> const &)> const & predicate,
bool rewind, bool finishAll)
{
if (m_animationChain.empty())
@@ -325,13 +327,14 @@ void AnimationSystem::FinishAnimations(function<bool(shared_ptr<Animation> const
void AnimationSystem::FinishAnimations(Animation::Type type, bool rewind, bool finishAll)
{
- FinishAnimations([&type](shared_ptr<Animation> const & anim) { return anim->GetType() == type; },
+ FinishAnimations([&type](std::shared_ptr<Animation> const & anim) { return anim->GetType() == type; },
rewind, finishAll);
}
-void AnimationSystem::FinishAnimations(Animation::Type type, string const & customType, bool rewind, bool finishAll)
+void AnimationSystem::FinishAnimations(Animation::Type type, std::string const & customType,
+ bool rewind, bool finishAll)
{
- FinishAnimations([&type, &customType](shared_ptr<Animation> const & anim)
+ FinishAnimations([&type, &customType](std::shared_ptr<Animation> const & anim)
{
return anim->GetType() == type && anim->GetCustomType() == customType;
}, rewind, finishAll);
@@ -339,7 +342,7 @@ void AnimationSystem::FinishAnimations(Animation::Type type, string const & cust
void AnimationSystem::FinishObjectAnimations(Animation::Object object, bool rewind, bool finishAll)
{
- FinishAnimations([&object](shared_ptr<Animation> const & anim) { return anim->HasObject(object); },
+ FinishAnimations([&object](std::shared_ptr<Animation> const & anim) { return anim->HasObject(object); },
rewind, finishAll);
}
@@ -414,7 +417,7 @@ bool AnimationSystem::GetProperty(Animation::Object object, Animation::ObjectPro
}
}
- auto it = m_propertyCache.find(make_pair(object, property));
+ auto it = m_propertyCache.find(std::make_pair(object, property));
if (it != m_propertyCache.end())
{
value = it->second;
@@ -446,7 +449,7 @@ bool AnimationSystem::GetTargetProperty(Animation::Object object, Animation::Obj
}
}
- auto it = m_propertyCache.find(make_pair(object, property));
+ auto it = m_propertyCache.find(std::make_pair(object, property));
if (it != m_propertyCache.end())
{
value = it->second;
@@ -463,7 +466,7 @@ void AnimationSystem::SaveAnimationResult(Animation const & animation)
{
Animation::PropertyValue value;
if (animation.GetProperty(object, property, value))
- m_propertyCache[make_pair(object, property)] = value;
+ m_propertyCache[std::make_pair(object, property)] = value;
}
}
}
@@ -476,14 +479,14 @@ void AnimationSystem::StartNextAnimations()
m_animationChain.pop_front();
if (!m_animationChain.empty())
{
- vector<weak_ptr<Animation>> startedAnimations;
+ std::vector<std::weak_ptr<Animation>> startedAnimations;
startedAnimations.reserve(m_animationChain.front()->size());
for (auto & anim : *(m_animationChain.front()))
startedAnimations.push_back(anim);
for (auto & weak_anim : startedAnimations)
{
- shared_ptr<Animation> anim = weak_anim.lock();
+ std::shared_ptr<Animation> anim = weak_anim.lock();
if (anim != nullptr)
{
anim->Init(m_lastScreen, m_propertyCache);
diff --git a/drape_frontend/animation_system.hpp b/drape_frontend/animation_system.hpp
index 0db3911942..dcaf42bfd9 100644
--- a/drape_frontend/animation_system.hpp
+++ b/drape_frontend/animation_system.hpp
@@ -4,12 +4,15 @@
#include "geometry/screenbase.hpp"
-#include "std/cstring.hpp"
-#include "std/deque.hpp"
-#include "std/list.hpp"
#include "std/noncopyable.hpp"
-#include "std/shared_ptr.hpp"
-#include "std/string.hpp"
+
+#include <cstring>
+#include <deque>
+#include <functional>
+#include <list>
+#include <memory>
+#include <string>
+#include <utility>
//#define DEBUG_ANIMATIONS
@@ -35,7 +38,8 @@ public:
void PushAnimation(drape_ptr<Animation> && animation);
void FinishAnimations(Animation::Type type, bool rewind, bool finishAll);
- void FinishAnimations(Animation::Type type, string const & customType, bool rewind, bool finishAll);
+ void FinishAnimations(Animation::Type type, std::string const & customType, bool rewind,
+ bool finishAll);
void FinishObjectAnimations(Animation::Object object, bool rewind, bool finishAll);
template<typename T> T const * FindAnimation(Animation::Type type, char const * customType = nullptr) const
@@ -64,8 +68,8 @@ public:
private:
AnimationSystem() = default;
- using TGetPropertyFn = function<bool (Animation::Object object, Animation::ObjectProperty property,
- Animation::PropertyValue & value)>;
+ using TGetPropertyFn = std::function<bool(Animation::Object object, Animation::ObjectProperty property,
+ Animation::PropertyValue & value)>;
bool GetScreen(ScreenBase const & currentScreen, TGetPropertyFn const & getPropertyFn, ScreenBase & screen);
bool GetProperty(Animation::Object object, Animation::ObjectProperty property,
@@ -73,16 +77,17 @@ private:
bool GetTargetProperty(Animation::Object object, Animation::ObjectProperty property,
Animation::PropertyValue & value) const;
void StartNextAnimations();
- void FinishAnimations(function<bool(shared_ptr<Animation> const &)> const & predicate,
+ void FinishAnimations(std::function<bool(std::shared_ptr<Animation> const &)> const & predicate,
bool rewind, bool finishAll);
#ifdef DEBUG_ANIMATIONS
void Print();
#endif
- using TAnimationList = list<shared_ptr<Animation>>;
- using TAnimationChain = deque<shared_ptr<TAnimationList>>;
- using TPropertyCache = map<pair<Animation::Object, Animation::ObjectProperty>, Animation::PropertyValue>;
+ using TAnimationList = std::list<std::shared_ptr<Animation>>;
+ using TAnimationChain = std::deque<std::shared_ptr<TAnimationList>>;
+ using TPropertyCache = std::map<std::pair<Animation::Object, Animation::ObjectProperty>,
+ Animation::PropertyValue>;
TAnimationChain m_animationChain;
mutable TPropertyCache m_propertyCache;
diff --git a/drape_frontend/base_renderer.cpp b/drape_frontend/base_renderer.cpp
index c94ed72b8f..9865ced5c7 100644
--- a/drape_frontend/base_renderer.cpp
+++ b/drape_frontend/base_renderer.cpp
@@ -1,9 +1,7 @@
#include "drape_frontend/base_renderer.hpp"
#include "drape_frontend/message_subclasses.hpp"
-#include "std/utility.hpp"
-
-#include <functional>
+#include <utility>
namespace df
{
@@ -67,19 +65,19 @@ void BaseRenderer::SetRenderingEnabled(bool const isEnabled)
return;
// here we have to wait for completion of internal SetRenderingEnabled
- mutex completionMutex;
- condition_variable completionCondition;
+ std::mutex completionMutex;
+ std::condition_variable completionCondition;
bool notified = false;
auto handler = [&]()
{
- lock_guard<mutex> lock(completionMutex);
+ std::lock_guard<std::mutex> lock(completionMutex);
notified = true;
completionCondition.notify_one();
};
-
+
{
lock_guard<mutex> lock(m_completionHandlerMutex);
- m_renderingEnablingCompletionHandler = move(handler);
+ m_renderingEnablingCompletionHandler = std::move(handler);
}
if (isEnabled)
@@ -96,7 +94,7 @@ void BaseRenderer::SetRenderingEnabled(bool const isEnabled)
CancelMessageWaiting();
}
- unique_lock<mutex> lock(completionMutex);
+ std::unique_lock<std::mutex> lock(completionMutex);
completionCondition.wait(lock, [&notified] { return notified; });
}
@@ -129,7 +127,7 @@ void BaseRenderer::CheckRenderingEnabled()
Notify();
// wait for signal
- unique_lock<mutex> lock(m_renderingEnablingMutex);
+ std::unique_lock<std::mutex> lock(m_renderingEnablingMutex);
m_renderingEnablingCondition.wait(lock, [this] { return m_wasNotified; });
m_wasNotified = false;
@@ -158,10 +156,10 @@ void BaseRenderer::CheckRenderingEnabled()
void BaseRenderer::Notify()
{
- function<void()> handler;
+ std::function<void()> handler;
{
- lock_guard<mutex> lock(m_completionHandlerMutex);
- handler = move(m_renderingEnablingCompletionHandler);
+ std::lock_guard<std::mutex> lock(m_completionHandlerMutex);
+ handler = std::move(m_renderingEnablingCompletionHandler);
m_renderingEnablingCompletionHandler = nullptr;
}
@@ -171,7 +169,7 @@ void BaseRenderer::Notify()
void BaseRenderer::WakeUp()
{
- lock_guard<mutex> lock(m_renderingEnablingMutex);
+ std::lock_guard<std::mutex> lock(m_renderingEnablingMutex);
m_wasNotified = true;
m_renderingEnablingCondition.notify_one();
}
diff --git a/drape_frontend/base_renderer.hpp b/drape_frontend/base_renderer.hpp
index e5ab8580e8..b44f8fc277 100644
--- a/drape_frontend/base_renderer.hpp
+++ b/drape_frontend/base_renderer.hpp
@@ -9,10 +9,11 @@
#include "base/thread.hpp"
-#include "std/atomic.hpp"
-#include "std/condition_variable.hpp"
-#include "std/function.hpp"
-#include "std/mutex.hpp"
+#include <atomic>
+#include <condition_variable>
+#include <functional>
+#include <memory>
+#include <mutex>
namespace df
{
@@ -59,24 +60,24 @@ protected:
void CheckRenderingEnabled();
- virtual unique_ptr<threads::IRoutine> CreateRoutine() = 0;
+ virtual std::unique_ptr<threads::IRoutine> CreateRoutine() = 0;
virtual void OnContextCreate() = 0;
virtual void OnContextDestroy() = 0;
private:
- using TCompletionHandler = function<void()>;
+ using TCompletionHandler = std::function<void()>;
threads::Thread m_selfThread;
ThreadsCommutator::ThreadName m_threadName;
- mutex m_renderingEnablingMutex;
- condition_variable m_renderingEnablingCondition;
- atomic<bool> m_isEnabled;
+ std::mutex m_renderingEnablingMutex;
+ std::condition_variable m_renderingEnablingCondition;
+ std::atomic<bool> m_isEnabled;
TCompletionHandler m_renderingEnablingCompletionHandler;
- mutex m_completionHandlerMutex;
+ std::mutex m_completionHandlerMutex;
bool m_wasNotified;
- atomic<bool> m_wasContextReset;
+ std::atomic<bool> m_wasContextReset;
bool FilterGLContextDependentMessage(ref_ptr<Message> msg);
void SetRenderingEnabled(bool const isEnabled);
diff --git a/drape_frontend/message_acceptor.hpp b/drape_frontend/message_acceptor.hpp
index d2e2f14e86..32f8989df8 100644
--- a/drape_frontend/message_acceptor.hpp
+++ b/drape_frontend/message_acceptor.hpp
@@ -4,7 +4,8 @@
#include "drape/pointers.hpp"
-#include "std/atomic.hpp"
+#include <atomic>
+#include <functional>
namespace df
{
@@ -33,7 +34,7 @@ protected:
size_t GetQueueSize() const;
#endif
- using TFilterMessageFn = function<bool (ref_ptr<Message>)>;
+ using TFilterMessageFn = std::function<bool(ref_ptr<Message>)>;
void EnableMessageFiltering(TFilterMessageFn needFilterMessageFn);
void DisableMessageFiltering();
@@ -43,7 +44,7 @@ private:
void PostMessage(drape_ptr<Message> && message, MessagePriority priority);
MessageQueue m_messageQueue;
- atomic<bool> m_infinityWaiting;
+ std::atomic<bool> m_infinityWaiting;
TFilterMessageFn m_needFilterMessageFn;
};
diff --git a/drape_frontend/message_queue.cpp b/drape_frontend/message_queue.cpp
index 59b7850b04..f88bbd1609 100644
--- a/drape_frontend/message_queue.cpp
+++ b/drape_frontend/message_queue.cpp
@@ -3,8 +3,6 @@
#include "base/assert.hpp"
#include "base/stl_add.hpp"
-#include "std/chrono.hpp"
-
namespace df
{
@@ -21,7 +19,7 @@ MessageQueue::~MessageQueue()
drape_ptr<Message> MessageQueue::PopMessage(bool waitForMessage)
{
- unique_lock<mutex> lock(m_mutex);
+ std::unique_lock<std::mutex> lock(m_mutex);
if (waitForMessage && m_messages.empty() && m_lowPriorityMessages.empty())
{
m_isWaiting = true;
@@ -34,32 +32,32 @@ drape_ptr<Message> MessageQueue::PopMessage(bool waitForMessage)
if (!m_messages.empty())
{
- drape_ptr<Message> msg = move(m_messages.front().first);
+ drape_ptr<Message> msg = std::move(m_messages.front().first);
m_messages.pop_front();
return msg;
}
- drape_ptr<Message> msg = move(m_lowPriorityMessages.front());
+ drape_ptr<Message> msg = std::move(m_lowPriorityMessages.front());
m_lowPriorityMessages.pop_front();
return msg;
}
void MessageQueue::PushMessage(drape_ptr<Message> && message, MessagePriority priority)
{
- lock_guard<mutex> lock(m_mutex);
+ std::lock_guard<std::mutex> lock(m_mutex);
switch (priority)
{
case MessagePriority::Normal:
{
- m_messages.emplace_back(move(message), priority);
+ m_messages.emplace_back(std::move(message), priority);
break;
}
case MessagePriority::High:
{
auto iter = m_messages.begin();
while (iter != m_messages.end() && iter->second > MessagePriority::High) { iter++; }
- m_messages.emplace(iter, move(message), priority);
+ m_messages.emplace(iter, std::move(message), priority);
break;
}
case MessagePriority::UberHighSingleton:
@@ -77,12 +75,12 @@ void MessageQueue::PushMessage(drape_ptr<Message> && message, MessagePriority pr
}
if (!found)
- m_messages.emplace_front(move(message), priority);
+ m_messages.emplace_front(std::move(message), priority);
break;
}
case MessagePriority::Low:
{
- m_lowPriorityMessages.emplace_back(move(message));
+ m_lowPriorityMessages.emplace_back(std::move(message));
break;
}
default:
@@ -96,7 +94,7 @@ void MessageQueue::FilterMessages(TFilterMessageFn needFilterMessageFn)
{
ASSERT(needFilterMessageFn != nullptr, ());
- lock_guard<mutex> lock(m_mutex);
+ std::lock_guard<std::mutex> lock(m_mutex);
for (auto it = m_messages.begin(); it != m_messages.end(); )
{
if (needFilterMessageFn(make_ref(it->first)))
@@ -132,7 +130,7 @@ size_t MessageQueue::GetSize() const
void MessageQueue::CancelWait()
{
- lock_guard<mutex> lock(m_mutex);
+ std::lock_guard<std::mutex> lock(m_mutex);
CancelWaitImpl();
}
diff --git a/drape_frontend/message_queue.hpp b/drape_frontend/message_queue.hpp
index f51acaadda..93e8d44d31 100644
--- a/drape_frontend/message_queue.hpp
+++ b/drape_frontend/message_queue.hpp
@@ -6,10 +6,10 @@
#include "base/condition.hpp"
-#include "std/condition_variable.hpp"
-#include "std/deque.hpp"
-#include "std/functional.hpp"
-#include "std/mutex.hpp"
+#include <condition_variable>
+#include <deque>
+#include <functional>
+#include <mutex>
namespace df
{
@@ -28,7 +28,7 @@ public:
void CancelWait();
void ClearQuery();
- using TFilterMessageFn = function<bool(ref_ptr<Message>)>;
+ using TFilterMessageFn = std::function<bool(ref_ptr<Message>)>;
void FilterMessages(TFilterMessageFn needFilterMessageFn);
#ifdef DEBUG_MESSAGE_QUEUE
@@ -39,12 +39,12 @@ public:
private:
void CancelWaitImpl();
- mutable mutex m_mutex;
- condition_variable m_condition;
+ mutable std::mutex m_mutex;
+ std::condition_variable m_condition;
bool m_isWaiting;
- using TMessageNode = pair<drape_ptr<Message>, MessagePriority>;
- deque<TMessageNode> m_messages;
- deque<drape_ptr<Message>> m_lowPriorityMessages;
+ using TMessageNode = std::pair<drape_ptr<Message>, MessagePriority>;
+ std::deque<TMessageNode> m_messages;
+ std::deque<drape_ptr<Message>> m_lowPriorityMessages;
};
} // namespace df
diff --git a/drape_frontend/threads_commutator.cpp b/drape_frontend/threads_commutator.cpp
index 961abf0347..81068da2f6 100644
--- a/drape_frontend/threads_commutator.cpp
+++ b/drape_frontend/threads_commutator.cpp
@@ -4,12 +4,14 @@
#include "base/assert.hpp"
+#include <utility>
+
namespace df
{
void ThreadsCommutator::RegisterThread(ThreadName name, BaseRenderer * acceptor)
{
- VERIFY(m_acceptors.insert(make_pair(name, acceptor)).second, ());
+ VERIFY(m_acceptors.insert(std::make_pair(name, acceptor)).second, ());
}
void ThreadsCommutator::PostMessage(ThreadName name, drape_ptr<Message> && message, MessagePriority priority)
@@ -17,7 +19,7 @@ void ThreadsCommutator::PostMessage(ThreadName name, drape_ptr<Message> && messa
TAcceptorsMap::iterator it = m_acceptors.find(name);
ASSERT(it != m_acceptors.end(), ());
if (it != m_acceptors.end() && it->second->CanReceiveMessages())
- it->second->PostMessage(move(message), priority);
+ it->second->PostMessage(std::move(message), priority);
}
} // namespace df
diff --git a/drape_frontend/threads_commutator.hpp b/drape_frontend/threads_commutator.hpp
index e484d6aa3a..27bbbcb1c9 100644
--- a/drape_frontend/threads_commutator.hpp
+++ b/drape_frontend/threads_commutator.hpp
@@ -1,7 +1,8 @@
#pragma once
#include "drape/pointers.hpp"
-#include "std/map.hpp"
+
+#include <map>
namespace df
{
@@ -23,7 +24,7 @@ public:
void PostMessage(ThreadName name, drape_ptr<Message> && message, MessagePriority priority);
private:
- using TAcceptorsMap = map<ThreadName, BaseRenderer *>;
+ using TAcceptorsMap = std::map<ThreadName, BaseRenderer *>;
TAcceptorsMap m_acceptors;
};
diff --git a/drape_frontend/user_event_stream.cpp b/drape_frontend/user_event_stream.cpp
index ff4d87bc30..871aa558b3 100644
--- a/drape_frontend/user_event_stream.cpp
+++ b/drape_frontend/user_event_stream.cpp
@@ -18,7 +18,7 @@
#include "base/logging.hpp"
#include "base/macros.hpp"
-#include "std/chrono.hpp"
+#include <chrono>
#ifdef DEBUG
#define TEST_CALL(action) if (m_testFn) m_testFn(action)
@@ -38,7 +38,7 @@ uint64_t const kKineticDelayMs = 500;
float const kForceTapThreshold = 0.75;
-size_t GetValidTouchesCount(array<Touch, 2> const & touches)
+size_t GetValidTouchesCount(std::array<Touch, 2> const & touches)
{
size_t result = 0;
if (touches[0].m_id != -1)
@@ -144,7 +144,7 @@ UserEventStream::UserEventStream()
void UserEventStream::AddEvent(drape_ptr<UserEvent> && event)
{
- lock_guard<mutex> guard(m_lock);
+ std::lock_guard<std::mutex> guard(m_lock);
UNUSED_VALUE(guard);
m_events.emplace_back(move(event));
}
@@ -153,7 +153,7 @@ ScreenBase const & UserEventStream::ProcessEvents(bool & modelViewChanged, bool
{
TEventsList events;
{
- lock_guard<mutex> guard(m_lock);
+ std::lock_guard<std::mutex> guard(m_lock);
UNUSED_VALUE(guard);
swap(m_events, events);
}
@@ -1014,7 +1014,7 @@ bool UserEventStream::EndDrag(Touch const & t, bool cancelled)
CheckAutoRotate();
if (!cancelled && m_kineticScrollEnabled && m_scroller.IsActive() &&
- m_kineticTimer.TimeElapsedAs<milliseconds>().count() >= kKineticDelayMs)
+ m_kineticTimer.TimeElapsedAs<std::chrono::milliseconds>().count() >= kKineticDelayMs)
{
drape_ptr<Animation> anim = m_scroller.CreateKineticAnimation(m_navigator.Screen());
if (anim != nullptr)
@@ -1103,7 +1103,7 @@ void UserEventStream::DetectShortTap(Touch const & touch)
if (DetectForceTap(touch))
return;
- uint64_t const ms = m_touchTimer.TimeElapsedAs<milliseconds>().count();
+ uint64_t const ms = m_touchTimer.TimeElapsedAs<std::chrono::milliseconds>().count();
if (ms > kDoubleTapPauseMs)
{
m_state = STATE_EMPTY;
@@ -1119,7 +1119,7 @@ void UserEventStream::DetectLongTap(Touch const & touch)
if (DetectForceTap(touch))
return;
- uint64_t const ms = m_touchTimer.TimeElapsedAs<milliseconds>().count();
+ uint64_t const ms = m_touchTimer.TimeElapsedAs<std::chrono::milliseconds>().count();
if (ms > kLongTouchMs)
{
TEST_CALL(LONG_TAP_DETECTED);
@@ -1131,7 +1131,7 @@ void UserEventStream::DetectLongTap(Touch const & touch)
bool UserEventStream::DetectDoubleTap(Touch const & touch)
{
- uint64_t const ms = m_touchTimer.TimeElapsedAs<milliseconds>().count();
+ uint64_t const ms = m_touchTimer.TimeElapsedAs<std::chrono::milliseconds>().count();
if (m_state != STATE_WAIT_DOUBLE_TAP || ms > kDoubleTapPauseMs)
return false;
diff --git a/drape_frontend/user_event_stream.hpp b/drape_frontend/user_event_stream.hpp
index 8924bcbd26..737a0664df 100644
--- a/drape_frontend/user_event_stream.hpp
+++ b/drape_frontend/user_event_stream.hpp
@@ -11,11 +11,12 @@
#include "base/timer.hpp"
-#include "std/array.hpp"
-#include "std/bitset.hpp"
-#include "std/function.hpp"
-#include "std/mutex.hpp"
-#include "std/list.hpp"
+#include <array>
+#include <bitset>
+#include <functional>
+#include <list>
+#include <memory>
+#include <mutex>
namespace df
{
@@ -23,7 +24,7 @@ namespace df
int const kDoNotChangeZoom = -1;
double const kDoNotAutoZoom = -1.0;
-using TAnimationCreator = function<drape_ptr<Animation>(ref_ptr<Animation>)>;
+using TAnimationCreator = std::function<drape_ptr<Animation>(ref_ptr<Animation>)>;
class UserEvent
{
@@ -81,7 +82,7 @@ public:
double GetTimeStamp() const { return m_timeStamp; }
void SetTimeStamp(double timeStamp) { m_timeStamp = timeStamp; }
- array<Touch, 2> const & GetTouches() const { return m_touches; }
+ std::array<Touch, 2> const & GetTouches() const { return m_touches; }
Touch const & GetFirstTouch() const { return m_touches[0]; }
Touch const & GetSecondTouch() const { return m_touches[1]; }
@@ -89,7 +90,7 @@ public:
void SetFirstTouch(Touch const & touch);
void SetSecondTouch(Touch const & touch);
- void PrepareTouches(array<Touch, 2> const & previousToches);
+ void PrepareTouches(std::array<Touch, 2> const & previousToches);
/// Methods for work with current touches
/// For example : user put down one finger. We will have one touch in m_touches
@@ -108,7 +109,7 @@ private:
void Swap();
ETouchType m_type;
- array<Touch, 2> m_touches; // array of all touches
+ std::array<Touch, 2> m_touches; // array of all touches
double m_timeStamp; // seconds
uint16_t m_pointersMask;
};
@@ -427,11 +428,11 @@ private:
bool ProcessTouch(TouchEvent const & touch);
- bool TouchDown(array<Touch, 2> const & touches);
- bool TouchMove(array<Touch, 2> const & touches);
- bool TouchCancel(array<Touch, 2> const & touches);
- bool TouchUp(array<Touch, 2> const & touches);
- void UpdateTouches(array<Touch, 2> const & touches);
+ bool TouchDown(std::array<Touch, 2> const & touches);
+ bool TouchMove(std::array<Touch, 2> const & touches);
+ bool TouchCancel(std::array<Touch, 2> const & touches);
+ bool TouchUp(std::array<Touch, 2> const & touches);
+ void UpdateTouches(std::array<Touch, 2> const & touches);
void BeginDrag(Touch const & t);
void Drag(Touch const & t);
@@ -468,11 +469,11 @@ private:
void ResetMapPlaneAnimations();
bool InterruptFollowAnimations(bool force);
- bool CheckDrag(array<Touch, 2> const & touches, double threshold) const;
+ bool CheckDrag(std::array<Touch, 2> const & touches, double threshold) const;
- using TEventsList = list<drape_ptr<UserEvent>>;
+ using TEventsList = std::list<drape_ptr<UserEvent>>;
TEventsList m_events;
- mutable mutex m_lock;
+ mutable std::mutex m_lock;
m2::RectD m_visibleViewport;
m2::PointD m_trackedCenter;
@@ -493,13 +494,13 @@ private:
STATE_SCALE
} m_state;
- array<Touch, 2> m_touches;
+ std::array<Touch, 2> m_touches;
AnimationSystem & m_animationSystem;
bool m_modelViewChanged = false;
- unique_ptr<UserEvent> m_pendingEvent;
+ std::unique_ptr<UserEvent> m_pendingEvent;
ref_ptr<Listener> m_listener;
@@ -507,7 +508,7 @@ private:
TTestBridge m_testFn;
#endif
m2::PointD m_startDragOrg;
- array<m2::PointF, 2> m_twoFingersTouches;
+ std::array<m2::PointF, 2> m_twoFingersTouches;
m2::PointD m_startDoubleTapAndHold;
KineticScroller m_scroller;
diff --git a/generator/intermediate_data.hpp b/generator/intermediate_data.hpp
index 42d3fb4fc6..7be66edf78 100644
--- a/generator/intermediate_data.hpp
+++ b/generator/intermediate_data.hpp
@@ -14,6 +14,7 @@
#include <exception>
#include <fstream>
#include <limits>
+#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>
@@ -135,8 +136,8 @@ class OSMElementCache
{
public:
using TKey = uint64_t;
- using TStorage = typename conditional<TMode == EMode::Write, FileWriter, FileReader>::type;
- using TOffsetFile = typename conditional<TMode == EMode::Write, FileWriter, FileReader>::type;
+ using TStorage = std::conditional_t<TMode == EMode::Write, FileWriter, FileReader>;
+ using TOffsetFile = std::conditional_t<TMode == EMode::Write, FileWriter, FileReader>;
protected:
using TBuffer = std::vector<uint8_t>;
@@ -157,10 +158,12 @@ public:
}
template <EMode T>
- typename enable_if<T == EMode::Write, void>::type InitStorage() {}
+ std::enable_if_t<T == EMode::Write, void> InitStorage()
+ {
+ }
template <EMode T>
- typename enable_if<T == EMode::Read, void>::type InitStorage()
+ std::enable_if_t<T == EMode::Read, void> InitStorage()
{
if (!m_preload)
return;
@@ -170,7 +173,7 @@ public:
}
template <class TValue, EMode T = TMode>
- typename enable_if<T == EMode::Write, void>::type Write(TKey id, TValue const & value)
+ std::enable_if_t<T == EMode::Write, void> Write(TKey id, TValue const & value)
{
m_offsets.Add(id, m_storage.Pos());
m_data.clear();
@@ -186,7 +189,7 @@ public:
}
template <class TValue, EMode T = TMode>
- typename enable_if<T == EMode::Read, bool>::type Read(TKey id, TValue & value)
+ std::enable_if_t<T == EMode::Read, bool> Read(TKey id, TValue & value)
{
uint64_t pos = 0;
if (!m_offsets.GetValueByKey(id, pos))
@@ -252,7 +255,7 @@ class RawFilePointStorage : public PointStorage
using TFileReader = MmapReader;
#endif
- typename conditional<TMode == EMode::Write, FileWriter, TFileReader>::type m_file;
+ std::conditional_t<TMode == EMode::Write, FileWriter, TFileReader> m_file;
constexpr static double const kValueOrder = 1E+7;
@@ -260,7 +263,7 @@ public:
explicit RawFilePointStorage(std::string const & name) : m_file(name) {}
template <EMode T = TMode>
- typename enable_if<T == EMode::Write, void>::type AddPoint(uint64_t id, double lat, double lng)
+ std::enable_if_t<T == EMode::Write, void> AddPoint(uint64_t id, double lat, double lng)
{
int64_t const lat64 = lat * kValueOrder;
int64_t const lng64 = lng * kValueOrder;
@@ -278,8 +281,7 @@ public:
}
template <EMode T = TMode>
- typename enable_if<T == EMode::Read, bool>::type GetPoint(uint64_t id, double & lat,
- double & lng) const
+ std::enable_if_t<T == EMode::Read, bool> GetPoint(uint64_t id, double & lat, double & lng) const
{
LatLon ll;
m_file.Read(id * sizeof(ll), &ll, sizeof(ll));
@@ -299,7 +301,7 @@ public:
template <EMode TMode>
class RawMemPointStorage : public PointStorage
{
- typename conditional<TMode == EMode::Write, FileWriter, FileReader>::type m_file;
+ std::conditional_t<TMode == EMode::Write, FileWriter, FileReader> m_file;
constexpr static double const kValueOrder = 1E+7;
@@ -314,25 +316,29 @@ public:
~RawMemPointStorage() { DoneStorage<TMode>(); }
template <EMode T>
- typename enable_if<T == EMode::Write, void>::type InitStorage() {}
+ std::enable_if_t<T == EMode::Write, void> InitStorage()
+ {
+ }
template <EMode T>
- typename enable_if<T == EMode::Read, void>::type InitStorage()
+ std::enable_if_t<T == EMode::Read, void> InitStorage()
{
m_file.Read(0, m_data.data(), m_data.size() * sizeof(LatLon));
}
template <EMode T>
- typename enable_if<T == EMode::Write, void>::type DoneStorage()
+ std::enable_if_t<T == EMode::Write, void> DoneStorage()
{
m_file.Write(m_data.data(), m_data.size() * sizeof(LatLon));
}
template <EMode T>
- typename enable_if<T == EMode::Read, void>::type DoneStorage() {}
+ std::enable_if_t<T == EMode::Read, void> DoneStorage()
+ {
+ }
template <EMode T = TMode>
- typename enable_if<T == EMode::Write, void>::type AddPoint(uint64_t id, double lat, double lng)
+ std::enable_if_t<T == EMode::Write, void> AddPoint(uint64_t id, double lat, double lng)
{
int64_t const lat64 = lat * kValueOrder;
int64_t const lng64 = lng * kValueOrder;
@@ -348,8 +354,7 @@ public:
}
template <EMode T = TMode>
- typename enable_if<T == EMode::Read, bool>::type GetPoint(uint64_t id, double & lat,
- double & lng) const
+ std::enable_if_t<T == EMode::Read, bool> GetPoint(uint64_t id, double & lat, double & lng) const
{
LatLon const & ll = m_data[id];
// assume that valid coordinate is not (0, 0)
@@ -367,7 +372,7 @@ public:
template <EMode TMode>
class MapFilePointStorage : public PointStorage
{
- typename conditional<TMode == EMode::Write, FileWriter, FileReader>::type m_file;
+ std::conditional_t<TMode == EMode::Write, FileWriter, FileReader> m_file;
std::unordered_map<uint64_t, std::pair<int32_t, int32_t>> m_map;
constexpr static double const kValueOrder = 1E+7;
@@ -376,10 +381,12 @@ public:
explicit MapFilePointStorage(std::string const & name) : m_file(name + ".short") { InitStorage<TMode>(); }
template <EMode T>
- typename enable_if<T == EMode::Write, void>::type InitStorage() {}
+ std::enable_if_t<T == EMode::Write, void> InitStorage()
+ {
+ }
template <EMode T>
- typename enable_if<T == EMode::Read, void>::type InitStorage()
+ std::enable_if_t<T == EMode::Read, void> InitStorage()
{
LOG(LINFO, ("Nodes reading is started"));
diff --git a/generator/osm_o5m_source.hpp b/generator/osm_o5m_source.hpp
index f4f44281d2..1d2f0f8418 100644
--- a/generator/osm_o5m_source.hpp
+++ b/generator/osm_o5m_source.hpp
@@ -1,6 +1,8 @@
// See O5M Format definition at http://wiki.openstreetmap.org/wiki/O5m
#pragma once
+#include "base/stl_helpers.hpp"
+
#include <algorithm>
#include <cstring>
#include <exception>
@@ -142,8 +144,7 @@ public:
case EntityType::Sync: s << "O5M_CMD_SYNC";
case EntityType::Jump: s << "O5M_CMD_JUMP";
case EntityType::Reset: s << "O5M_CMD_RESET";
- default:
- return s << "Unknown command: " << std::hex << static_cast<typename std::underlying_type<EntityType>::type>(type);
+ default: return s << "Unknown command: " << std::hex << my::Key(type);
}
return s;
}
diff --git a/generator/osm_source.cpp b/generator/osm_source.cpp
index e134801ae2..41bbd3e5e8 100644
--- a/generator/osm_source.cpp
+++ b/generator/osm_source.cpp
@@ -70,7 +70,7 @@ class IntermediateData
{
using TReader = cache::OSMElementCache<TMode>;
- using TFile = typename conditional<TMode == cache::EMode::Write, FileWriter, FileReader>::type;
+ using TFile = conditional_t<TMode == cache::EMode::Write, FileWriter, FileReader>;
using TKey = uint64_t;
static_assert(is_integral<TKey>::value, "TKey is not integral type");
diff --git a/geometry/algorithm.hpp b/geometry/algorithm.hpp
index 89f95150bd..bdfd7d964e 100644
--- a/geometry/algorithm.hpp
+++ b/geometry/algorithm.hpp
@@ -3,10 +3,10 @@
#include "geometry/point2d.hpp"
#include "geometry/rect2d.hpp"
-#include "std/array.hpp"
-#include "std/type_traits.hpp"
-#include "std/utility.hpp"
-#include "std/vector.hpp"
+#include <array>
+#include <type_traits>
+#include <utility>
+#include <vector>
namespace m2
{
@@ -30,7 +30,7 @@ private:
double m_len;
};
- vector<Value> m_poly;
+ std::vector<Value> m_poly;
double m_length;
};
@@ -65,7 +65,7 @@ namespace impl
template <typename TCalculator, typename TIterator>
m2::PointD ApplyPointOnSurfaceCalculator(TIterator begin, TIterator end, TCalculator && calc)
{
- array<m2::PointD, 3> triangle;
+ std::array<m2::PointD, 3> triangle;
while (begin != end)
{
for (auto i = 0; i < 3; ++i)
@@ -89,17 +89,17 @@ auto ApplyCalculator(TIterator begin, TIterator end, TCalculator && calc)
}
template <typename TCalculator, typename TIterator>
-auto SelectImplementation(TIterator begin, TIterator end, TCalculator && calc, true_type const &)
- -> decltype(calc.GetResult())
+auto SelectImplementation(TIterator begin, TIterator end, TCalculator && calc,
+ std::true_type const &) -> decltype(calc.GetResult())
{
- return impl::ApplyPointOnSurfaceCalculator(begin, end, forward<TCalculator>(calc));
+ return impl::ApplyPointOnSurfaceCalculator(begin, end, std::forward<TCalculator>(calc));
}
template <typename TCalculator, typename TIterator>
-auto SelectImplementation(TIterator begin, TIterator end, TCalculator && calc, false_type const &)
- -> decltype(calc.GetResult())
+auto SelectImplementation(TIterator begin, TIterator end, TCalculator && calc,
+ std::false_type const &) -> decltype(calc.GetResult())
{
- return impl::ApplyCalculator(begin, end, forward<TCalculator>(calc));
+ return impl::ApplyCalculator(begin, end, std::forward<TCalculator>(calc));
}
} // namespace impl
@@ -107,15 +107,16 @@ template <typename TCalculator, typename TIterator>
auto ApplyCalculator(TIterator begin, TIterator end, TCalculator && calc)
-> decltype(calc.GetResult())
{
- return impl::SelectImplementation(begin, end, forward<TCalculator>(calc),
- is_same<CalculatePointOnSurface,
- typename remove_reference<TCalculator>::type>());
+ return impl::SelectImplementation(
+ begin, end, std::forward<TCalculator>(calc),
+ std::is_same<CalculatePointOnSurface, std::remove_reference_t<TCalculator>>());
}
template <typename TCalculator, typename TCollection>
auto ApplyCalculator(TCollection && collection, TCalculator && calc)
-> decltype(calc.GetResult())
{
- return ApplyCalculator(begin(collection), end(collection), forward<TCalculator>(calc));
+ return ApplyCalculator(std::begin(collection), std::end(collection),
+ std::forward<TCalculator>(calc));
}
} // namespace m2
diff --git a/indexer/cities_boundaries_serdes.hpp b/indexer/cities_boundaries_serdes.hpp
index 2525ce7a1f..3346e53761 100644
--- a/indexer/cities_boundaries_serdes.hpp
+++ b/indexer/cities_boundaries_serdes.hpp
@@ -28,6 +28,7 @@
#include <cstddef>
#include <cstdint>
#include <limits>
+#include <type_traits>
#include <vector>
namespace indexer
@@ -333,14 +334,14 @@ struct CitiesBoundariesSerDes
WriteToSinkVisitor(Sink & sink) : m_sink(sink) {}
template <typename T>
- typename enable_if<is_integral<T>::value || is_enum<T>::value, void>::type operator()(
+ std::enable_if_t<std::is_integral<T>::value || std::is_enum<T>::value, void> operator()(
T const & t, char const * /* name */ = nullptr)
{
WriteToSink(m_sink, t);
}
template <typename T>
- typename enable_if<!is_integral<T>::value && !is_enum<T>::value, void>::type operator()(
+ std::enable_if_t<!std::is_integral<T>::value && !std::is_enum<T>::value, void> operator()(
T const & t, char const * /* name */ = nullptr)
{
t.Visit(*this);
@@ -355,14 +356,14 @@ struct CitiesBoundariesSerDes
ReadFromSourceVisitor(Source & source) : m_source(source) {}
template <typename T>
- typename enable_if<is_integral<T>::value || is_enum<T>::value, void>::type operator()(
+ std::enable_if_t<std::is_integral<T>::value || std::is_enum<T>::value, void> operator()(
T & t, char const * /* name */ = nullptr)
{
t = ReadPrimitiveFromSource<T>(m_source);
}
template <typename T>
- typename enable_if<!is_integral<T>::value && !is_enum<T>::value, void>::type operator()(
+ std::enable_if_t<!std::is_integral<T>::value && !std::is_enum<T>::value, void> operator()(
T & t, char const * /* name */ = nullptr)
{
t.Visit(*this);
diff --git a/local_ads/campaign_serialization.cpp b/local_ads/campaign_serialization.cpp
index 1d583f3657..02e24b1a40 100644
--- a/local_ads/campaign_serialization.cpp
+++ b/local_ads/campaign_serialization.cpp
@@ -29,7 +29,7 @@ auto const kMaxZoomLevel = 17;
auto const kMaxPriority = 7;
template <typename Integral, typename Source,
- typename std::enable_if<std::is_integral<Integral>::value, void *>::type = nullptr>
+ std::enable_if_t<std::is_integral<Integral>::value, void *> = nullptr>
std::vector<Integral> ReadVarUintArray(Source & s, size_t chunksNumber)
{
std::vector<Integral> result;
diff --git a/openlr/helpers.hpp b/openlr/helpers.hpp
index e3a06f0ac4..a3e47156ee 100644
--- a/openlr/helpers.hpp
+++ b/openlr/helpers.hpp
@@ -21,10 +21,9 @@ bool EdgesAreAlmostEqual(Graph::Edge const & e1, Graph::Edge const & e2);
std::string LogAs2GisPath(Graph::EdgeVector const & path);
std::string LogAs2GisPath(Graph::Edge const & e);
-template <
- typename T, typename U,
- typename std::enable_if<!(std::is_signed<T>::value ^ std::is_signed<U>::value), int>::type = 0>
-typename std::common_type<T, U>::type AbsDifference(T const a, U const b)
+template <typename T, typename U,
+ std::enable_if_t<!(std::is_signed<T>::value ^ std::is_signed<U>::value), int> = 0>
+std::common_type_t<T, U> AbsDifference(T const a, U const b)
{
return a >= b ? a - b : b - a;
}
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)
diff --git a/search/query_params.hpp b/search/query_params.hpp
index c7efd09aac..a30a7f9efb 100644
--- a/search/query_params.hpp
+++ b/search/query_params.hpp
@@ -36,9 +36,8 @@ public:
// Calls |fn| on the original token and on synonyms.
template <typename Fn>
- typename std::enable_if<
- std::is_same<typename std::result_of<Fn(String)>::type, void>::value>::type
- ForEach(Fn && fn) const
+ std::enable_if_t<std::is_same<std::result_of_t<Fn(String)>, void>::value> ForEach(
+ Fn && fn) const
{
fn(m_original);
std::for_each(m_synonyms.begin(), m_synonyms.end(), std::forward<Fn>(fn));
@@ -46,9 +45,8 @@ public:
// Calls |fn| on the original token and on synonyms until |fn| return false.
template <typename Fn>
- typename std::enable_if<
- std::is_same<typename std::result_of<Fn(String)>::type, bool>::value>::type
- ForEach(Fn && fn) const
+ std::enable_if_t<std::is_same<std::result_of_t<Fn(String)>, bool>::value> ForEach(
+ Fn && fn) const
{
if (!fn(m_original))
return;
diff --git a/search/search_quality/assessment_tool/edits.hpp b/search/search_quality/assessment_tool/edits.hpp
index 038a747b90..d7b1e885d8 100644
--- a/search/search_quality/assessment_tool/edits.hpp
+++ b/search/search_quality/assessment_tool/edits.hpp
@@ -143,7 +143,7 @@ public:
private:
template <typename Fn>
- typename std::result_of<Fn()>::type WithObserver(Update const & update, Fn && fn)
+ std::result_of_t<Fn()> WithObserver(Update const & update, Fn && fn)
{
MY_SCOPE_GUARD(cleanup, ([this, &update]() {
if (m_onUpdate)
diff --git a/storage/country_info_getter.cpp b/storage/country_info_getter.cpp
index 12d74f6845..665cbe113d 100644
--- a/storage/country_info_getter.cpp
+++ b/storage/country_info_getter.cpp
@@ -17,19 +17,18 @@
#include "3party/Alohalytics/src/alohalytics.h"
-#include "std/bind.hpp"
-#include "std/function.hpp"
-#include "std/limits.hpp"
+#include <functional>
+#include <limits>
namespace storage
{
namespace
{
-size_t const kInvalidId = numeric_limits<size_t>::max();
+size_t const kInvalidId = std::numeric_limits<size_t>::max();
struct DoFreeCacheMemory
{
- void operator()(vector<m2::RegionD> & v) const { vector<m2::RegionD>().swap(v); }
+ void operator()(std::vector<m2::RegionD> & v) const { std::vector<m2::RegionD>().swap(v); }
};
class DoCalcUSA
@@ -63,7 +62,7 @@ vector<TCountryId> CountryInfoGetter::GetRegionsCountryIdByRect(m2::RectD const
{
size_t constexpr kAverageSize = 10;
- vector<TCountryId> result;
+ std::vector<TCountryId> result;
result.reserve(kAverageSize);
for (size_t id = 0; id < m_countries.size(); ++id)
{
@@ -260,19 +259,19 @@ CountryInfoReader::CountryInfoReader(ModelReaderPtr polyR, ModelReaderPtr countr
void CountryInfoReader::ClearCachesImpl() const
{
- lock_guard<mutex> lock(m_cacheMutex);
+ std::lock_guard<std::mutex> lock(m_cacheMutex);
m_cache.ForEachValue(DoFreeCacheMemory());
m_cache.Reset();
}
template <typename TFn>
-typename result_of<TFn(vector<m2::RegionD>)>::type CountryInfoReader::WithRegion(size_t id, TFn && fn) const
+std::result_of_t<TFn(vector<m2::RegionD>)> CountryInfoReader::WithRegion(size_t id, TFn && fn) const
{
- lock_guard<mutex> lock(m_cacheMutex);
+ std::lock_guard<std::mutex> lock(m_cacheMutex);
bool isFound = false;
- vector<m2::RegionD> & rgns = m_cache.Find(static_cast<uint32_t>(id), isFound);
+ std::vector<m2::RegionD> & rgns = m_cache.Find(static_cast<uint32_t>(id), isFound);
if (!isFound)
{
@@ -283,7 +282,7 @@ typename result_of<TFn(vector<m2::RegionD>)>::type CountryInfoReader::WithRegion
uint32_t const count = ReadVarUint<uint32_t>(src);
for (size_t i = 0; i < count; ++i)
{
- vector<m2::PointD> points;
+ std::vector<m2::PointD> points;
serial::LoadOuterPath(src, serial::CodingParams(), points);
rgns.emplace_back(move(points));
}
@@ -295,8 +294,7 @@ typename result_of<TFn(vector<m2::RegionD>)>::type CountryInfoReader::WithRegion
bool CountryInfoReader::IsBelongToRegionImpl(size_t id, m2::PointD const & pt) const
{
- auto contains = [&pt](vector<m2::RegionD> const & regions)
- {
+ auto contains = [&pt](std::vector<m2::RegionD> const & regions) {
for (auto const & region : regions)
{
if (region.Contains(pt))
@@ -310,15 +308,11 @@ bool CountryInfoReader::IsBelongToRegionImpl(size_t id, m2::PointD const & pt) c
bool CountryInfoReader::IsIntersectedByRegionImpl(size_t id, m2::RectD const & rect) const
{
- vector<pair<m2::PointD, m2::PointD>> edges =
- {
- {rect.LeftTop(), rect.RightTop()},
- {rect.RightTop(), rect.RightBottom()},
- {rect.RightBottom(), rect.LeftBottom()},
- {rect.LeftBottom(), rect.LeftTop()}
- };
- auto contains = [&edges](vector<m2::RegionD> const & regions)
- {
+ std::vector<pair<m2::PointD, m2::PointD>> edges = {{rect.LeftTop(), rect.RightTop()},
+ {rect.RightTop(), rect.RightBottom()},
+ {rect.RightBottom(), rect.LeftBottom()},
+ {rect.LeftBottom(), rect.LeftTop()}};
+ auto contains = [&edges](std::vector<m2::RegionD> const & regions) {
for (auto const & region : regions)
{
for (auto const & edge : edges)
@@ -340,8 +334,7 @@ bool CountryInfoReader::IsIntersectedByRegionImpl(size_t id, m2::RectD const & r
bool CountryInfoReader::IsCloseEnough(size_t id, m2::PointD const & pt, double distance)
{
m2::RectD const lookupRect = MercatorBounds::RectByCenterXYAndSizeInMeters(pt, distance);
- auto isCloseEnough = [&](vector<m2::RegionD> const & regions)
- {
+ auto isCloseEnough = [&](std::vector<m2::RegionD> const & regions) {
for (auto const & region : regions)
{
if (region.Contains(pt) || region.AtBorder(pt, lookupRect.SizeX() / 2))
@@ -354,7 +347,7 @@ bool CountryInfoReader::IsCloseEnough(size_t id, m2::PointD const & pt, double d
}
// CountryInfoGetterForTesting ---------------------------------------------------------------------
-CountryInfoGetterForTesting::CountryInfoGetterForTesting(vector<CountryDef> const & countries)
+CountryInfoGetterForTesting::CountryInfoGetterForTesting(std::vector<CountryDef> const & countries)
: CountryInfoGetter(true)
{
for (auto const & country : countries)
diff --git a/storage/country_info_getter.hpp b/storage/country_info_getter.hpp
index 3e026b3287..a53af3fed1 100644
--- a/storage/country_info_getter.hpp
+++ b/storage/country_info_getter.hpp
@@ -11,9 +11,12 @@
#include "base/cache.hpp"
-#include "std/mutex.hpp"
-#include "std/unordered_map.hpp"
-#include "std/type_traits.hpp"
+#include <map>
+#include <mutex>
+#include <string>
+#include <type_traits>
+#include <unordered_map>
+#include <vector>
namespace storage
{
@@ -26,7 +29,7 @@ class CountryInfoGetter
public:
// Identifier of a region (index in m_countries array).
using TRegionId = size_t;
- using TRegionIdSet = vector<TRegionId>;
+ using TRegionIdSet = std::vector<TRegionId>;
CountryInfoGetter(bool isSingleMwm) : m_isSingleMwm(isSingleMwm) {}
virtual ~CountryInfoGetter() = default;
@@ -39,7 +42,7 @@ public:
// Returns vector of countries file names without an extension for
// countries belong to |rect|. |rough| provides fast rough result
// or a slower but more precise one.
- vector<TCountryId> GetRegionsCountryIdByRect(m2::RectD const & rect, bool rough) const;
+ std::vector<TCountryId> GetRegionsCountryIdByRect(m2::RectD const & rect, bool rough) const;
// Returns a list of country ids by a |pt| in mercator.
// |closestCoutryIds| is filled with country ids of mwm which covers |pt| or close to it.
@@ -110,14 +113,14 @@ protected:
// @TODO(bykoianko): consider to get rid of m_countryIndex.
// The possibility should be considered.
// List of all known countries.
- vector<CountryDef> m_countries;
+ std::vector<CountryDef> m_countries;
// Maps all leaf country id (file names) to their indices in m_countries.
- unordered_map<TCountryId, TRegionId> m_countryIndex;
+ std::unordered_map<TCountryId, TRegionId> m_countryIndex;
TMappingAffiliations const * m_affiliations = nullptr;
// Maps country file name without an extension to a country info.
- map<string, CountryInfo> m_id2info;
+ std::map<std::string, CountryInfo> m_id2info;
// m_isSingleMwm == true if the system is currently working with single (small) mwms
// and false otherwise.
@@ -149,11 +152,11 @@ protected:
bool IsCloseEnough(size_t id, m2::PointD const & pt, double distance) override;
template <typename TFn>
- typename result_of<TFn(vector<m2::RegionD>)>::type WithRegion(size_t id, TFn && fn) const;
+ std::result_of_t<TFn(vector<m2::RegionD>)> WithRegion(size_t id, TFn && fn) const;
FilesContainerR m_reader;
- mutable my::Cache<uint32_t, vector<m2::RegionD>> m_cache;
- mutable mutex m_cacheMutex;
+ mutable my::Cache<uint32_t, std::vector<m2::RegionD>> m_cache;
+ mutable std::mutex m_cacheMutex;
};
// This class allows users to get info about very simply rectangular
@@ -163,7 +166,7 @@ class CountryInfoGetterForTesting : public CountryInfoGetter
{
public:
CountryInfoGetterForTesting() = default;
- CountryInfoGetterForTesting(vector<CountryDef> const & countries);
+ CountryInfoGetterForTesting(std::vector<CountryDef> const & countries);
void AddCountry(CountryDef const & country);
diff --git a/transit/transit_serdes.hpp b/transit/transit_serdes.hpp
index c46039a2e0..faeaf77ae4 100644
--- a/transit/transit_serdes.hpp
+++ b/transit/transit_serdes.hpp
@@ -42,33 +42,31 @@ public:
explicit Serializer(Sink & sink) : m_sink(sink) {}
template <typename T>
- typename std::enable_if<(std::is_integral<T>::value || std::is_enum<T>::value) &&
- !std::is_same<T, uint32_t>::value && !std::is_same<T, uint64_t>::value &&
- !std::is_same<T, int32_t>::value &&
- !std::is_same<T, int64_t>::value>::type
+ std::enable_if_t<(std::is_integral<T>::value || std::is_enum<T>::value) &&
+ !std::is_same<T, uint32_t>::value && !std::is_same<T, uint64_t>::value &&
+ !std::is_same<T, int32_t>::value && !std::is_same<T, int64_t>::value>
operator()(T const & t, char const * /* name */ = nullptr)
{
WriteToSink(m_sink, t);
}
template <typename T>
- typename std::enable_if<std::is_same<T, uint32_t>::value ||
- std::is_same<T, uint64_t>::value>::type
- operator()(T t, char const * /* name */ = nullptr) const
+ std::enable_if_t<std::is_same<T, uint32_t>::value || std::is_same<T, uint64_t>::value> operator()(
+ T t, char const * /* name */ = nullptr) const
{
WriteVarUint(m_sink, t);
}
template <typename T>
- typename std::enable_if<std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value>::type
- operator()(T t, char const * name = nullptr) const
+ std::enable_if_t<std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value> operator()(
+ T t, char const * name = nullptr) const
{
WriteVarInt(m_sink, t);
}
template <typename T>
- typename std::enable_if<std::is_same<T, double>::value || std::is_same<T, float>::value>::type
- operator()(T d, char const * name = nullptr)
+ std::enable_if_t<std::is_same<T, double>::value || std::is_same<T, float>::value> operator()(
+ T d, char const * name = nullptr)
{
CHECK_GREATER_OR_EQUAL(d, kMinDoubleAtTransitSection, ());
CHECK_LESS_OR_EQUAL(d, kMaxDoubleAtTransitSection, ());
@@ -156,8 +154,9 @@ public:
(*this)(v);
}
- template<typename T>
- typename std::enable_if<std::is_class<T>::value>::type operator()(T const & t, char const * /* name */ = nullptr)
+ template <typename T>
+ std::enable_if_t<std::is_class<T>::value> operator()(T const & t,
+ char const * /* name */ = nullptr)
{
t.Visit(*this);
}
@@ -175,33 +174,31 @@ public:
explicit Deserializer(Source & source) : m_source(source) {}
template <typename T>
- typename std::enable_if<(std::is_integral<T>::value || std::is_enum<T>::value) &&
- !std::is_same<T, uint32_t>::value && !std::is_same<T, uint64_t>::value &&
- !std::is_same<T, int32_t>::value &&
- !std::is_same<T, int64_t>::value>::type
+ std::enable_if_t<(std::is_integral<T>::value || std::is_enum<T>::value) &&
+ !std::is_same<T, uint32_t>::value && !std::is_same<T, uint64_t>::value &&
+ !std::is_same<T, int32_t>::value && !std::is_same<T, int64_t>::value>
operator()(T & t, char const * name = nullptr)
{
ReadPrimitiveFromSource(m_source, t);
}
template <typename T>
- typename std::enable_if<std::is_same<T, uint32_t>::value ||
- std::is_same<T, uint64_t>::value>::type
- operator()(T & t, char const * name = nullptr)
+ std::enable_if_t<std::is_same<T, uint32_t>::value || std::is_same<T, uint64_t>::value> operator()(
+ T & t, char const * name = nullptr)
{
t = ReadVarUint<T, Source>(m_source);
}
template <typename T>
- typename std::enable_if<std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value>::type
- operator()(T & t, char const * name = nullptr)
+ std::enable_if_t<std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value> operator()(
+ T & t, char const * name = nullptr)
{
t = ReadVarInt<T, Source>(m_source);
}
template <typename T>
- typename std::enable_if<std::is_same<T, double>::value || std::is_same<T, float>::value>::type
- operator()(T & d, char const * name = nullptr)
+ std::enable_if_t<std::is_same<T, double>::value || std::is_same<T, float>::value> operator()(
+ T & d, char const * name = nullptr)
{
uint32_t ui;
(*this)(ui, name);
@@ -308,8 +305,7 @@ public:
}
template <typename T>
- typename std::enable_if<std::is_class<T>::value>::type
- operator()(T & t, char const * /* name */ = nullptr)
+ std::enable_if_t<std::is_class<T>::value> operator()(T & t, char const * /* name */ = nullptr)
{
t.Visit(*this);
}
@@ -327,8 +323,8 @@ public:
explicit FixedSizeSerializer(Sink & sink) : m_sink(sink) {}
template <typename T>
- typename std::enable_if<std::is_integral<T>::value || std::is_enum<T>::value, void>::type
- operator()(T const & t, char const * /* name */ = nullptr)
+ std::enable_if_t<std::is_integral<T>::value || std::is_enum<T>::value, void> operator()(
+ T const & t, char const * /* name */ = nullptr)
{
WriteToSink(m_sink, t);
}
@@ -346,8 +342,8 @@ public:
explicit FixedSizeDeserializer(Source & source) : m_source(source) {}
template <typename T>
- typename std::enable_if<std::is_integral<T>::value || std::is_enum<T>::value, void>::type
- operator()(T & t, char const * name = nullptr)
+ std::enable_if_t<std::is_integral<T>::value || std::is_enum<T>::value, void> operator()(
+ T & t, char const * name = nullptr)
{
ReadPrimitiveFromSource(m_source, t);
}
diff --git a/ugc/binary/serdes.cpp b/ugc/binary/serdes.cpp
index 4051fdda6a..0c855be171 100644
--- a/ugc/binary/serdes.cpp
+++ b/ugc/binary/serdes.cpp
@@ -33,14 +33,12 @@ public:
}
template <typename R>
- typename enable_if<is_fundamental<R>::value>::type operator()(R const & r,
- char const * /* name */ = nullptr)
+ enable_if_t<is_fundamental<R>::value> operator()(R const & r, char const * /* name */ = nullptr)
{
}
template <typename R>
- typename enable_if<!is_fundamental<R>::value>::type operator()(R const & r,
- char const * /* name */ = nullptr)
+ enable_if_t<!is_fundamental<R>::value> operator()(R const & r, char const * /* name */ = nullptr)
{
r.Visit(*this);
}
diff --git a/ugc/binary/visitors.hpp b/ugc/binary/visitors.hpp
index a32d5d6a54..158c8f0b93 100644
--- a/ugc/binary/visitors.hpp
+++ b/ugc/binary/visitors.hpp
@@ -95,15 +95,14 @@ public:
}
template <typename D>
- typename std::enable_if<std::is_integral<D>::value>::type operator()(
- D d, char const * /* name */ = nullptr)
+ std::enable_if_t<std::is_integral<D>::value> operator()(D d, char const * /* name */ = nullptr)
{
WriteToSink(m_sink, d);
}
template <typename R>
- typename std::enable_if<!std::is_integral<R>::value>::type operator()(
- R const & r, char const * /* name */ = nullptr)
+ std::enable_if_t<!std::is_integral<R>::value> operator()(R const & r,
+ char const * /* name */ = nullptr)
{
r.Visit(*this);
}
@@ -194,15 +193,13 @@ public:
}
template <typename D>
- typename std::enable_if<std::is_integral<D>::value>::type operator()(
- D & d, char const * /* name */ = nullptr)
+ std::enable_if_t<std::is_integral<D>::value> operator()(D & d, char const * /* name */ = nullptr)
{
ReadPrimitiveFromSource(m_source, d);
}
template <typename R>
- typename std::enable_if<!std::is_integral<R>::value>::type operator()(
- R & r, char const * /* name */ = nullptr)
+ std::enable_if_t<!std::is_integral<R>::value> operator()(R & r, char const * /* name */ = nullptr)
{
r.Visit(*this);
}