diff options
30 files changed, 71 insertions, 96 deletions
diff --git a/base/base.hpp b/base/base.hpp index f1c02b7f13..08caa162ec 100644 --- a/base/base.hpp +++ b/base/base.hpp @@ -1,7 +1,6 @@ #pragma once #include "std/stdint.hpp" -#include "std/static_assert.hpp" #if defined(DEBUG) || defined(_DEBUG) || defined(NRELEASE) || defined(QT_DEBUG) #define MY_DEBUG_DEFINED 1 @@ -16,10 +15,8 @@ #define MY_RELEASE_DEFINED 0 #endif -// Either Debug or Release should be defined, but not both. -STATIC_ASSERT(!(MY_DEBUG_DEFINED && MY_RELEASE_DEFINED)); -STATIC_ASSERT(MY_DEBUG_DEFINED || MY_RELEASE_DEFINED); - +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 26ad241d81..8291321ae9 100644 --- a/base/bits.hpp +++ b/base/bits.hpp @@ -84,13 +84,13 @@ namespace bits template <typename T> inline typename make_unsigned<T>::type ZigZagEncode(T x) { - STATIC_ASSERT(is_signed<T>::value); + static_assert(is_signed<T>::value, "Type should be signed"); return (x << 1) ^ (x >> (sizeof(x) * 8 - 1)); } template <typename T> inline typename make_signed<T>::type ZigZagDecode(T x) { - STATIC_ASSERT(is_unsigned<T>::value); + static_assert(is_unsigned<T>::value, "Type should be unsigned."); return (x >> 1) ^ -static_cast<typename make_signed<T>::type>(x & 1); } diff --git a/base/cache.hpp b/base/cache.hpp index 3352534f34..16f70ef139 100644 --- a/base/cache.hpp +++ b/base/cache.hpp @@ -18,8 +18,7 @@ namespace my explicit Cache(uint32_t logCacheSize) : m_Cache(new Data[1 << logCacheSize]), m_HashMask((1 << logCacheSize) - 1) { - STATIC_ASSERT((is_same<KeyT, uint32_t>::value || - is_same<KeyT, uint64_t>::value)); + static_assert((is_same<KeyT, uint32_t>::value || is_same<KeyT, uint64_t>::value), ""); // We always use cache with static constant. So debug assert is enough here. ASSERT_GREATER ( logCacheSize, 0, () ); diff --git a/base/math.hpp b/base/math.hpp index b4900db52f..1015825082 100644 --- a/base/math.hpp +++ b/base/math.hpp @@ -26,10 +26,10 @@ 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); - STATIC_ASSERT(numeric_limits<TFloat>::is_iec559); - STATIC_ASSERT(!numeric_limits<TFloat>::is_exact); - STATIC_ASSERT(!numeric_limits<TFloat>::is_integer); + 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."); // Make sure maxUlps is non-negative and small enough that the // default NaN won't compare as equal to anything. diff --git a/base/string_utils.cpp b/base/string_utils.cpp index 6f7a019088..933763f215 100644 --- a/base/string_utils.cpp +++ b/base/string_utils.cpp @@ -119,8 +119,8 @@ namespace char ascii_to_lower(char in) { char const diff = 'z' - 'Z'; - STATIC_ASSERT(diff == 'a' - 'A'); - STATIC_ASSERT(diff > 0); + static_assert(diff == 'a' - 'A', ""); + static_assert(diff > 0, ""); if (in >= 'A' && in <= 'Z') return (in + diff); diff --git a/coding/endianness.hpp b/coding/endianness.hpp index 3d209981d7..cb672748e1 100644 --- a/coding/endianness.hpp +++ b/coding/endianness.hpp @@ -18,7 +18,7 @@ inline bool IsBigEndian() template <typename T> T ReverseByteOrder(T t) { - STATIC_ASSERT(is_integral<T>::value); + static_assert(is_integral<T>::value, "Only integral types are supported."); T res; char const * a = reinterpret_cast<char const *>(&t); diff --git a/coding/hex.hpp b/coding/hex.hpp index 1218e28884..8dd9d7a74d 100644 --- a/coding/hex.hpp +++ b/coding/hex.hpp @@ -26,7 +26,7 @@ inline string ToHex(const void * ptr, size_t size) template <typename ContainerT> inline string ToHex(ContainerT const & container) { - STATIC_ASSERT(sizeof(*container.begin()) == 1); + static_assert(sizeof(*container.begin()) == 1, ""); if (container.empty()) return string(); @@ -39,7 +39,7 @@ inline string ToHex(ContainerT const & container) template <typename IntT> inline string NumToHex(IntT n) { - STATIC_ASSERT(is_integral<IntT>::value); + static_assert(is_integral<IntT>::value, ""); uint8_t buf[sizeof(n)]; diff --git a/coding/internal/file64_api.hpp b/coding/internal/file64_api.hpp index a14baa1452..bddd931b0b 100644 --- a/coding/internal/file64_api.hpp +++ b/coding/internal/file64_api.hpp @@ -7,7 +7,7 @@ #define ftell64 _ftelli64 #elif defined(OMIM_OS_TIZEN) - STATIC_ASSERT(sizeof(__off64_t) == 8); + static_assert(sizeof(__off64_t) == 8, ""); #define fseek64 fseeko64 #define ftell64 ftello64 @@ -15,18 +15,16 @@ typedef uint64_t _fpos64_t; #elif defined(OMIM_OS_WINDOWS_MINGW) - //STATIC_ASSERT(sizeof(off64_t) == 8); #define fseek64 fseeko64 #define ftell64 ftello64 #elif defined(OMIM_OS_ANDROID) - // For Android, off_t is 32bit, so big files are not supported - STATIC_ASSERT(sizeof(off_t) == 4); + static_assert(sizeof(off_t) == 4, "For Android, off_t is 32bit, so big files are not supported."); #define fseek64 fseeko #define ftell64 ftello #else - STATIC_ASSERT(sizeof(off_t) == 8); + static_assert(sizeof(off_t) == 8, ""); #define fseek64 fseeko #define ftell64 ftello diff --git a/coding/multilang_utf8_string.cpp b/coding/multilang_utf8_string.cpp index 1614e72823..4a766cf35f 100644 --- a/coding/multilang_utf8_string.cpp +++ b/coding/multilang_utf8_string.cpp @@ -12,7 +12,7 @@ static char const * gLangs[] = { int8_t StringUtf8Multilang::GetLangIndex(string const & lang) { - STATIC_ASSERT(ARRAY_SIZE(gLangs) == MAX_SUPPORTED_LANGUAGES); + static_assert(ARRAY_SIZE(gLangs) == MAX_SUPPORTED_LANGUAGES, ""); for (size_t i = 0; i < ARRAY_SIZE(gLangs); ++i) if (lang == gLangs[i]) diff --git a/coding/read_write_utils.hpp b/coding/read_write_utils.hpp index 70370a2d42..312bc69ffa 100644 --- a/coding/read_write_utils.hpp +++ b/coding/read_write_utils.hpp @@ -6,7 +6,7 @@ #include "std/string.hpp" #include "std/vector.hpp" -//#include "../std/type_traits.hpp" +#include "std/type_traits.hpp" namespace rw @@ -90,8 +90,8 @@ namespace rw void ReadVectorOfPOD(TSource & src, TCont & v) { typedef typename TCont::value_type ValueT; - // Not every compiler support this. - //STATIC_ASSERT(boost::is_pod<ValueT>::value); + // This assert fails on std::pair<pod, pod> and OsmID class. + //static_assert(is_trivially_copyable<ValueT>::value, ""); uint32_t const count = ReadVarUint<uint32_t>(src); if (count > 0) @@ -105,8 +105,8 @@ namespace rw void WriteVectorOfPOD(TSink & sink, TCont const & v) { typedef typename TCont::value_type ValueT; - // Not every compiler support this. - //STATIC_ASSERT(boost::is_pod<ValueT>::value); + // This assert fails on std::pair<pod, pod> and OsmID class. + //static_assert(is_trivially_copyable<ValueT>::value, ""); uint32_t const count = static_cast<uint32_t>(v.size()); WriteVarUint(sink, count); diff --git a/coding/streams_sink.hpp b/coding/streams_sink.hpp index dd6ff4ca42..0bdacc1cc1 100644 --- a/coding/streams_sink.hpp +++ b/coding/streams_sink.hpp @@ -38,7 +38,7 @@ namespace stream SinkReaderStream & operator >> (double & t) { - STATIC_ASSERT(sizeof(double) == sizeof(int64_t)); + static_assert(sizeof(double) == sizeof(int64_t), ""); int64_t * tInt = reinterpret_cast<int64_t *>(&t); operator >> (*tInt); return *this; @@ -74,7 +74,7 @@ namespace stream SinkWriterStream & operator << (double t) { - STATIC_ASSERT(sizeof(double) == sizeof(int64_t)); + static_assert(sizeof(double) == sizeof(int64_t), ""); int64_t const tInt = *reinterpret_cast<int64_t const *>(&t); operator << (tInt); return (*this); diff --git a/coding/varint.hpp b/coding/varint.hpp index 6b0ea0ab23..5777085fcc 100644 --- a/coding/varint.hpp +++ b/coding/varint.hpp @@ -14,7 +14,7 @@ /// Pass any integral type and it will write platform-independent. template <typename T, typename TSink> void WriteVarUint(TSink & dst, T value) { - STATIC_ASSERT(is_unsigned<T>::value); + static_assert(is_unsigned<T>::value, ""); while (value > 127) { WriteToSink(dst, static_cast<uint8_t>((value & 127) | 128)); @@ -141,11 +141,11 @@ template <typename TSource> uint64_t ReadVarUint(TSource & src, uint64_t const * template <typename T, typename TSource> T ReadVarUint(TSource & src) { - STATIC_ASSERT((is_same<T, uint32_t>::value || is_same<T, uint64_t>::value)); + static_assert((is_same<T, uint32_t>::value || is_same<T, uint64_t>::value), ""); return ::impl::ReadVarUint(src, static_cast<T const *>(NULL)); /* Generic code commented out. - STATIC_ASSERT(is_unsigned<T>::value); + static_assert(is_unsigned<T>::value, ""); T res = 0; unsigned int bits = 0; for (; bits < sizeof(T) * 8 - 7; bits += 7) @@ -167,13 +167,13 @@ template <typename T, typename TSource> T ReadVarUint(TSource & src) template <typename T, typename TSink> void WriteVarInt(TSink & dst, T value) { - STATIC_ASSERT(is_signed<T>::value); + static_assert(is_signed<T>::value, ""); WriteVarUint(dst, bits::ZigZagEncode(value)); } template <typename T, typename TSource> T ReadVarInt(TSource & src) { - STATIC_ASSERT(is_signed<T>::value); + static_assert(is_signed<T>::value, ""); return bits::ZigZagDecode(ReadVarUint<typename make_unsigned<T>::type>(src)); } diff --git a/coding/writer.hpp b/coding/writer.hpp index dd87b865a1..40655aacd2 100644 --- a/coding/writer.hpp +++ b/coding/writer.hpp @@ -32,7 +32,7 @@ class MemWriter : public Writer public: inline MemWriter(ContainerT & data) : m_Data(data), m_Pos(0) { - STATIC_ASSERT(sizeof(typename ContainerT::value_type) == 1); + static_assert(sizeof(typename ContainerT::value_type) == 1, ""); } inline void Seek(int64_t pos) diff --git a/drape/utils/vertex_decl.cpp b/drape/utils/vertex_decl.cpp index e6385412a5..5e3dd04891 100644 --- a/drape/utils/vertex_decl.cpp +++ b/drape/utils/vertex_decl.cpp @@ -25,9 +25,9 @@ typedef dp::BindingInfo (*TInitFunction)(); dp::BindingInfo SolidTexturingBindingInit() { - STATIC_ASSERT(sizeof(SolidTexturingVertex) == (sizeof(SolidTexturingVertex::TPosition) + + static_assert(sizeof(SolidTexturingVertex) == (sizeof(SolidTexturingVertex::TPosition) + sizeof(SolidTexturingVertex::TNormal) + - sizeof(SolidTexturingVertex::TTexCoord))); + sizeof(SolidTexturingVertex::TTexCoord)), ""); dp::BindingInfo info(3); @@ -57,8 +57,8 @@ dp::BindingInfo SolidTexturingBindingInit() dp::BindingInfo TextStaticBindingInit() { - STATIC_ASSERT(sizeof(TextStaticVertex) == (sizeof(TextStaticVertex::TPosition) + - 3 * sizeof(TextStaticVertex::TTexCoord))); + static_assert(sizeof(TextStaticVertex) == (sizeof(TextStaticVertex::TPosition) + + 3 * sizeof(TextStaticVertex::TTexCoord)), ""); dp::BindingInfo info(4); dp::BindingDecl & posDecl = info.GetBindingDecl(0); @@ -94,7 +94,7 @@ dp::BindingInfo TextStaticBindingInit() dp::BindingInfo TextDynamicBindingInit() { - STATIC_ASSERT(sizeof(TextDynamicVertex) == sizeof(TextDynamicVertex::TNormal)); + static_assert(sizeof(TextDynamicVertex) == sizeof(TextDynamicVertex::TNormal), ""); dp::BindingInfo info(1, TextDynamicVertex::GetDynamicStreamID()); dp::BindingDecl & decl = info.GetBindingDecl(0); @@ -109,9 +109,9 @@ dp::BindingInfo TextDynamicBindingInit() dp::BindingInfo LineBindingInit() { - STATIC_ASSERT(sizeof(LineVertex) == sizeof(LineVertex::TPosition) + + static_assert(sizeof(LineVertex) == sizeof(LineVertex::TPosition) + 2 * sizeof(LineVertex::TNormal) + - 2 * sizeof(LineVertex::TTexCoord)); + 2 * sizeof(LineVertex::TTexCoord), ""); dp::BindingInfo info(5); dp::BindingDecl & posDecl = info.GetBindingDecl(0); diff --git a/generator/osm_source.cpp b/generator/osm_source.cpp index d72315f2af..2fb711920e 100644 --- a/generator/osm_source.cpp +++ b/generator/osm_source.cpp @@ -220,7 +220,7 @@ namespace { "place", "island" }, { "place", "islet" } }; - STATIC_ASSERT(ARRAY_SIZE(arr) == TYPES_COUNT); + static_assert(ARRAY_SIZE(arr) == TYPES_COUNT, ""); for (size_t i = 0; i < ARRAY_SIZE(arr); ++i) m_types[i] = c.GetTypeByPath(vector<string>(arr[i], arr[i] + 2)); diff --git a/geometry/avg_vector.hpp b/geometry/avg_vector.hpp index b5b871cf6c..39390ca62f 100644 --- a/geometry/avg_vector.hpp +++ b/geometry/avg_vector.hpp @@ -58,7 +58,7 @@ namespace math public: AvgVector(size_t count = 1) : m_count(count) { - STATIC_ASSERT(is_floating_point<T>::value); + static_assert(is_floating_point<T>::value, ""); } void SetCount(size_t count) { m_count = count; } diff --git a/geometry/distance.hpp b/geometry/distance.hpp index 1063779bc1..5b53aa0313 100644 --- a/geometry/distance.hpp +++ b/geometry/distance.hpp @@ -4,7 +4,6 @@ #include "base/math.hpp" #include "std/limits.hpp" -#include "std/static_assert.hpp" namespace m2 @@ -16,8 +15,7 @@ namespace impl template <typename PointT> class CalculatedSection { private: - // we do not support unsigned points!!! - STATIC_ASSERT(numeric_limits<typename PointT::value_type>::is_signed); + static_assert(numeric_limits<typename PointT::value_type>::is_signed, "We do not support unsigned points!!!"); public: void SetBounds(PointT const & p0, PointT const & p1) diff --git a/graphics/geometry_batcher.cpp b/graphics/geometry_batcher.cpp index 4af30ac93d..284bffa962 100644 --- a/graphics/geometry_batcher.cpp +++ b/graphics/geometry_batcher.cpp @@ -23,7 +23,7 @@ namespace graphics template <typename T> void CheckPointLayout() { - STATIC_ASSERT(sizeof(m2::Point<T>) == 2 * sizeof(T)); + static_assert(sizeof(m2::Point<T>) == 2 * sizeof(T), ""); m2::Point<T> p; CHECK_EQUAL(reinterpret_cast<unsigned char*>(&p), reinterpret_cast<unsigned char*>(&p.x), ()); CHECK_EQUAL(reinterpret_cast<unsigned char*>(&p) + sizeof(T), reinterpret_cast<unsigned char*>(&p.y), ()); @@ -412,7 +412,7 @@ namespace graphics double depth, int pipelineID) { - STATIC_ASSERT(sizeof(m2::PointF) == 2 * sizeof(float)); + static_assert(sizeof(m2::PointF) == 2 * sizeof(float), ""); VertexStream vs; @@ -444,7 +444,7 @@ namespace graphics double depth, int pipelineID) { - STATIC_ASSERT(sizeof(m2::PointF) == 2 * sizeof(float)); + static_assert(sizeof(m2::PointF) == 2 * sizeof(float), ""); VertexStream vs; @@ -475,7 +475,7 @@ namespace graphics int pipelineID ) { - STATIC_ASSERT(sizeof(m2::PointF) == 2 * sizeof(float)); + static_assert(sizeof(m2::PointF) == 2 * sizeof(float), ""); VertexStream vs; @@ -508,7 +508,7 @@ namespace graphics double depth, int pipelineID) { - STATIC_ASSERT(sizeof(m2::PointF) == 2 * sizeof(float)); + static_assert(sizeof(m2::PointF) == 2 * sizeof(float), ""); VertexStream vs; @@ -541,8 +541,8 @@ namespace graphics double depth, int pipelineID) { - STATIC_ASSERT(sizeof(m2::PointD) == 2 * sizeof(double)); - STATIC_ASSERT(sizeof(m2::PointF) == 2 * sizeof(float)); + static_assert(sizeof(m2::PointD) == 2 * sizeof(double), ""); + static_assert(sizeof(m2::PointF) == 2 * sizeof(float), ""); VertexStream vs; @@ -575,8 +575,8 @@ namespace graphics double depth, int pipelineID) { - STATIC_ASSERT(sizeof(m2::PointD) == 2 * sizeof(double)); - STATIC_ASSERT(sizeof(m2::PointF) == 2 * sizeof(float)); + static_assert(sizeof(m2::PointD) == 2 * sizeof(double), ""); + static_assert(sizeof(m2::PointF) == 2 * sizeof(float), ""); VertexStream vs; @@ -610,7 +610,7 @@ namespace graphics double depth, int pipelineID) { - STATIC_ASSERT(sizeof(m2::PointF) == 2 * sizeof(float)); + static_assert(sizeof(m2::PointF) == 2 * sizeof(float), ""); VertexStream vs; diff --git a/indexer/data_header.cpp b/indexer/data_header.cpp index 726852f725..83bf6dcf91 100644 --- a/indexer/data_header.cpp +++ b/indexer/data_header.cpp @@ -57,7 +57,7 @@ namespace feature template <class TSink, class TCont> void SaveBytes(TSink & sink, TCont const & cont) { - STATIC_ASSERT(sizeof(typename TCont::value_type) == 1); + static_assert(sizeof(typename TCont::value_type) == 1, ""); uint32_t const count = static_cast<uint32_t>(cont.size()); WriteVarUint(sink, count); @@ -68,7 +68,7 @@ namespace feature template <class TSource, class TCont> void LoadBytes(TSource & src, TCont & cont) { - STATIC_ASSERT(sizeof(typename TCont::value_type) == 1); + static_assert(sizeof(typename TCont::value_type) == 1, ""); ASSERT ( cont.empty(), () ); uint32_t const count = ReadVarUint<uint32_t>(src); diff --git a/indexer/feature_impl.hpp b/indexer/feature_impl.hpp index 72757633ff..66d7357e3f 100644 --- a/indexer/feature_impl.hpp +++ b/indexer/feature_impl.hpp @@ -21,9 +21,9 @@ namespace feature str = prefix; static char const arrChar[] = { '0', '1', '2', '3' }; - STATIC_ASSERT ( ARRAY_SIZE(arrChar) >= ARRAY_SIZE(g_arrWorldScales) ); - STATIC_ASSERT ( ARRAY_SIZE(arrChar) >= ARRAY_SIZE(g_arrCountryScales) ); - ASSERT ( ind >= 0 && ind < ARRAY_SIZE(arrChar), (ind) ); + static_assert(ARRAY_SIZE(arrChar) >= ARRAY_SIZE(g_arrWorldScales), ""); + static_assert(ARRAY_SIZE(arrChar) >= ARRAY_SIZE(g_arrCountryScales), ""); + ASSERT(ind >= 0 && ind < ARRAY_SIZE(arrChar), (ind)); str += arrChar[ind]; return str; diff --git a/indexer/feature_meta.hpp b/indexer/feature_meta.hpp index 7761e6e383..2ac7ef1a79 100644 --- a/indexer/feature_meta.hpp +++ b/indexer/feature_meta.hpp @@ -6,7 +6,6 @@ #include "std/algorithm.hpp" #include "std/limits.hpp" #include "std/map.hpp" -#include "std/static_assert.hpp" #include "std/string.hpp" #include "std/vector.hpp" @@ -38,7 +37,7 @@ namespace feature FMD_COUNT }; - STATIC_ASSERT(FMD_COUNT <= 255); + static_assert(FMD_COUNT <= 255, "Meta types count is limited to one byte."); bool Add(EType type, string const & s) { diff --git a/indexer/interval_index.hpp b/indexer/interval_index.hpp index ab83cdc49c..1f6298a1a8 100644 --- a/indexer/interval_index.hpp +++ b/indexer/interval_index.hpp @@ -9,8 +9,6 @@ #include "base/assert.hpp" #include "base/buffer_vector.hpp" -#include "std/static_assert.hpp" - class IntervalIndexBase : public IntervalIndexIFace { @@ -24,7 +22,7 @@ public: uint8_t m_LeafBytes; }; #pragma pack(pop) - STATIC_ASSERT(sizeof(Header) == 4); + static_assert(sizeof(Header) == 4, ""); static inline uint32_t BitmapSize(uint32_t bitsPerLevel) { diff --git a/indexer/old/interval_index_101.hpp b/indexer/old/interval_index_101.hpp index 82b40d6361..438d2bae73 100644 --- a/indexer/old/interval_index_101.hpp +++ b/indexer/old/interval_index_101.hpp @@ -38,7 +38,7 @@ public: public: uint16_t m_Count[256]; }; - STATIC_ASSERT(sizeof(Index) == 2 * 258); + static_assert(sizeof(Index) == 2 * 258, ""); }; // TODO: IntervalIndex shouldn't do SwapIfBigEndian for ValueT. diff --git a/indexer/scale_index_builder.hpp b/indexer/scale_index_builder.hpp index 70474dcb35..345d2edcc7 100644 --- a/indexer/scale_index_builder.hpp +++ b/indexer/scale_index_builder.hpp @@ -49,9 +49,9 @@ private: uint32_t m_CellHi; uint32_t m_Feature; }; -STATIC_ASSERT(sizeof(CellFeaturePair) == 12); +static_assert(sizeof(CellFeaturePair) == 12, ""); #ifndef OMIM_OS_LINUX -STATIC_ASSERT(is_trivially_copyable<CellFeaturePair>::value); +static_assert(is_trivially_copyable<CellFeaturePair>::value, ""); #endif class CellFeatureBucketTuple @@ -76,9 +76,9 @@ private: CellFeaturePair m_pair; uint32_t m_bucket; }; -STATIC_ASSERT(sizeof(CellFeatureBucketTuple) == 16); +static_assert(sizeof(CellFeatureBucketTuple) == 16, ""); #ifndef OMIM_OS_LINUX -STATIC_ASSERT(is_trivially_copyable<CellFeatureBucketTuple>::value); +static_assert(is_trivially_copyable<CellFeatureBucketTuple>::value, ""); #endif template <class TSorter> diff --git a/map/address_finder.cpp b/map/address_finder.cpp index 33df804ad1..5497699283 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/platform/chunks_download_strategy.hpp b/platform/chunks_download_strategy.hpp index afd8d42d42..f97b94e783 100644 --- a/platform/chunks_download_strategy.hpp +++ b/platform/chunks_download_strategy.hpp @@ -4,7 +4,6 @@ #include "std/vector.hpp" #include "std/utility.hpp" #include "std/stdint.hpp" -#include "std/static_assert.hpp" namespace downloader @@ -27,8 +26,7 @@ private: ChunkT() : m_pos(-1), m_status(-1) { - // Be sure to avoid overhead in writing to file. - STATIC_ASSERT(sizeof(ChunkT) == 9); + static_assert(sizeof(ChunkT) == 9, "Be sure to avoid overhead in writing to file."); } ChunkT(int64_t pos, int8_t st) : m_pos(pos), m_status(st) {} }; diff --git a/platform/platform_tests/language_test.cpp b/platform/platform_tests/language_test.cpp index 8697f2f8f4..a8b8609dce 100644 --- a/platform/platform_tests/language_test.cpp +++ b/platform/platform_tests/language_test.cpp @@ -9,7 +9,7 @@ UNIT_TEST(LangNormalize_Smoke) { char const * arr1[] = { "en", "en-GB", "zh", "es-SP", "zh-penyn", "en-US", "ru_RU", "es" }; char const * arr2[] = { "en", "en", "zh", "es", "zh", "en", "ru", "es" }; - STATIC_ASSERT(ARRAY_SIZE(arr1) == ARRAY_SIZE(arr2)); + static_assert(ARRAY_SIZE(arr1) == ARRAY_SIZE(arr2), ""); for (size_t i = 0; i < ARRAY_SIZE(arr1); ++i) TEST_EQUAL(arr2[i], languages::Normalize(arr1[i]), ()); diff --git a/search/intermediate_result.cpp b/search/intermediate_result.cpp index 4b11c9e4fe..725413962b 100644 --- a/search/intermediate_result.cpp +++ b/search/intermediate_result.cpp @@ -155,7 +155,7 @@ namespace { "place", "continent" }, { "place", "country" } }; - STATIC_ASSERT ( m_count == ARRAY_SIZE(arr) ); + static_assert(m_count == ARRAY_SIZE(arr), ""); Classificator const & c = classif(); for (size_t i = 0; i < m_count; ++i) diff --git a/search/search_query.cpp b/search/search_query.cpp index 0cc3bd200a..fb86b0fa8c 100644 --- a/search/search_query.cpp +++ b/search/search_query.cpp @@ -88,11 +88,11 @@ 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) ); - STATIC_ASSERT ( QUEUES_COUNT == ARRAY_SIZE(g_arrCompare2) ); + static_assert(QUEUES_COUNT == ARRAY_SIZE(g_arrCompare1), ""); + static_assert(QUEUES_COUNT == ARRAY_SIZE(g_arrCompare2), ""); for (size_t i = 0; i < QUEUES_COUNT; ++i) { diff --git a/std/static_assert.hpp b/std/static_assert.hpp deleted file mode 100644 index a4a6e7e6b6..0000000000 --- a/std/static_assert.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#ifdef new -#undef new -#endif - -#include <boost/static_assert.hpp> -#define STATIC_ASSERT BOOST_STATIC_ASSERT - -#ifdef DEBUG_NEW -#define new DEBUG_NEW -#endif |