Removed 'tr1' [#METR-2807].

This commit is contained in:
Alexey Milovidov 2014-01-08 16:33:28 +00:00
parent 16ed91c728
commit 9c4043de67
15 changed files with 50 additions and 51 deletions

View File

@ -1,8 +1,8 @@
#pragma once
#include <vector>
#include <tr1/type_traits>
#include <tr1/functional>
#include <type_traits>
#include <functional>
#include <boost/static_assert.hpp>
@ -161,21 +161,21 @@ public:
template <typename T> T & get()
{
typedef typename std::tr1::remove_reference<T>::type TWithoutRef;
typedef typename std::remove_reference<T>::type TWithoutRef;
TWithoutRef * __attribute__((__may_alias__)) ptr = reinterpret_cast<TWithoutRef*>(storage);
return *ptr;
};
template <typename T> const T & get() const
{
typedef typename std::tr1::remove_reference<T>::type TWithoutRef;
typedef typename std::remove_reference<T>::type TWithoutRef;
const TWithoutRef * __attribute__((__may_alias__)) ptr = reinterpret_cast<const TWithoutRef*>(storage);
return *ptr;
};
template <typename T> T & safeGet()
{
const Types::Which requested = TypeToEnum<typename std::tr1::remove_cv<typename std::tr1::remove_reference<T>::type>::type>::value;
const Types::Which requested = TypeToEnum<typename std::remove_cv<typename std::remove_reference<T>::type>::type>::value;
if (which != requested)
throw Exception("Bad get: has " + std::string(getTypeName()) + ", requested " + std::string(Types::toString(requested)), ErrorCodes::BAD_GET);
return get<T>();
@ -183,7 +183,7 @@ public:
template <typename T> const T & safeGet() const
{
const Types::Which requested = TypeToEnum<typename std::tr1::remove_cv<typename std::tr1::remove_reference<T>::type>::type>::value;
const Types::Which requested = TypeToEnum<typename std::remove_cv<typename std::remove_reference<T>::type>::type>::value;
if (which != requested)
throw Exception("Bad get: has " + std::string(getTypeName()) + ", requested " + std::string(Types::toString(requested)), ErrorCodes::BAD_GET);
return get<T>();

View File

@ -6,7 +6,7 @@
#include <string>
#include <vector>
#include <tr1/functional>
#include <functional>
namespace DB
@ -73,15 +73,12 @@ namespace DB
namespace std
{
namespace tr1
template <>
struct hash<DB::StringRef>
{
template <>
struct hash<DB::StringRef>
size_t operator()(const DB::StringRef & x) const
{
size_t operator()(const DB::StringRef & x) const
{
return CityHash64(x.data, x.size);
}
};
}
return CityHash64(x.data, x.size);
}
};
}

View File

@ -122,7 +122,7 @@ inline void throwIfDivisionLeadsToFPE(A a, B b)
throw Exception("Division by zero", ErrorCodes::ILLEGAL_DIVISION);
/// http://avva.livejournal.com/2548306.html
if (unlikely(std::tr1::is_signed<A>::value && std::tr1::is_signed<B>::value && a == std::numeric_limits<A>::min() && b == -1))
if (unlikely(std::is_signed<A>::value && std::is_signed<B>::value && a == std::numeric_limits<A>::min() && b == -1))
throw Exception("Division of minimal signed number by minus one", ErrorCodes::ILLEGAL_DIVISION);
}

View File

@ -11,7 +11,7 @@
#include <DB/Interpreters/ClearableHashMap.h>
#include <DB/Interpreters/AggregationCommon.h>
#include <tr1/unordered_map>
#include <unordered_map>
namespace DB
@ -708,7 +708,7 @@ private:
const ColumnArray::Offsets_t & offsets = array->getOffsets();
size_t prev_off = 0;
typedef ClearableHashMap<StringRef, UInt32, std::tr1::hash<StringRef>, table_growth_traits> ValuesToIndices;
typedef ClearableHashMap<StringRef, UInt32, std::hash<StringRef>, table_growth_traits> ValuesToIndices;
ValuesToIndices indices;
for (size_t i = 0; i < offsets.size(); ++i)
{

View File

@ -4,7 +4,7 @@
#include <limits>
#include <algorithm>
#include <tr1/type_traits>
#include <type_traits>
#include <Yandex/Common.h>
#include <Yandex/DateLUT.h>
@ -139,7 +139,7 @@ void readIntText(T & x, ReadBuffer & buf)
case '+':
break;
case '-':
if (std::tr1::is_signed<T>::value)
if (std::is_signed<T>::value)
negative = true;
else
return;
@ -184,7 +184,7 @@ void readIntTextUnsafe(T & x, ReadBuffer & buf)
if (unlikely(buf.eof()))
throwReadAfterEOF();
if (std::tr1::is_signed<T>::value && *buf.position() == '-')
if (std::is_signed<T>::value && *buf.position() == '-')
{
++buf.position();
negative = true;
@ -210,7 +210,7 @@ void readIntTextUnsafe(T & x, ReadBuffer & buf)
break;
}
if (std::tr1::is_signed<T>::value && negative)
if (std::is_signed<T>::value && negative)
x = -x;
}
@ -622,7 +622,7 @@ static inline const char * tryReadIntText(T & x, const char * pos, const char *
case '+':
break;
case '-':
if (std::tr1::is_signed<T>::value)
if (std::is_signed<T>::value)
negative = true;
else
return pos;

View File

@ -1,7 +1,7 @@
#pragma once
#include <map>
#include <tr1/unordered_map>
#include <unordered_map>
#include <Poco/Mutex.h>

View File

@ -45,7 +45,7 @@ namespace DB
*/
/** Хэш функции, которые лучше чем тривиальная функция std::tr1::hash.
/** Хэш функции, которые лучше чем тривиальная функция std::hash.
* (при агрегации по идентификатору посетителя, прирост производительности более чем в 5 раз)
*/
template <typename T> struct default_hash;

View File

@ -1,7 +1,7 @@
#pragma once
#include <string.h>
#include <tr1/unordered_map>
#include <unordered_map>
#include <Poco/Timespan.h>
@ -129,7 +129,7 @@ public:
/// Ключ квоты -> квоты за интервалы. Если квота не допускает ключей, то накопленные значения хранятся по ключу 0.
struct Quota
{
typedef std::tr1::unordered_map<UInt64, QuotaForIntervals> Container;
typedef std::unordered_map<UInt64, QuotaForIntervals> Container;
String name;
@ -153,7 +153,7 @@ class Quotas
{
private:
/// Имя квоты -> квоты.
typedef std::tr1::unordered_map<String, SharedPtr<Quota> > Container;
typedef std::unordered_map<String, SharedPtr<Quota> > Container;
Container cont;
public:

View File

@ -12,7 +12,7 @@
#include <fstream>
#include <iomanip>
#include <tr1/unordered_set>
#include <unordered_set>
#include <boost/assign/list_inserter.hpp>
@ -129,10 +129,12 @@ class Client : public Poco::Util::Application
public:
Client() : is_interactive(true), stdin_is_not_tty(false), query_id(0),
format_max_block_size(0), std_in(STDIN_FILENO), std_out(STDOUT_FILENO), processed_rows(0),
rows_read_on_server(0), bytes_read_on_server(0), written_progress_chars(0), written_first_block(false) {}
rows_read_on_server(0), bytes_read_on_server(0), written_progress_chars(0), written_first_block(false)
{
}
private:
typedef std::tr1::unordered_set<String> StringSet;
typedef std::unordered_set<String> StringSet;
StringSet exit_strings;
bool is_interactive; /// Использовать readline интерфейс или batch режим.

View File

@ -1,7 +1,7 @@
#include <iostream>
#include <fstream>
#include <iomanip>
#include <tr1/unordered_map>
#include <unordered_map>
#include <sparsehash/dense_hash_map>
#include <statdaemons/Stopwatch.h>
@ -32,8 +32,8 @@ int main(int argc, char ** argv)
size_t elems_show = 1;
typedef std::vector<std::string> Vec;
typedef std::tr1::unordered_map<std::string, int> Set;
typedef std::tr1::unordered_map<DB::StringRef, int, DB::StringRefHash> RefsSet;
typedef std::unordered_map<std::string, int> Set;
typedef std::unordered_map<DB::StringRef, int, DB::StringRefHash> RefsSet;
typedef google::dense_hash_map<std::string, int> DenseSet;
typedef google::dense_hash_map<DB::StringRef, int, DB::StringRefHash> RefsDenseSet;
typedef DB::HashMap<DB::StringRef, int, DB::StringRefHash, StringRefZeroTraits> RefsHashMap;
@ -86,7 +86,7 @@ int main(int argc, char ** argv)
for (Vec::iterator it = vec.begin(); it != vec.end(); ++it)
set[*it] = 0;
std::cerr << "Inserted into std::tr1::unordered_map in " << watch.elapsedSeconds() << " sec, "
std::cerr << "Inserted into std::unordered_map in " << watch.elapsedSeconds() << " sec, "
<< vec.size() / watch.elapsedSeconds() << " rows/sec., "
<< in.count() / watch.elapsedSeconds() / 1000000 << " MB/sec."
<< std::endl;
@ -106,7 +106,7 @@ int main(int argc, char ** argv)
for (Vec::iterator it = vec.begin(); it != vec.end(); ++it)
set[DB::StringRef(*it)] = 0;
std::cerr << "Inserted refs into std::tr1::unordered_map in " << watch.elapsedSeconds() << " sec, "
std::cerr << "Inserted refs into std::unordered_map in " << watch.elapsedSeconds() << " sec, "
<< vec.size() / watch.elapsedSeconds() << " rows/sec., "
<< in.count() / watch.elapsedSeconds() / 1000000 << " MB/sec."
<< std::endl;
@ -127,7 +127,7 @@ int main(int argc, char ** argv)
for (Vec::iterator it = vec.begin(); it != vec.end(); ++it)
set[DB::StringRef(pool.insert(it->data(), it->size()), it->size())] = 0;
std::cerr << "Inserted into pool and refs into std::tr1::unordered_map in " << watch.elapsedSeconds() << " sec, "
std::cerr << "Inserted into pool and refs into std::unordered_map in " << watch.elapsedSeconds() << " sec, "
<< vec.size() / watch.elapsedSeconds() << " rows/sec., "
<< in.count() / watch.elapsedSeconds() / 1000000 << " MB/sec."
<< std::endl;

View File

@ -15,7 +15,7 @@ static void numWidthVector(const PODArray<T> & a, PODArray<UInt64> & c)
for (size_t i = 0; i < size; ++i)
if (a[i] >= 0)
c[i] = a[i] ? 1 + log10(a[i]) : 1;
else if (std::tr1::is_signed<T>::value && a[i] == std::numeric_limits<T>::min())
else if (std::is_signed<T>::value && a[i] == std::numeric_limits<T>::min())
c[i] = 2 + log10(std::numeric_limits<T>::max());
else
c[i] = 2 + log10(-a[i]);
@ -26,7 +26,7 @@ static void numWidthConstant(T a, UInt64 & c)
{
if (a >= 0)
c = a ? 1 + log10(a) : 1;
else if (std::tr1::is_signed<T>::value && a == std::numeric_limits<T>::min())
else if (std::is_signed<T>::value && a == std::numeric_limits<T>::min())
c = 2 + log10(std::numeric_limits<T>::max());
else
c = 2 + log10(-a);

View File

@ -34,7 +34,7 @@ namespace test
if (unlikely(buf.eof()))
DB::throwReadAfterEOF();
if (std::tr1::is_signed<T>::value && *buf.position() == '-')
if (std::is_signed<T>::value && *buf.position() == '-')
{
++buf.position();
negative = true;
@ -58,7 +58,7 @@ namespace test
break;
}
if (std::tr1::is_signed<T>::value && negative)
if (std::is_signed<T>::value && negative)
x = -x;
}
}

View File

@ -2,7 +2,7 @@
#include <iomanip>
#include <vector>
#include <tr1/unordered_map>
#include <unordered_map>
#include <sparsehash/dense_hash_map>
#include <sparsehash/sparse_hash_map>
@ -151,8 +151,8 @@ int main(int argc, char ** argv)
{
Stopwatch watch;
std::tr1::unordered_map<Key, Value, DB::default_hash<Key> > map;
std::tr1::unordered_map<Key, Value, DB::default_hash<Key> >::iterator it;
std::unordered_map<Key, Value, DB::default_hash<Key> > map;
std::unordered_map<Key, Value, DB::default_hash<Key> >::iterator it;
for (size_t i = 0; i < n; ++i)
{
it = map.insert(std::make_pair(data[i], value)).first;
@ -161,7 +161,7 @@ int main(int argc, char ** argv)
watch.stop();
std::cerr << std::fixed << std::setprecision(2)
<< "std::tr1::unordered_map. Size: " << map.size()
<< "std::unordered_map. Size: " << map.size()
<< ", elapsed: " << watch.elapsedSeconds()
<< " (" << n / watch.elapsedSeconds() << " elem/sec.)"
<< std::endl;

View File

@ -2,7 +2,7 @@
#include <iomanip>
#include <vector>
#include <tr1/unordered_map>
#include <unordered_map>
#include <sparsehash/dense_hash_map>
#include <sparsehash/sparse_hash_map>
@ -71,13 +71,13 @@ int main(int argc, char ** argv)
{
Stopwatch watch;
std::tr1::unordered_map<Key, Value, DB::default_hash<Key> > map;
std::unordered_map<Key, Value, DB::default_hash<Key> > map;
for (size_t i = 0; i < n; ++i)
++map[data[i]];
watch.stop();
std::cerr << std::fixed << std::setprecision(2)
<< "std::tr1::unordered_map. Size: " << map.size()
<< "std::unordered_map. Size: " << map.size()
<< ", elapsed: " << watch.elapsedSeconds()
<< " (" << n / watch.elapsedSeconds() << " elem/sec.)"
<< std::endl;

View File

@ -113,7 +113,7 @@ void IStorage::check(const Block & block, bool need_all) const
const NamesAndTypesList & available_columns = getColumnsList();
const NamesAndTypesMap & columns_map = getColumnsMap(available_columns);
typedef std::tr1::unordered_set<String> NameSet;
typedef std::unordered_set<String> NameSet;
NameSet names_in_block;
for (size_t i = 0; i < block.columns(); ++i)