diff options
-rw-r--r-- | base/base.hpp | 3 | ||||
-rw-r--r-- | base/bits.hpp | 2 | ||||
-rw-r--r-- | base/buffer_vector.hpp | 6 | ||||
-rw-r--r-- | base/condition.cpp | 2 | ||||
-rw-r--r-- | base/condition_posix.cpp | 2 | ||||
-rw-r--r-- | base/math.hpp | 10 | ||||
-rw-r--r-- | base/string_utils.hpp | 4 | ||||
-rw-r--r-- | base/thread.hpp | 5 | ||||
-rw-r--r-- | base/timer.hpp | 5 | ||||
-rw-r--r-- | coding/read_write_utils.hpp | 8 | ||||
-rw-r--r-- | common.pri | 1 | ||||
-rw-r--r-- | geometry/tree4d.hpp | 3 | ||||
-rw-r--r-- | graphics/opengl/opengl.hpp | 4 | ||||
-rw-r--r-- | indexer/drawing_rules.cpp | 8 | ||||
-rw-r--r-- | map/address_finder.cpp | 4 | ||||
-rw-r--r-- | render/frame_image.hpp | 2 | ||||
-rw-r--r-- | routing/cross_mwm_road_graph.hpp | 2 | ||||
-rw-r--r-- | routing/vehicle_model.hpp | 2 | ||||
-rw-r--r-- | search/feature_offset_match.hpp | 2 | ||||
-rw-r--r-- | search/search_query.cpp | 2 | ||||
-rw-r--r-- | std/cstdint.hpp | 4 | ||||
-rw-r--r-- | std/kdtree.hpp | 11 | ||||
-rw-r--r-- | std/tuple.hpp | 37 | ||||
-rw-r--r-- | std/utility.hpp | 1 |
24 files changed, 42 insertions, 88 deletions
diff --git a/base/base.hpp b/base/base.hpp index 209b8b095e..26e1289f1d 100644 --- a/base/base.hpp +++ b/base/base.hpp @@ -15,8 +15,7 @@ #define MY_RELEASE_DEFINED 0 #endif -static_assert(!(MY_DEBUG_DEFINED && MY_RELEASE_DEFINED), "Either Debug or Release should be defined, but not both."); -static_assert(MY_DEBUG_DEFINED || MY_RELEASE_DEFINED, "Either Debug or Release should be defined, but not both."); +static_assert(MY_DEBUG_DEFINED ^ MY_RELEASE_DEFINED, "Either Debug or Release should be defined, but not both."); // #define DEBUG macro, which should be used with #ifdef. #if !MY_RELEASE_DEFINED diff --git a/base/bits.hpp b/base/bits.hpp index 6eff37076a..712c5e0593 100644 --- a/base/bits.hpp +++ b/base/bits.hpp @@ -1,8 +1,8 @@ #pragma once #include "base/assert.hpp" -#include "std/type_traits.hpp" #include "std/cstdint.hpp" +#include "std/type_traits.hpp" namespace bits diff --git a/base/buffer_vector.hpp b/base/buffer_vector.hpp index 870c854ad5..0d012209dd 100644 --- a/base/buffer_vector.hpp +++ b/base/buffer_vector.hpp @@ -1,13 +1,13 @@ #pragma once #include "base/assert.hpp" -#include "base/swap.hpp" #include "base/stl_iterator.hpp" +#include "base/swap.hpp" #include "std/algorithm.hpp" -#include "std/vector.hpp" +#include "std/cstring.hpp" // for memcpy #include "std/type_traits.hpp" #include "std/utility.hpp" -#include "../std/cstring.hpp" // for memcpy +#include "std/vector.hpp" template <class T, size_t N> class buffer_vector diff --git a/base/condition.cpp b/base/condition.cpp index 4a612965d1..be9ecc000c 100644 --- a/base/condition.cpp +++ b/base/condition.cpp @@ -1,3 +1,5 @@ +#include "condition.hpp" + #include "std/target_os.hpp" #if defined(OMIM_OS_WINDOWS_NATIVE) diff --git a/base/condition_posix.cpp b/base/condition_posix.cpp index 87d8e3902d..24c743bbd4 100644 --- a/base/condition_posix.cpp +++ b/base/condition_posix.cpp @@ -6,8 +6,8 @@ #include "base/mutex.hpp" #include "std/cstdint.hpp" -#include "std/systime.hpp" #include "std/errno.hpp" +#include "std/systime.hpp" #include <pthread.h> diff --git a/base/math.hpp b/base/math.hpp index a508dcb102..78b59dd335 100644 --- a/base/math.hpp +++ b/base/math.hpp @@ -27,10 +27,8 @@ template <typename T> inline T Abs(T x) template <typename TFloat> bool AlmostEqualULPs(TFloat x, TFloat y, unsigned int maxULPs = 256) { - static_assert(is_floating_point<TFloat>::value, "Only floating point is supported."); - static_assert(numeric_limits<TFloat>::is_iec559, "Only floating point is supported."); - static_assert(!numeric_limits<TFloat>::is_exact, "Only floating point is supported."); - static_assert(!numeric_limits<TFloat>::is_integer, "Only floating point is supported."); + static_assert(is_floating_point<TFloat>::value, ""); + static_assert(numeric_limits<TFloat>::is_iec559, ""); // Make sure maxUlps is non-negative and small enough that the // default NaN won't compare as equal to anything. @@ -208,9 +206,11 @@ template <typename T> T GCD(T a, T b) return multiplier * gcd; } +/// Calculate hash for the pair of values. template <typename T1, typename T2> -size_t Hash(T1 t1, T2 t2) +size_t Hash(T1 const & t1, T2 const & t2) { + /// @todo Probably, we need better hash for 2 integral types. return (hash<T1>()(t1) ^ (hash<T2>()(t2) << 1)); } diff --git a/base/string_utils.hpp b/base/string_utils.hpp index 14bc054924..08e282e796 100644 --- a/base/string_utils.hpp +++ b/base/string_utils.hpp @@ -2,10 +2,10 @@ #include "base/buffer_vector.hpp" -#include "std/string.hpp" #include "std/cstdint.hpp" -#include "std/sstream.hpp" #include "std/limits.hpp" +#include "std/sstream.hpp" +#include "std/string.hpp" #include "3party/utfcpp/source/utf8/unchecked.h" diff --git a/base/thread.hpp b/base/thread.hpp index d1fd4b7aac..654dea5d81 100644 --- a/base/thread.hpp +++ b/base/thread.hpp @@ -4,11 +4,10 @@ #include "base/cancellable.hpp" #include "base/macros.hpp" -#include "std/target_os.hpp" - +#include "std/cstdint.hpp" #include "std/noncopyable.hpp" #include "std/shared_ptr.hpp" -#include "std/cstdint.hpp" +#include "std/target_os.hpp" #include "std/thread.hpp" #include "std/unique_ptr.hpp" #include "std/utility.hpp" diff --git a/base/timer.hpp b/base/timer.hpp index d6e8678a5f..912d57c69f 100644 --- a/base/timer.hpp +++ b/base/timer.hpp @@ -1,10 +1,9 @@ #pragma once +#include "std/chrono.hpp" #include "std/cstdint.hpp" -#include "std/string.hpp" #include "std/ctime.hpp" -#include "std/chrono.hpp" - +#include "std/string.hpp" namespace my { diff --git a/coding/read_write_utils.hpp b/coding/read_write_utils.hpp index 312bc69ffa..1a894b0bde 100644 --- a/coding/read_write_utils.hpp +++ b/coding/read_write_utils.hpp @@ -90,7 +90,9 @@ namespace rw void ReadVectorOfPOD(TSource & src, TCont & v) { typedef typename TCont::value_type ValueT; - // This assert fails on std::pair<pod, pod> and OsmID class. + /// This assert fails on std::pair<int, int> and OsmID class. + /// @todo Review this logic in future with new compiler abilities. + /// https://trello.com/c/hzCc9bzN/1254-is-trivial-copy-read-write-utils-hpp //static_assert(is_trivially_copyable<ValueT>::value, ""); uint32_t const count = ReadVarUint<uint32_t>(src); @@ -105,7 +107,9 @@ namespace rw void WriteVectorOfPOD(TSink & sink, TCont const & v) { typedef typename TCont::value_type ValueT; - // This assert fails on std::pair<pod, pod> and OsmID class. + /// This assert fails on std::pair<int, int> and OsmID class. + /// @todo Review this logic in future with new compiler abilities. + /// https://trello.com/c/hzCc9bzN/1254-is-trivial-copy-read-write-utils-hpp //static_assert(is_trivially_copyable<ValueT>::value, ""); uint32_t const count = static_cast<uint32_t>(v.size()); diff --git a/common.pri b/common.pri index 695b19d7cb..56a3ed0280 100644 --- a/common.pri +++ b/common.pri @@ -245,7 +245,6 @@ HEADERS += \ $$ROOT_DIR/std/iostream.hpp \ $$ROOT_DIR/std/iterator.hpp \ $$ROOT_DIR/std/iterator_facade.hpp \ - $$ROOT_DIR/std/kdtree.hpp \ $$ROOT_DIR/std/limits.hpp \ $$ROOT_DIR/std/list.hpp \ $$ROOT_DIR/std/map.hpp \ diff --git a/geometry/tree4d.hpp b/geometry/tree4d.hpp index 4bf7c5a3dc..caef044fbe 100644 --- a/geometry/tree4d.hpp +++ b/geometry/tree4d.hpp @@ -7,7 +7,8 @@ #include "base/logging.hpp" #include "std/sstream.hpp" -#include "std/kdtree.hpp" + +#include "3party/kdtree++/kdtree.hpp" namespace m4 diff --git a/graphics/opengl/opengl.hpp b/graphics/opengl/opengl.hpp index bfa57915bb..afcfce40d1 100644 --- a/graphics/opengl/opengl.hpp +++ b/graphics/opengl/opengl.hpp @@ -1,9 +1,9 @@ #pragma once -#include "std/target_os.hpp" #include "base/logging.hpp" -#include "base/logging.hpp" +#include "std/target_os.hpp" + #if defined(OMIM_OS_WINDOWS) #include "../../std/windows.hpp" diff --git a/indexer/drawing_rules.cpp b/indexer/drawing_rules.cpp index a745356820..35ad7de737 100644 --- a/indexer/drawing_rules.cpp +++ b/indexer/drawing_rules.cpp @@ -1,5 +1,3 @@ -#include "std/target_os.hpp" - #include "indexer/drawing_rules.hpp" #include "indexer/scales.hpp" #include "indexer/classificator.hpp" @@ -8,13 +6,13 @@ #include "defines.hpp" -#include "std/bind.hpp" -#include "std/iterator_facade.hpp" - #include "platform/platform.hpp" #include "base/logging.hpp" +#include "std/bind.hpp" +#include "std/iterator_facade.hpp" + #include <google/protobuf/text_format.h> namespace diff --git a/map/address_finder.cpp b/map/address_finder.cpp index 5497699283..8ccf731ef5 100644 --- a/map/address_finder.cpp +++ b/map/address_finder.cpp @@ -189,8 +189,8 @@ namespace template <size_t count, size_t ind> void FillMatch(char const * (& arr)[count][ind], vector<uint32_t> & vec) { - static_assert (count > 0, ""); - static_assert (ind > 0, ""); + static_assert(count > 0, ""); + static_assert(ind > 0, ""); Classificator const & c = classif(); diff --git a/render/frame_image.hpp b/render/frame_image.hpp index 46c5c06516..bd2532fbca 100644 --- a/render/frame_image.hpp +++ b/render/frame_image.hpp @@ -1,7 +1,7 @@ #pragma once -#include "std/vector.hpp" #include "std/cstdint.hpp" +#include "std/vector.hpp" struct FrameImage { diff --git a/routing/cross_mwm_road_graph.hpp b/routing/cross_mwm_road_graph.hpp index 882a52e16c..120bbb072c 100644 --- a/routing/cross_mwm_road_graph.hpp +++ b/routing/cross_mwm_road_graph.hpp @@ -111,8 +111,6 @@ private: map<CrossNode, vector<CrossWeightedEdge> > m_virtualEdges; mutable RoutingIndexManager m_indexManager; - - // hash function for unordered map realisation. mutable unordered_map<m2::PointD, BorderCross, m2::PointD::Hash> m_cachedNextNodes; }; } // namespace routing diff --git a/routing/vehicle_model.hpp b/routing/vehicle_model.hpp index 7467353e2f..1dc8a4c4a1 100644 --- a/routing/vehicle_model.hpp +++ b/routing/vehicle_model.hpp @@ -1,8 +1,8 @@ #pragma once #include "base/buffer_vector.hpp" -#include "std/initializer_list.hpp" #include "std/cstdint.hpp" +#include "std/initializer_list.hpp" #include "std/unordered_map.hpp" #include "std/utility.hpp" #include "std/vector.hpp" diff --git a/search/feature_offset_match.hpp b/search/feature_offset_match.hpp index acbcebc6de..248b2de50a 100644 --- a/search/feature_offset_match.hpp +++ b/search/feature_offset_match.hpp @@ -178,7 +178,7 @@ template <class FilterT> class OffsetIntersecter { size_t operator() (ValueT const & v) const { - return static_cast<size_t>(v.m_featureId); + return v.m_featureId; } }; struct EqualFn diff --git a/search/search_query.cpp b/search/search_query.cpp index fb86b0fa8c..031c548037 100644 --- a/search/search_query.cpp +++ b/search/search_query.cpp @@ -88,7 +88,7 @@ Query::Query(Index const * pIndex, { // m_viewport is initialized as empty rects - ASSERT (m_pIndex, ()); + ASSERT(m_pIndex, ()); // Results queue's initialization. static_assert(QUEUES_COUNT == ARRAY_SIZE(g_arrCompare1), ""); diff --git a/std/cstdint.hpp b/std/cstdint.hpp index 0e37c1b477..724ef01c02 100644 --- a/std/cstdint.hpp +++ b/std/cstdint.hpp @@ -5,6 +5,8 @@ #endif #include <cstdint> +#include <cstddef> + using std::int8_t; using std::uint8_t; using std::int16_t; @@ -13,8 +15,6 @@ using std::int32_t; using std::uint32_t; using std::int64_t; using std::uint64_t; - -#include <cstddef> using std::size_t; #ifdef DEBUG_NEW diff --git a/std/kdtree.hpp b/std/kdtree.hpp deleted file mode 100644 index bf49e02d73..0000000000 --- a/std/kdtree.hpp +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#ifdef new -#undef new -#endif - -#include "../3party/kdtree++/kdtree.hpp" - -#ifdef DEBUG_NEW -#define new DEBUG_NEW -#endif diff --git a/std/tuple.hpp b/std/tuple.hpp index 760d20f411..1ab641ca7d 100644 --- a/std/tuple.hpp +++ b/std/tuple.hpp @@ -5,46 +5,11 @@ #endif #include <tuple> -#include <boost/tuple/tuple_comparison.hpp> + using std::tuple; using std::make_tuple; //using std::get; // "get" is very common name, use "get" member function -//template <class Tuple> struct tuple_length -//{ -// static const int value = boost::tuples::length<Tuple>::value; -//}; - -//template <int N, class T> struct tuple_element -//{ -// typedef typename boost::tuples::element<N, T>::type type; -//}; - -//namespace impl -//{ -// template <int N> struct for_each_tuple_impl -// { -// template <class Tuple, class ToDo> void operator() (Tuple & t, ToDo & toDo) -// { -// toDo(boost::tuples::get<N>(t), N); -// for_each_tuple_impl<N-1> c; -// c(t, toDo); -// } -// }; - -// template <> struct for_each_tuple_impl<-1> -// { -// template <class Tuple, class ToDo> void operator() (Tuple &, ToDo &) {} -// }; -//} - -//template <class Tuple, class ToDo> -//void for_each_tuple(Tuple & t, ToDo & toDo) -//{ -// impl::for_each_tuple_impl<tuple_length<Tuple>::value-1> c; -// c(t, toDo); -//} - #ifdef DEBUG_NEW #define new DEBUG_NEW #endif diff --git a/std/utility.hpp b/std/utility.hpp index 64d61997b1..b535e65831 100644 --- a/std/utility.hpp +++ b/std/utility.hpp @@ -8,6 +8,7 @@ using std::pair; using std::make_pair; using std::move; +using std::forward; #ifdef DEBUG_NEW #define new DEBUG_NEW |