diff options
author | Geir Storli <geirst@yahooinc.com> | 2022-12-21 15:48:56 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahooinc.com> | 2022-12-21 15:49:53 +0000 |
commit | 13c416cd71b9927b60cc5ea4c9bcecafe472e8c9 (patch) | |
tree | f965e2c92278d3c38dd9fafe70873893e36df263 /vespalib | |
parent | 40add664cca86e6c1591b9503b6ce7f568874388 (diff) |
Change from typedef to using in vespalib C++ code.
Diffstat (limited to 'vespalib')
77 files changed, 540 insertions, 557 deletions
diff --git a/vespalib/src/tests/array/sort_benchmark.cpp b/vespalib/src/tests/array/sort_benchmark.cpp index 5d8a1efaa7a..85b75857937 100644 --- a/vespalib/src/tests/array/sort_benchmark.cpp +++ b/vespalib/src/tests/array/sort_benchmark.cpp @@ -102,7 +102,7 @@ Test::Main() TEST_INIT("sort_benchmark"); steady_time start(steady_clock::now()); if (payLoad < 8) { - typedef TT<8> T; + using T = TT<8>; if (type == "sortdirect") { sortDirect<T>(count); } else if (type == "sortindirect") { @@ -111,7 +111,7 @@ Test::Main() LOG(warning, "type '%s' is unknown", type.c_str()); } } else if (payLoad < 16) { - typedef TT<16> T; + using T = TT<16>; if (type == "sortdirect") { sortDirect<T>(count); } else if (type == "sortindirect") { @@ -120,7 +120,7 @@ Test::Main() LOG(warning, "type '%s' is unknown", type.c_str()); } } else if (payLoad < 32) { - typedef TT<32> T; + using T = TT<32>; if (type == "sortdirect") { sortDirect<T>(count); } else if (type == "sortindirect") { @@ -129,7 +129,7 @@ Test::Main() LOG(warning, "type '%s' is unknown", type.c_str()); } } else if (payLoad < 64) { - typedef TT<64> T; + using T = TT<64>; if (type == "sortdirect") { sortDirect<T>(count); } else if (type == "sortindirect") { @@ -138,7 +138,7 @@ Test::Main() LOG(warning, "type '%s' is unknown", type.c_str()); } } else if (payLoad < 128) { - typedef TT<128> T; + using T = TT<128>; if (type == "sortdirect") { sortDirect<T>(count); } else if (type == "sortindirect") { @@ -147,7 +147,7 @@ Test::Main() LOG(warning, "type '%s' is unknown", type.c_str()); } } else if (payLoad < 256) { - typedef TT<256> T; + using T = TT<256>; if (type == "sortdirect") { sortDirect<T>(count); } else if (type == "sortindirect") { @@ -156,7 +156,7 @@ Test::Main() LOG(warning, "type '%s' is unknown", type.c_str()); } } else if (payLoad < 512) { - typedef TT<512> T; + using T = TT<512>; if (type == "sortdirect") { sortDirect<T>(count); } else if (type == "sortindirect") { @@ -165,7 +165,7 @@ Test::Main() LOG(warning, "type '%s' is unknown", type.c_str()); } } else { - typedef TT<1024> T; + using T = TT<1024>; LOG(info, "Payload %ld is too big to make any sense. Using %ld.", payLoad, sizeof(T)); if (type == "sortdirect") { sortDirect<T>(count); diff --git a/vespalib/src/tests/arrayqueue/arrayqueue.cpp b/vespalib/src/tests/arrayqueue/arrayqueue.cpp index ff957bd60f4..95ec92d5879 100644 --- a/vespalib/src/tests/arrayqueue/arrayqueue.cpp +++ b/vespalib/src/tests/arrayqueue/arrayqueue.cpp @@ -52,21 +52,21 @@ struct FunkyItem { }; struct Copy { - typedef ArrayQueue<Int> Q; + using Q = ArrayQueue<Int>; static void push(Q &q, int v) { Int value(v); q.push(value); } static void pushFront(Q &q, int v) { Int value(v); q.pushFront(value); } static void set(Q &q, int idx, int val) { q.access(idx) = val; } }; struct Move { - typedef ArrayQueue<std::unique_ptr<Int> > Q; + using Q = ArrayQueue<std::unique_ptr<Int> >; static void push(Q &q, int v) { q.push(std::unique_ptr<Int>(new Int(v))); } static void pushFront(Q &q, int v) { q.pushFront(std::unique_ptr<Int>(new Int(v))); } static void set(Q &q, int idx, int val) { *q.access(idx) = val; } }; struct Emplace { - typedef ArrayQueue<FunkyItem> Q; + using Q = ArrayQueue<FunkyItem>; static void push(Q &q, int v) { q.emplace(v, v); } static void pushFront(Q &q, int v) { q.emplaceFront(v, v); } static void set(Q &q, int idx, int val) { @@ -199,7 +199,7 @@ template <typename T> void subTestCopy() { TEST_ERROR("undefined"); } template <> void subTestCopy<Emplace>() {} template <> void subTestCopy<Move>() {} template <> void subTestCopy<Copy>() { - typedef Copy T; + using T = Copy; { // copy construct queue T::Q q1; T::push(q1, 1); diff --git a/vespalib/src/tests/benchmark/testbase.h b/vespalib/src/tests/benchmark/testbase.h index 95621f52471..f90b8d1aef0 100644 --- a/vespalib/src/tests/benchmark/testbase.h +++ b/vespalib/src/tests/benchmark/testbase.h @@ -43,7 +43,7 @@ class ParamByReferenceVectorInt : public Benchmark public: DECLARE_BENCHMARK(ParamByReferenceVectorInt); private: - typedef std::vector<int> Vector; + using Vector = std::vector<int>; size_t callByReference(const Vector & values) const __attribute__((noinline)); size_t onRun() override; }; @@ -53,7 +53,7 @@ class ParamByValueVectorInt : public Benchmark public: DECLARE_BENCHMARK(ParamByValueVectorInt); private: - typedef std::vector<int> Vector; + using Vector = std::vector<int>; size_t callByValue(Vector values) const __attribute__((noinline)); size_t onRun() override; }; @@ -63,7 +63,7 @@ class ParamByReferenceVectorString : public Benchmark public: DECLARE_BENCHMARK(ParamByReferenceVectorString); private: - typedef std::vector<std::string> Vector; + using Vector = std::vector<std::string>; size_t callByReference(const Vector & values) const __attribute__((noinline)); size_t onRun() override; }; @@ -73,7 +73,7 @@ class ParamByValueVectorString : public Benchmark public: DECLARE_BENCHMARK(ParamByValueVectorString); private: - typedef std::vector<std::string> Vector; + using Vector = std::vector<std::string>; size_t callByValue(Vector values) const __attribute__((noinline)); size_t onRun() override; }; @@ -83,7 +83,7 @@ class ReturnByReferenceVectorString : public Benchmark public: DECLARE_BENCHMARK(ReturnByReferenceVectorString); private: - typedef std::vector<std::string> Vector; + using Vector = std::vector<std::string>; const Vector & returnByReference(Vector & values) const __attribute__((noinline)); size_t onRun() override; }; @@ -93,7 +93,7 @@ class ReturnByValueVectorString : public Benchmark public: DECLARE_BENCHMARK(ReturnByValueVectorString); private: - typedef std::vector<std::string> Vector; + using Vector = std::vector<std::string>; Vector returnByValue() const __attribute__((noinline)); size_t onRun() override; }; @@ -103,7 +103,7 @@ class ReturnByValueMultiVectorString : public Benchmark public: DECLARE_BENCHMARK(ReturnByValueMultiVectorString); private: - typedef std::vector<std::string> Vector; + using Vector = std::vector<std::string>; Vector returnByValue() const __attribute__((noinline)); size_t onRun() override; }; diff --git a/vespalib/src/tests/btree/btree_test.cpp b/vespalib/src/tests/btree/btree_test.cpp index f2896cb783c..2a465f2c60a 100644 --- a/vespalib/src/tests/btree/btree_test.cpp +++ b/vespalib/src/tests/btree/btree_test.cpp @@ -91,7 +91,7 @@ void validate_subrange(Iterator &start, Iterator &end, SequenceValidator &valida } -typedef BTreeTraits<4, 4, 31, false> MyTraits; +using MyTraits = BTreeTraits<4, 4, 31, false>; #define KEYWRAP @@ -114,7 +114,7 @@ operator<<(std::ostream &s, const WrapInt &i) return s; } -typedef WrapInt MyKey; +using MyKey = WrapInt; class MyComp { public: @@ -127,8 +127,8 @@ public: #define UNWRAP(key) (key._val) #else -typedef int MyKey; -typedef std::less<int> MyComp; +using MyKey = int; +using MyComp = std::less<int>; #define UNWRAP(key) (key) #endif @@ -138,17 +138,17 @@ typedef BTree<MyKey, std::string, typedef BTreeStore<MyKey, std::string, btree::NoAggregated, MyComp, MyTraits> MyTreeStore; -typedef MyTree::Builder MyTreeBuilder; -typedef MyTree::LeafNodeType MyLeafNode; -typedef MyTree::InternalNodeType MyInternalNode; -typedef MyTree::NodeAllocatorType MyNodeAllocator; -typedef std::pair<MyKey, std::string> LeafPair; -typedef MyTreeStore::KeyDataType MyKeyData; -typedef MyTreeStore::KeyDataTypeRefPair MyKeyDataRefPair; +using MyTreeBuilder = MyTree::Builder; +using MyLeafNode = MyTree::LeafNodeType; +using MyInternalNode = MyTree::InternalNodeType; +using MyNodeAllocator = MyTree::NodeAllocatorType; +using LeafPair = std::pair<MyKey, std::string>; +using MyKeyData = MyTreeStore::KeyDataType; +using MyKeyDataRefPair = MyTreeStore::KeyDataTypeRefPair; -typedef BTree<int, BTreeNoLeafData, btree::NoAggregated> SetTreeB; +using SetTreeB = BTree<int, BTreeNoLeafData, btree::NoAggregated>; -typedef BTreeTraits<16, 16, 10, false> LSeekTraits; +using LSeekTraits = BTreeTraits<16, 16, 10, false>; typedef BTree<int, BTreeNoLeafData, btree::NoAggregated, std::less<int>, LSeekTraits> SetTreeL; @@ -1067,10 +1067,10 @@ TEST_F(BTreeTest, require_that_memory_usage_is_calculated) typedef BTreeNodeAllocator<int32_t, int8_t, btree::NoAggregated, MyTraits::INTERNAL_SLOTS, MyTraits::LEAF_SLOTS> NodeAllocator; - typedef NodeAllocator::InternalNodeType INode; - typedef NodeAllocator::LeafNodeType LNode; - typedef NodeAllocator::InternalNodeTypeRefPair IRef; - typedef NodeAllocator::LeafNodeTypeRefPair LRef; + using INode = NodeAllocator::InternalNodeType; + using LNode = NodeAllocator::LeafNodeType; + using IRef = NodeAllocator::InternalNodeTypeRefPair; + using LRef = NodeAllocator::LeafNodeTypeRefPair; LOG(info, "sizeof(BTreeNode)=%zu, sizeof(INode)=%zu, sizeof(LNode)=%zu", sizeof(BTreeNode), sizeof(INode), sizeof(LNode)); EXPECT_GT(sizeof(INode), sizeof(LNode)); @@ -1194,7 +1194,7 @@ TEST_F(BTreeTest, require_that_update_of_key_works) typedef BTree<int, BTreeNoLeafData, btree::NoAggregated, UpdKeyComp &> UpdKeyTree; - typedef UpdKeyTree::Iterator UpdKeyTreeIterator; + using UpdKeyTreeIterator = UpdKeyTree::Iterator; GenerationHandler g; UpdKeyTree t; UpdKeyComp cmp1(0); @@ -1309,8 +1309,8 @@ TEST_F(BTreeTest, require_that_apply_works) { typedef BTreeStore<MyKey, std::string, btree::NoAggregated, MyComp, BTreeDefaultTraits> TreeStore; - typedef TreeStore::KeyType KeyType; - typedef TreeStore::KeyDataType KeyDataType; + using KeyType = TreeStore::KeyType; + using KeyDataType = TreeStore::KeyDataType; GenerationHandler g; TreeStore s; std::vector<KeyDataType> additions; @@ -1438,7 +1438,7 @@ BTreeTest::requireThatIteratorDistanceWorks(int numEntries) { GenerationHandler g; MyTree tree; - typedef MyTree::Iterator Iterator; + using Iterator = MyTree::Iterator; for (int i = 0; i < numEntries; ++i) { tree.insert(i, toStr(i)); } diff --git a/vespalib/src/tests/btree/btreeaggregation_test.cpp b/vespalib/src/tests/btree/btreeaggregation_test.cpp index fb394df9861..2b907bf096b 100644 --- a/vespalib/src/tests/btree/btreeaggregation_test.cpp +++ b/vespalib/src/tests/btree/btreeaggregation_test.cpp @@ -62,7 +62,7 @@ toNotVal(uint32_t key) } -typedef BTreeTraits<4, 4, 31, false> MyTraits; +using MyTraits = BTreeTraits<4, 4, 31, false>; #define KEYWRAP @@ -85,7 +85,7 @@ operator<<(std::ostream &s, const WrapInt &i) return s; } -typedef WrapInt MyKey; +using MyKey = WrapInt; class MyComp { public: @@ -98,8 +98,8 @@ public: #define UNWRAP(key) (key._val) #else -typedef int MyKey; -typedef std::less<int> MyComp; +using MyKey = int; +using MyComp = std::less<int>; #define UNWRAP(key) (key) #endif @@ -117,19 +117,19 @@ typedef BTreeStore<MyKey, int32_t, MyComp, BTreeDefaultTraits, MinMaxAggrCalc> MyTreeStore; -typedef MyTree::Builder MyTreeBuilder; -typedef MyTree::LeafNodeType MyLeafNode; -typedef MyTree::InternalNodeType MyInternalNode; -typedef MyTree::NodeAllocatorType MyNodeAllocator; -typedef MyTree::Builder::Aggregator MyAggregator; -typedef MyTree::AggrCalcType MyAggrCalc; -typedef std::pair<MyKey, int32_t> LeafPair; -typedef MyTreeStore::KeyDataType MyKeyData; -typedef MyTreeStore::KeyDataTypeRefPair MyKeyDataRefPair; - -typedef BTree<int, BTreeNoLeafData, btree::NoAggregated> SetTreeB; - -typedef BTreeTraits<16, 16, 10, false> LSeekTraits; +using MyTreeBuilder = MyTree::Builder; +using MyLeafNode = MyTree::LeafNodeType; +using MyInternalNode = MyTree::InternalNodeType; +using MyNodeAllocator = MyTree::NodeAllocatorType; +using MyAggregator = MyTree::Builder::Aggregator; +using MyAggrCalc = MyTree::AggrCalcType; +using LeafPair = std::pair<MyKey, int32_t>; +using MyKeyData = MyTreeStore::KeyDataType; +using MyKeyDataRefPair = MyTreeStore::KeyDataTypeRefPair; + +using SetTreeB = BTree<int, BTreeNoLeafData, btree::NoAggregated>; + +using LSeekTraits = BTreeTraits<16, 16, 10, false>; typedef BTree<int, BTreeNoLeafData, btree::NoAggregated, std::less<int>, LSeekTraits> SetTreeL; @@ -144,8 +144,8 @@ using MyKeyAggrTree = BTree<MyKey, int32_t, btree::MinMaxAggregated, MyComp, MyT class MockTree { public: - typedef std::map<uint32_t, int32_t> MTree; - typedef std::map<int32_t, std::set<uint32_t> > MRTree; + using MTree = std::map<uint32_t, int32_t>; + using MRTree = std::map<int32_t, std::set<uint32_t> >; MTree _tree; MRTree _rtree; @@ -190,7 +190,7 @@ MockTree::~MockTree() {} class MyTreeForceApplyStore : public MyTreeStore { public: - typedef MyComp CompareT; + using CompareT = MyComp; bool insert(EntryRef &ref, const KeyType &key, const DataType &data, @@ -1055,7 +1055,6 @@ Test::requireThatUpdateOfKeyWorks() void Test::requireThatUpdateOfDataWorks() { - // typedef MyTree::Iterator Iterator; GenerationHandler g; MyTree t; MockTree mock; diff --git a/vespalib/src/tests/btree/frozenbtree_test.cpp b/vespalib/src/tests/btree/frozenbtree_test.cpp index 3471d5dc3df..3a9b1c8fb12 100644 --- a/vespalib/src/tests/btree/frozenbtree_test.cpp +++ b/vespalib/src/tests/btree/frozenbtree_test.cpp @@ -27,22 +27,22 @@ namespace vespalib { class FrozenBTreeTest : public vespalib::TestApp { public: - typedef int KeyType; + using KeyType = int; private: std::vector<KeyType> _randomValues; std::vector<KeyType> _sortedRandomValues; public: - typedef int DataType; + using DataType = int; typedef BTreeRoot<KeyType, DataType, btree::NoAggregated, std::less<KeyType>, BTreeDefaultTraits> Tree; - typedef Tree::NodeAllocatorType NodeAllocator; - typedef Tree::InternalNodeType InternalNodeType; - typedef Tree::LeafNodeType LeafNodeType; - typedef Tree::Iterator Iterator; - typedef Tree::ConstIterator ConstIterator; + using NodeAllocator = Tree::NodeAllocatorType; + using InternalNodeType = Tree::InternalNodeType; + using LeafNodeType = Tree::LeafNodeType; + using Iterator = Tree::Iterator; + using ConstIterator = Tree::ConstIterator; private: GenerationHandler *_generationHandler; NodeAllocator *_allocator; @@ -360,9 +360,8 @@ printSubEnumTree(BTreeNode::Ref node, NodeAllocator &allocator, int indent) const { - // typedef BTreeNode Node; - typedef LeafNodeType LeafNode; - typedef InternalNodeType InternalNode; + using LeafNode = LeafNodeType; + using InternalNode = InternalNodeType; BTreeNode::Ref subNode; unsigned int i; diff --git a/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp b/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp index 51380028ffa..653ed9eb169 100644 --- a/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp +++ b/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp @@ -112,7 +112,7 @@ std::function<void(int64_t)> use_sum = [](int64_t) noexcept { }; class UnorderedSparseBenchmark : public SparseBenchmark { private: - typedef hash_map<uint32_t, int32_t> map; + using map = hash_map<uint32_t, int32_t>; public: UnorderedSparseBenchmark(size_t numDocs, size_t numValues, size_t numQueryValues); ~UnorderedSparseBenchmark(); diff --git a/vespalib/src/tests/executor/threadstackexecutor_test.cpp b/vespalib/src/tests/executor/threadstackexecutor_test.cpp index 7d77e224fe5..ad412bac3d2 100644 --- a/vespalib/src/tests/executor/threadstackexecutor_test.cpp +++ b/vespalib/src/tests/executor/threadstackexecutor_test.cpp @@ -9,7 +9,7 @@ using namespace vespalib; -typedef Executor::Task Task; +using Task = Executor::Task; struct MyTask : public Executor::Task { Gate &gate; diff --git a/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp b/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp index b8e0b36ae01..4641d1bcbaf 100644 --- a/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp +++ b/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp @@ -199,7 +199,7 @@ void Loops<H>::fiddle(T *begin, T *end, C cmp, T *first, T *last) { //----------------------------------------------------------------------------- struct Benchmark { - typedef std::unique_ptr<Benchmark> UP; + using UP = std::unique_ptr<Benchmark>; virtual ~Benchmark() {} virtual std::string legend() const = 0; virtual double fiddle(size_t heapSize, size_t cnt, size_t loop, bool adjust) = 0; diff --git a/vespalib/src/tests/left_right_heap/left_right_heap_test.cpp b/vespalib/src/tests/left_right_heap/left_right_heap_test.cpp index 26997ce2147..e7ab47e1c9f 100644 --- a/vespalib/src/tests/left_right_heap/left_right_heap_test.cpp +++ b/vespalib/src/tests/left_right_heap/left_right_heap_test.cpp @@ -10,7 +10,7 @@ using namespace vespalib; //----------------------------------------------------------------------------- -typedef std::unique_ptr<int> int_up; +using int_up = std::unique_ptr<int>; template <typename T> T wrap(int value); template <> int wrap<int>(int value) { return value; } @@ -70,7 +70,7 @@ struct Input { template <typename Heap, typename Value = int, typename Cmp = CmpInt> struct Setup { - typedef Setup<Heap, int_up, CmpIntUp> IUP; + using IUP = Setup<Heap, int_up, CmpIntUp>; Input &input; std::vector<Value> data; Cmp cmp; diff --git a/vespalib/src/tests/objects/objectselection/objectselection.cpp b/vespalib/src/tests/objects/objectselection/objectselection.cpp index aa9c841f2dc..d94e256c4cd 100644 --- a/vespalib/src/tests/objects/objectselection/objectselection.cpp +++ b/vespalib/src/tests/objects/objectselection/objectselection.cpp @@ -12,7 +12,7 @@ using namespace vespalib; struct Foo : public Identifiable { - typedef IdentifiablePtr<Foo> CP; + using CP = IdentifiablePtr<Foo>; std::vector<CP> nodes; DECLARE_IDENTIFIABLE(Foo); diff --git a/vespalib/src/tests/priority_queue/priority_queue_test.cpp b/vespalib/src/tests/priority_queue/priority_queue_test.cpp index 444ab55947c..2fe08cedd20 100644 --- a/vespalib/src/tests/priority_queue/priority_queue_test.cpp +++ b/vespalib/src/tests/priority_queue/priority_queue_test.cpp @@ -122,7 +122,7 @@ TEST("require that the heap algorithm can be changed") { } } -typedef std::unique_ptr<int> int_up; +using int_up = std::unique_ptr<int>; int_up wrap(int value) { return int_up(new int(value)); } struct CmpIntUp { bool operator()(const int_up &a, const int_up &b) const { diff --git a/vespalib/src/tests/sharedptr/ptrholder.cpp b/vespalib/src/tests/sharedptr/ptrholder.cpp index c1436efa6b4..b646148317e 100644 --- a/vespalib/src/tests/sharedptr/ptrholder.cpp +++ b/vespalib/src/tests/sharedptr/ptrholder.cpp @@ -35,8 +35,8 @@ public: int getCtorCnt() const { return _d.ctorCnt; } int getDtorCnt() const { return _d.dtorCnt; } }; -typedef std::shared_ptr<DataRef> PT; -typedef PtrHolder<DataRef> HOLD; +using PT = std::shared_ptr<DataRef>; +using HOLD = PtrHolder<DataRef>; void diff --git a/vespalib/src/tests/slime/type_traits.h b/vespalib/src/tests/slime/type_traits.h index c5729478efb..dd5007ed651 100644 --- a/vespalib/src/tests/slime/type_traits.h +++ b/vespalib/src/tests/slime/type_traits.h @@ -16,30 +16,30 @@ template<> struct TypeTraits<NIX> { }; template<> struct TypeTraits<BOOL> { - typedef bool PassType; - typedef PassType StoreType; + using PassType = bool; + using StoreType = PassType; static const bool unsetValue = false; }; template<> struct TypeTraits<LONG> { - typedef int64_t PassType; - typedef PassType StoreType; + using PassType = int64_t; + using StoreType = PassType; static const int64_t unsetValue = 0; }; template<> struct TypeTraits<DOUBLE> { - typedef double PassType; - typedef PassType StoreType; + using PassType = double; + using StoreType = PassType; static const double unsetValue; }; template<> struct TypeTraits<STRING> { - typedef Memory PassType; + using PassType = Memory; static const Memory unsetValue; }; template<> struct TypeTraits<DATA> { - typedef Memory PassType; + using PassType = Memory; static const Memory unsetValue; }; diff --git a/vespalib/src/tests/stash/stash.cpp b/vespalib/src/tests/stash/stash.cpp index e8f49528d65..74fd7c2126e 100644 --- a/vespalib/src/tests/stash/stash.cpp +++ b/vespalib/src/tests/stash/stash.cpp @@ -37,8 +37,8 @@ struct Object { } }; -typedef Object<8> SmallObject; -typedef Object<10000> LargeObject; +using SmallObject = Object<8>; +using LargeObject = Object<10000>; struct Small : SmallObject { Small(size_t &dref) : SmallObject(dref) {} diff --git a/vespalib/src/tests/stllike/cache_test.cpp b/vespalib/src/tests/stllike/cache_test.cpp index 35f04d91510..358a3591dbf 100644 --- a/vespalib/src/tests/stllike/cache_test.cpp +++ b/vespalib/src/tests/stllike/cache_test.cpp @@ -9,8 +9,8 @@ using namespace vespalib; template<typename K, typename V> class Map : public std::map<K, V> { - typedef typename std::map<K, V>::const_iterator const_iterator; - typedef std::map<K, V> M; + using const_iterator = typename std::map<K, V>::const_iterator; + using M = std::map<K, V>; public: bool read(const K & k, V & v) const { const_iterator found = M::find(k); diff --git a/vespalib/src/tests/stllike/hash_test.cpp b/vespalib/src/tests/stllike/hash_test.cpp index c530bbdb14a..ae27d2dc58b 100644 --- a/vespalib/src/tests/stllike/hash_test.cpp +++ b/vespalib/src/tests/stllike/hash_test.cpp @@ -390,9 +390,9 @@ struct equal_types<T0, T0> { TEST("test hash set iterators stl compatible") { - typedef vespalib::hash_set<int> set_type; - typedef set_type::iterator iter_type; - typedef std::iterator_traits<iter_type> iter_traits; + using set_type = vespalib::hash_set<int>; + using iter_type = set_type::iterator; + using iter_traits = std::iterator_traits<iter_type>; set_type set; set.insert(123); @@ -417,8 +417,8 @@ TEST("test hash set iterators stl compatible") EXPECT_TRUE((equal_types<iter_traits::pointer, int*>::value)); EXPECT_TRUE((equal_types<iter_traits::iterator_category, std::forward_iterator_tag>::value)); - typedef set_type::const_iterator const_iter_type; - typedef std::iterator_traits<const_iter_type> const_iter_traits; + using const_iter_type = set_type::const_iterator; + using const_iter_traits = std::iterator_traits<const_iter_type>; EXPECT_TRUE((equal_types<const_iter_traits::difference_type, ptrdiff_t>::value)); EXPECT_TRUE((equal_types<const_iter_traits::value_type, const int>::value)); EXPECT_TRUE((equal_types<const_iter_traits::reference, const int&>::value)); diff --git a/vespalib/src/tests/stllike/hashtable_test.cpp b/vespalib/src/tests/stllike/hashtable_test.cpp index ccb1136729e..972ae43b1fa 100644 --- a/vespalib/src/tests/stllike/hashtable_test.cpp +++ b/vespalib/src/tests/stllike/hashtable_test.cpp @@ -28,7 +28,7 @@ template<typename K> using up_hashtable = TEST("require that hashtable can store unique_ptrs") { up_hashtable<int> table(100); - typedef std::unique_ptr<int> UP; + using UP = std::unique_ptr<int>; table.insert(UP(new int(42))); auto it = table.find(42); EXPECT_EQUAL(42, **it); diff --git a/vespalib/src/tests/stllike/lrucache.cpp b/vespalib/src/tests/stllike/lrucache.cpp index 2cc6f2b4ee8..bde42526c48 100644 --- a/vespalib/src/tests/stllike/lrucache.cpp +++ b/vespalib/src/tests/stllike/lrucache.cpp @@ -87,8 +87,8 @@ TEST("testCache") { EXPECT_TRUE(!cache.hasKey(3)); } -typedef std::shared_ptr<std::string> MyKey; -typedef std::shared_ptr<std::string> MyData; +using MyKey = std::shared_ptr<std::string>; +using MyData = std::shared_ptr<std::string>; struct SharedEqual { bool operator()(const MyKey & a, const MyKey & b) { @@ -134,7 +134,7 @@ TEST("testCacheErase") { } TEST("testCacheIterator") { - typedef lrucache_map< LruParam<int, string> > Cache; + using Cache = lrucache_map< LruParam<int, string> >; Cache cache(3); cache.insert(1, "first"); cache.insert(2, "second"); @@ -170,7 +170,7 @@ TEST("testCacheIterator") { } TEST("testCacheIteratorErase") { - typedef lrucache_map< LruParam<int, string> > Cache; + using Cache = lrucache_map< LruParam<int, string> >; Cache cache(3); cache.insert(1, "first"); cache.insert(8, "second"); diff --git a/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp b/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp index 7b9dfc98fa5..77da1693317 100644 --- a/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp +++ b/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp @@ -14,17 +14,17 @@ template <typename T> class RoundRobinAllocator { public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef T * pointer; - typedef const T * const_pointer; - typedef T & reference; - typedef const T & const_reference; - typedef T value_type; + using size_type = size_t; + using difference_type = ptrdiff_t; + using pointer = T *; + using const_pointer = const T *; + using reference = T &; + using const_reference = const T &; + using value_type = T; template<typename _Tp1> struct rebind { - typedef RoundRobinAllocator<_Tp1> other; + using other = RoundRobinAllocator<_Tp1>; }; RoundRobinAllocator() { } template<typename _Tp1> @@ -101,7 +101,7 @@ struct IndirectCmp { size_t benchMap(const std::vector<Slot *> & v) { size_t uniq(0); - typedef std::set<Gid> M; + using M = std::set<Gid>; M set; for(size_t i(0), m(v.size()); i < m; i++) { const Slot & s = *v[i]; @@ -116,7 +116,7 @@ size_t benchMap(const std::vector<Slot *> & v) size_t benchMapIntelligent(const std::vector<Slot *> & v) { size_t uniq(0); - typedef std::set<Gid> M; + using M = std::set<Gid>; M set; for(size_t i(0), m(v.size()); i < m; i++) { const Slot & s = *v[i]; @@ -131,7 +131,7 @@ size_t benchMapIntelligent(const std::vector<Slot *> & v) size_t benchHashStl(const std::vector<Slot *> & v) { size_t uniq(0); - typedef std::unordered_set< Gid, Gid::hash > M; + using M = std::unordered_set< Gid, Gid::hash >; M set(v.size()); for(size_t i(0), m(v.size()); i < m; i++) { const Slot & s = *v[i]; @@ -146,7 +146,7 @@ size_t benchHashStl(const std::vector<Slot *> & v) size_t benchHashStlIntelligent(const std::vector<Slot *> & v) { size_t uniq(0); - typedef std::unordered_set< Gid, Gid::hash > M; + using M = std::unordered_set< Gid, Gid::hash >; M set(v.size()); for(size_t i(0), m(v.size()); i < m; i++) { const Slot & s = *v[i]; @@ -175,7 +175,7 @@ size_t benchHashStlFastAlloc(const std::vector<Slot *> & v) size_t benchHashVespaLib(const std::vector<Slot *> & v) { size_t uniq(0); - typedef vespalib::hash_set< Gid, Gid::hash > M; + using M = vespalib::hash_set< Gid, Gid::hash >; M set(v.size()*2); for(size_t i(0), m(v.size()); i < m; i++) { const Slot & s = *v[i]; @@ -190,7 +190,7 @@ size_t benchHashVespaLib(const std::vector<Slot *> & v) size_t benchHashVespaLibIntelligent(const std::vector<Slot *> & v) { size_t uniq(0); - typedef vespalib::hash_set< Gid, Gid::hash > M; + using M = vespalib::hash_set< Gid, Gid::hash >; M set(v.size()*2); for(size_t i(0), m(v.size()); i < m; i++) { const Slot & s = *v[i]; @@ -205,7 +205,7 @@ size_t benchHashVespaLibIntelligent(const std::vector<Slot *> & v) size_t benchHashVespaLibIntelligentAndFast(const std::vector<Slot *> & v) { size_t uniq(0); - typedef vespalib::hash_set< Gid, Gid::hash, std::equal_to<Gid>, vespalib::hashtable_base::and_modulator > M; + using M = vespalib::hash_set< Gid, Gid::hash, std::equal_to<Gid>, vespalib::hashtable_base::and_modulator >; M set(v.size()*2); for(size_t i(0), m(v.size()); i < m; i++) { const Slot & s = *v[i]; diff --git a/vespalib/src/tests/traits/traits_test.cpp b/vespalib/src/tests/traits/traits_test.cpp index 896cec59666..7e1f3a23d8a 100644 --- a/vespalib/src/tests/traits/traits_test.cpp +++ b/vespalib/src/tests/traits/traits_test.cpp @@ -13,7 +13,7 @@ struct Simple { Simple(const Simple &rhs) : value(rhs.value), moved(rhs.moved) {} Simple(Simple &&rhs) : value(rhs.value), moved(rhs.moved + 1) {} }; -typedef std::unique_ptr<Simple> Hard; +using Hard = std::unique_ptr<Simple>; struct Base { virtual void foo() = 0; diff --git a/vespalib/src/tests/zcurve/zcurve_ranges_test.cpp b/vespalib/src/tests/zcurve/zcurve_ranges_test.cpp index 4ab0a0c183b..800180a68f3 100644 --- a/vespalib/src/tests/zcurve/zcurve_ranges_test.cpp +++ b/vespalib/src/tests/zcurve/zcurve_ranges_test.cpp @@ -4,7 +4,7 @@ #include <vector> #include <cinttypes> -typedef vespalib::geo::ZCurve Z; +using Z = vespalib::geo::ZCurve; bool inside(int x, int y, const Z::RangeVector &ranges) { int64_t z = Z::encode(x, y); diff --git a/vespalib/src/vespa/fastlib/text/unicodeutil.h b/vespalib/src/vespa/fastlib/text/unicodeutil.h index e155af134fb..39ea9147b5c 100644 --- a/vespalib/src/vespa/fastlib/text/unicodeutil.h +++ b/vespalib/src/vespa/fastlib/text/unicodeutil.h @@ -7,7 +7,7 @@ #include <sys/types.h> /** ucs4_t is the type of the 4-byte UCS4 characters */ -typedef unsigned int ucs4_t; +using ucs4_t = unsigned int; /** * Utility class for unicode character handling. diff --git a/vespalib/src/vespa/vespalib/btree/btree.h b/vespalib/src/vespa/vespalib/btree/btree.h index f87d5751743..32b538b65ec 100644 --- a/vespalib/src/vespa/vespalib/btree/btree.h +++ b/vespalib/src/vespa/vespalib/btree/btree.h @@ -23,23 +23,22 @@ template <typename KeyT, class BTree { public: - typedef BTreeRoot<KeyT, DataT, AggrT, CompareT, TraitsT, - AggrCalcT> TreeType; - typedef BTreeNodeAllocator<KeyT, DataT, AggrT, - TraitsT::INTERNAL_SLOTS, - TraitsT::LEAF_SLOTS> NodeAllocatorType; - typedef BTreeBuilder<KeyT, DataT, AggrT, - TraitsT::INTERNAL_SLOTS, - TraitsT::LEAF_SLOTS, - AggrCalcT> Builder; - typedef typename TreeType::InternalNodeType InternalNodeType; - typedef typename TreeType::LeafNodeType LeafNodeType; - typedef typename TreeType::KeyType KeyType; - typedef typename TreeType::DataType DataType; - typedef typename TreeType::Iterator Iterator; - typedef typename TreeType::ConstIterator ConstIterator; - typedef typename TreeType::FrozenView FrozenView; - typedef typename TreeType::AggrCalcType AggrCalcType; + using TreeType = BTreeRoot<KeyT, DataT, AggrT, CompareT, TraitsT, AggrCalcT>; + using NodeAllocatorType = BTreeNodeAllocator<KeyT, DataT, AggrT, + TraitsT::INTERNAL_SLOTS, + TraitsT::LEAF_SLOTS>; + using Builder = BTreeBuilder<KeyT, DataT, AggrT, + TraitsT::INTERNAL_SLOTS, + TraitsT::LEAF_SLOTS, + AggrCalcT>; + using InternalNodeType = typename TreeType::InternalNodeType; + using LeafNodeType = typename TreeType::LeafNodeType; + using KeyType = typename TreeType::KeyType; + using DataType = typename TreeType::DataType; + using Iterator = typename TreeType::Iterator; + using ConstIterator = typename TreeType::ConstIterator; + using FrozenView = typename TreeType::FrozenView; + using AggrCalcType = typename TreeType::AggrCalcType; private: NodeAllocatorType _alloc; TreeType _tree; diff --git a/vespalib/src/vespa/vespalib/btree/btreeinserter.h b/vespalib/src/vespa/vespalib/btree/btreeinserter.h index bc433954d2a..2a4985b04b8 100644 --- a/vespalib/src/vespa/vespalib/btree/btreeinserter.h +++ b/vespalib/src/vespa/vespalib/btree/btreeinserter.h @@ -21,20 +21,20 @@ template <typename KeyT, class BTreeInserter { public: - typedef BTreeNodeAllocator<KeyT, DataT, AggrT, - TraitsT::INTERNAL_SLOTS, - TraitsT::LEAF_SLOTS> NodeAllocatorType; - typedef BTreeAggregator<KeyT, DataT, AggrT, - TraitsT::INTERNAL_SLOTS, - TraitsT::LEAF_SLOTS, - AggrCalcT> Aggregator; - typedef BTreeIterator<KeyT, DataT, AggrT, CompareT, TraitsT> Iterator; - typedef BTreeInternalNode<KeyT, AggrT, TraitsT::INTERNAL_SLOTS> InternalNodeType; - typedef BTreeLeafNode<KeyT, DataT, AggrT, TraitsT::LEAF_SLOTS> LeafNodeType; - typedef KeyT KeyType; - typedef DataT DataType; - typedef typename InternalNodeType::RefPair InternalNodeTypeRefPair; - typedef typename LeafNodeType::RefPair LeafNodeTypeRefPair; + using NodeAllocatorType = BTreeNodeAllocator<KeyT, DataT, AggrT, + TraitsT::INTERNAL_SLOTS, + TraitsT::LEAF_SLOTS>; + using Aggregator = BTreeAggregator<KeyT, DataT, AggrT, + TraitsT::INTERNAL_SLOTS, + TraitsT::LEAF_SLOTS, + AggrCalcT>; + using Iterator = BTreeIterator<KeyT, DataT, AggrT, CompareT, TraitsT>; + using InternalNodeType = BTreeInternalNode<KeyT, AggrT, TraitsT::INTERNAL_SLOTS>; + using LeafNodeType = BTreeLeafNode<KeyT, DataT, AggrT, TraitsT::LEAF_SLOTS>; + using KeyType = KeyT; + using DataType = DataT; + using InternalNodeTypeRefPair = typename InternalNodeType::RefPair; + using LeafNodeTypeRefPair = typename LeafNodeType::RefPair; using Inserter = BTreeInserter<KeyT, DataT, AggrT, CompareT, TraitsT, AggrCalcT>; private: diff --git a/vespalib/src/vespa/vespalib/btree/btreeiterator.h b/vespalib/src/vespa/vespalib/btree/btreeiterator.h index e44be0fb5e7..15061a536ef 100644 --- a/vespalib/src/vespa/vespalib/btree/btreeiterator.h +++ b/vespalib/src/vespa/vespalib/btree/btreeiterator.h @@ -32,9 +32,9 @@ class NodeElement template <typename, typename, typename, typename, typename> friend class BTreeIterator; - typedef NodeT NodeType; - typedef typename NodeType::KeyType KeyType; - typedef typename NodeType::DataType DataType; + using NodeType = NodeT; + using KeyType = typename NodeType::KeyType; + using DataType = typename NodeType::DataType; const NodeType *_node; uint32_t _idx; @@ -183,17 +183,17 @@ template <typename KeyT, class BTreeIteratorBase { protected: - typedef BTreeNodeAllocator<KeyT, DataT, AggrT, - INTERNAL_SLOTS, - LEAF_SLOTS> NodeAllocatorType; - typedef BTreeInternalNode<KeyT, AggrT, INTERNAL_SLOTS> InternalNodeType; - typedef BTreeLeafNode<KeyT, DataT, AggrT, LEAF_SLOTS> LeafNodeType; - typedef typename InternalNodeType::RefPair InternalNodeTypeRefPair; - typedef typename LeafNodeType::RefPair LeafNodeTypeRefPair; - typedef BTreeLeafNodeTemp<KeyT, DataT, AggrT, LEAF_SLOTS> LeafNodeTempType; - typedef BTreeKeyData<KeyT, DataT> KeyDataType; - typedef KeyT KeyType; - typedef DataT DataType; + using NodeAllocatorType = BTreeNodeAllocator<KeyT, DataT, AggrT, + INTERNAL_SLOTS, + LEAF_SLOTS>; + using InternalNodeType = BTreeInternalNode<KeyT, AggrT, INTERNAL_SLOTS>; + using LeafNodeType = BTreeLeafNode<KeyT, DataT, AggrT, LEAF_SLOTS> ; + using InternalNodeTypeRefPair = typename InternalNodeType::RefPair; + using LeafNodeTypeRefPair = typename LeafNodeType::RefPair; + using LeafNodeTempType = BTreeLeafNodeTemp<KeyT, DataT, AggrT, LEAF_SLOTS>; + using KeyDataType = BTreeKeyData<KeyT, DataT>; + using KeyType = KeyT; + using DataType = DataT; template <typename, typename, typename, typename, typename, class> friend class BTreeInserter; template <typename, typename, typename, size_t, size_t, class> @@ -201,7 +201,7 @@ protected: template <typename, typename, typename, typename, typename, class> friend class BTreeRemover; - typedef NodeElement<LeafNodeType> LeafElement; + using LeafElement = NodeElement<LeafNodeType>; /** * Current leaf node and current index within it. @@ -211,7 +211,7 @@ protected: * Pointer to internal node and index to the child used to * traverse down the tree */ - typedef NodeElement<InternalNodeType> PathElement; + using PathElement = NodeElement<InternalNodeType>; /** * Path from current leaf node up to the root (path[0] is the * parent of the leaf node) @@ -584,23 +584,22 @@ class BTreeConstIterator : public BTreeIteratorBase<KeyT, DataT, AggrT, TraitsT::PATH_SIZE> { protected: - typedef BTreeIteratorBase<KeyT, - DataT, - AggrT, - TraitsT::INTERNAL_SLOTS, - TraitsT::LEAF_SLOTS, - TraitsT::PATH_SIZE> ParentType; - typedef typename ParentType::NodeAllocatorType NodeAllocatorType; - typedef typename ParentType::InternalNodeType InternalNodeType; - typedef typename ParentType::LeafNodeType LeafNodeType; - typedef typename ParentType::InternalNodeTypeRefPair - InternalNodeTypeRefPair; - typedef typename ParentType::LeafNodeTypeRefPair LeafNodeTypeRefPair; - typedef typename ParentType::LeafNodeTempType LeafNodeTempType; - typedef typename ParentType::KeyDataType KeyDataType; - typedef typename ParentType::KeyType KeyType; - typedef typename ParentType::DataType DataType; - typedef typename ParentType::PathElement PathElement; + using ParentType = BTreeIteratorBase<KeyT, + DataT, + AggrT, + TraitsT::INTERNAL_SLOTS, + TraitsT::LEAF_SLOTS, + TraitsT::PATH_SIZE>; + using NodeAllocatorType = typename ParentType::NodeAllocatorType; + using InternalNodeType = typename ParentType::InternalNodeType; + using LeafNodeType = typename ParentType::LeafNodeType; + using InternalNodeTypeRefPair = typename ParentType::InternalNodeTypeRefPair; + using LeafNodeTypeRefPair = typename ParentType::LeafNodeTypeRefPair; + using LeafNodeTempType = typename ParentType::LeafNodeTempType; + using KeyDataType = typename ParentType::KeyDataType; + using KeyType = typename ParentType::KeyType; + using DataType = typename ParentType::DataType; + using PathElement = typename ParentType::PathElement; using ParentType::_leaf; using ParentType::_path; @@ -615,7 +614,7 @@ public: protected: /** Pointer to seek node and path index to the parent node **/ - typedef std::pair<const BTreeNode *, uint32_t> SeekNode; + using SeekNode = std::pair<const BTreeNode *, uint32_t>; public: /** @@ -800,22 +799,21 @@ class BTreeIterator : public BTreeConstIterator<KeyT, DataT, AggrT, CompareT, TraitsT> { public: - typedef BTreeConstIterator<KeyT, - DataT, - AggrT, - CompareT, - TraitsT> ParentType; - typedef typename ParentType::NodeAllocatorType NodeAllocatorType; - typedef typename ParentType::InternalNodeType InternalNodeType; - typedef typename ParentType::LeafNodeType LeafNodeType; - typedef typename ParentType::InternalNodeTypeRefPair - InternalNodeTypeRefPair; - typedef typename ParentType::LeafNodeTypeRefPair LeafNodeTypeRefPair; - typedef typename ParentType::LeafNodeTempType LeafNodeTempType; - typedef typename ParentType::KeyDataType KeyDataType; - typedef typename ParentType::KeyType KeyType; - typedef typename ParentType::DataType DataType; - typedef typename ParentType::PathElement PathElement; + using ParentType = BTreeConstIterator<KeyT, + DataT, + AggrT, + CompareT, + TraitsT>; + using NodeAllocatorType = typename ParentType::NodeAllocatorType; + using InternalNodeType = typename ParentType::InternalNodeType; + using LeafNodeType = typename ParentType::LeafNodeType; + using InternalNodeTypeRefPair = typename ParentType::InternalNodeTypeRefPair; + using LeafNodeTypeRefPair = typename ParentType::LeafNodeTypeRefPair; + using LeafNodeTempType = typename ParentType::LeafNodeTempType; + using KeyDataType = typename ParentType::KeyDataType; + using KeyType = typename ParentType::KeyType; + using DataType = typename ParentType::DataType; + using PathElement = typename ParentType::PathElement; template <typename, typename, typename, typename, typename, class> friend class BTreeInserter; template <typename, typename, typename, size_t, size_t, class> diff --git a/vespalib/src/vespa/vespalib/btree/btreenode.h b/vespalib/src/vespa/vespalib/btree/btreenode.h index 65186d5c98a..1196b172d1f 100644 --- a/vespalib/src/vespa/vespalib/btree/btreenode.h +++ b/vespalib/src/vespa/vespalib/btree/btreenode.h @@ -139,7 +139,7 @@ public: template <typename AggrT> class BTreeNodeAggregatedWrap { - typedef AggrT AggregatedType; + using AggregatedType = AggrT; AggrT _aggr; static AggrT _instance; @@ -157,7 +157,7 @@ public: template <> class BTreeNodeAggregatedWrap<NoAggregated> { - typedef NoAggregated AggregatedType; + using AggregatedType = NoAggregated; static NoAggregated _instance; public: @@ -236,9 +236,9 @@ class BTreeNodeTT : public BTreeNodeT<KeyT, NumSlots>, public BTreeNodeAggregatedWrap<AggrT> { public: - typedef BTreeNodeT<KeyT, NumSlots> ParentType; - typedef BTreeNodeDataWrap<DataT, NumSlots> DataWrapType; - typedef BTreeNodeAggregatedWrap<AggrT> AggrWrapType; + using ParentType = BTreeNodeT<KeyT, NumSlots>; + using DataWrapType = BTreeNodeDataWrap<DataT, NumSlots>; + using AggrWrapType = BTreeNodeAggregatedWrap<AggrT>; using ParentType::_validSlots; using ParentType::validSlots; using ParentType::getFrozen; @@ -270,7 +270,7 @@ protected: } public: - typedef BTreeNodeTT<KeyT, DataT, AggrT, NumSlots> NodeType; + using NodeType = BTreeNodeTT<KeyT, DataT, AggrT, NumSlots>; void insert(uint32_t idx, const KeyT & key, const DataT & data); void update(uint32_t idx, const KeyT & key, const DataT & data) { // assert(idx < NodeType::maxSlots()); @@ -293,8 +293,8 @@ template <typename KeyT, typename AggrT, uint32_t NumSlots = 16> class BTreeInternalNode : public BTreeNodeTT<KeyT, BTreeNode::ChildRef, AggrT, NumSlots> { public: - typedef BTreeNodeTT<KeyT, BTreeNode::ChildRef, AggrT, NumSlots> ParentType; - typedef BTreeInternalNode<KeyT, AggrT, NumSlots> InternalNodeType; + using ParentType = BTreeNodeTT<KeyT, BTreeNode::ChildRef, AggrT, NumSlots>; + using InternalNodeType = BTreeInternalNode<KeyT, AggrT, NumSlots>; template <typename, typename, typename, size_t, size_t> friend class BTreeNodeAllocator; template <typename, typename, typename, size_t, size_t> @@ -307,8 +307,8 @@ public: friend class datastore::Allocator; template <typename, typename...> friend struct datastore::allocator::Assigner; - typedef BTreeNode::Ref Ref; - typedef datastore::Handle<InternalNodeType> RefPair; + using Ref = BTreeNode::Ref; + using RefPair = datastore::Handle<InternalNodeType>; using ParentType::_keys; using ParentType::_data; using ParentType::validSlots; @@ -320,8 +320,8 @@ public: using ParentType::setLevel; using ParentType::update; using ParentType::EMPTY_LEVEL; - typedef KeyT KeyType; - typedef Ref DataType; + using KeyType = KeyT; + using DataType = Ref; private: uint32_t _validLeaves; protected: @@ -435,8 +435,8 @@ template <typename KeyT, typename DataT, typename AggrT, class BTreeLeafNode : public BTreeNodeTT<KeyT, DataT, AggrT, NumSlots> { public: - typedef BTreeNodeTT<KeyT, DataT, AggrT, NumSlots> ParentType; - typedef BTreeLeafNode<KeyT, DataT, AggrT, NumSlots> LeafNodeType; + using ParentType = BTreeNodeTT<KeyT, DataT, AggrT, NumSlots>; + using LeafNodeType = BTreeLeafNode<KeyT, DataT, AggrT, NumSlots>; template <typename, typename, typename, size_t, size_t> friend class BTreeNodeAllocator; template <typename, typename, typename, size_t, size_t> @@ -447,8 +447,8 @@ public: friend class datastore::Allocator; template <typename, typename...> friend struct datastore::allocator::Assigner; - typedef BTreeNode::Ref Ref; - typedef datastore::Handle<LeafNodeType> RefPair; + using Ref = BTreeNode::Ref; + using RefPair = datastore::Handle<LeafNodeType>; using ParentType::validSlots; using ParentType::_validSlots; using ParentType::_keys; @@ -456,9 +456,9 @@ public: using ParentType::stealSomeFromLeftNode; using ParentType::stealSomeFromRightNode; using ParentType::LEAF_LEVEL; - typedef BTreeKeyData<KeyT, DataT> KeyDataType; - typedef KeyT KeyType; - typedef DataT DataType; + using KeyDataType = BTreeKeyData<KeyT, DataT>; + using KeyType = KeyT; + using DataType = DataT; protected: BTreeLeafNode() : ParentType(LEAF_LEVEL) {} @@ -532,8 +532,8 @@ template <typename KeyT, typename DataT, typename AggrT, class BTreeLeafNodeTemp : public BTreeLeafNode<KeyT, DataT, AggrT, NumSlots> { public: - typedef BTreeLeafNode<KeyT, DataT, AggrT, NumSlots> ParentType; - typedef typename ParentType::KeyDataType KeyDataType; + using ParentType = BTreeLeafNode<KeyT, DataT, AggrT, NumSlots>; + using KeyDataType = typename ParentType::KeyDataType; BTreeLeafNodeTemp(const KeyDataType *smallArray, uint32_t arraySize) diff --git a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h index 77900edf848..38739f03798 100644 --- a/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h +++ b/vespalib/src/vespa/vespalib/btree/btreenodeallocator.h @@ -40,8 +40,8 @@ private: NodeStore _nodeStore; - typedef vespalib::Array<BTreeNode::Ref> RefVector; - typedef vespalib::Array<BTreeRootBaseType *> BTreeRootBaseTypeVector; + using RefVector = vespalib::Array<BTreeNode::Ref>; + using BTreeRootBaseTypeVector = vespalib::Array<BTreeRootBaseType *>; // Nodes that might not be frozen. RefVector _internalToFreeze; diff --git a/vespalib/src/vespa/vespalib/btree/btreenodestore.h b/vespalib/src/vespa/vespalib/btree/btreenodestore.h index a63a4d20170..3b37be33924 100644 --- a/vespalib/src/vespa/vespalib/btree/btreenodestore.h +++ b/vespalib/src/vespa/vespalib/btree/btreenodestore.h @@ -50,13 +50,13 @@ template <typename KeyT, class BTreeNodeStore { public: - typedef datastore::DataStoreT<datastore::EntryRefT<22> > DataStoreType; - typedef DataStoreType::RefType RefType; - typedef BTreeInternalNode<KeyT, AggrT, INTERNAL_SLOTS> InternalNodeType; - typedef BTreeLeafNode<KeyT, DataT, AggrT, LEAF_SLOTS> LeafNodeType; - typedef typename InternalNodeType::RefPair InternalNodeTypeRefPair; - typedef typename LeafNodeType::RefPair LeafNodeTypeRefPair; - typedef vespalib::GenerationHandler::generation_t generation_t; + using DataStoreType = datastore::DataStoreT<datastore::EntryRefT<22> >; + using RefType = DataStoreType::RefType; + using InternalNodeType = BTreeInternalNode<KeyT, AggrT, INTERNAL_SLOTS>; + using LeafNodeType = BTreeLeafNode<KeyT, DataT, AggrT, LEAF_SLOTS>; + using InternalNodeTypeRefPair = typename InternalNodeType::RefPair; + using LeafNodeTypeRefPair = typename LeafNodeType::RefPair; + using generation_t = vespalib::GenerationHandler::generation_t; using EntryRef = datastore::EntryRef; using CompactionStrategy = datastore::CompactionStrategy; diff --git a/vespalib/src/vespa/vespalib/btree/btreeremover.h b/vespalib/src/vespa/vespalib/btree/btreeremover.h index 0295d001f54..33ecc0be88b 100644 --- a/vespalib/src/vespa/vespalib/btree/btreeremover.h +++ b/vespalib/src/vespa/vespalib/btree/btreeremover.h @@ -21,17 +21,17 @@ template <typename KeyT, class BTreeRemoverBase { public: - typedef BTreeNodeAllocator<KeyT, DataT, AggrT, - INTERNAL_SLOTS, - LEAF_SLOTS> NodeAllocatorType; - typedef BTreeAggregator<KeyT, DataT, AggrT, - INTERNAL_SLOTS, - LEAF_SLOTS, - AggrCalcT> Aggregator; - typedef BTreeInternalNode<KeyT, AggrT, INTERNAL_SLOTS> InternalNodeType; - typedef BTreeLeafNode<KeyT, DataT, AggrT, LEAF_SLOTS> LeafNodeType; - typedef typename InternalNodeType::RefPair InternalNodeTypeRefPair; - typedef typename LeafNodeType::RefPair LeafNodeTypeRefPair; + using NodeAllocatorType = BTreeNodeAllocator<KeyT, DataT, AggrT, + INTERNAL_SLOTS, + LEAF_SLOTS>; + using Aggregator = BTreeAggregator<KeyT, DataT, AggrT, + INTERNAL_SLOTS, + LEAF_SLOTS, + AggrCalcT>; + using InternalNodeType = BTreeInternalNode<KeyT, AggrT, INTERNAL_SLOTS>; + using LeafNodeType = BTreeLeafNode<KeyT, DataT, AggrT, LEAF_SLOTS>; + using InternalNodeTypeRefPair = typename InternalNodeType::RefPair; + using LeafNodeTypeRefPair = typename LeafNodeType::RefPair; template <typename NodeType, typename NodeTypeRefPair, class Iterator> @@ -59,26 +59,24 @@ class BTreeRemover : public BTreeRemoverBase<KeyT, DataT, AggrT, { public: - typedef BTreeRemoverBase<KeyT, DataT, AggrT, - TraitsT::INTERNAL_SLOTS, - TraitsT::LEAF_SLOTS, - AggrCalcT> ParentType; - typedef BTreeNodeAllocator<KeyT, DataT, AggrT, - TraitsT::INTERNAL_SLOTS, - TraitsT::LEAF_SLOTS> NodeAllocatorType; - typedef BTreeAggregator<KeyT, DataT, AggrT, - TraitsT::INTERNAL_SLOTS, - TraitsT::LEAF_SLOTS, - AggrCalcT> Aggregator; - typedef BTreeInternalNode<KeyT, AggrT, TraitsT::INTERNAL_SLOTS> - InternalNodeType; - typedef BTreeLeafNode<KeyT, DataT, AggrT, TraitsT::LEAF_SLOTS> - LeafNodeType; - typedef KeyT KeyType; - typedef DataT DataType; - typedef typename InternalNodeType::RefPair InternalNodeTypeRefPair; - typedef typename LeafNodeType::RefPair LeafNodeTypeRefPair; - typedef BTreeIterator<KeyT, DataT, AggrT, CompareT, TraitsT> Iterator; + using ParentType = BTreeRemoverBase<KeyT, DataT, AggrT, + TraitsT::INTERNAL_SLOTS, + TraitsT::LEAF_SLOTS, + AggrCalcT>; + using NodeAllocatorType = BTreeNodeAllocator<KeyT, DataT, AggrT, + TraitsT::INTERNAL_SLOTS, + TraitsT::LEAF_SLOTS>; + using Aggregator = BTreeAggregator<KeyT, DataT, AggrT, + TraitsT::INTERNAL_SLOTS, + TraitsT::LEAF_SLOTS, + AggrCalcT>; + using InternalNodeType = BTreeInternalNode<KeyT, AggrT, TraitsT::INTERNAL_SLOTS>; + using LeafNodeType = BTreeLeafNode<KeyT, DataT, AggrT, TraitsT::LEAF_SLOTS>; + using KeyType = KeyT; + using DataType = DataT; + using InternalNodeTypeRefPair = typename InternalNodeType::RefPair; + using LeafNodeTypeRefPair = typename LeafNodeType::RefPair; + using Iterator = BTreeIterator<KeyT, DataT, AggrT, CompareT, TraitsT>; static void remove(BTreeNode::Ref &root, Iterator &itr, const AggrCalcT &aggrCalc); diff --git a/vespalib/src/vespa/vespalib/btree/btreeroot.h b/vespalib/src/vespa/vespalib/btree/btreeroot.h index 32b27b01dbc..c23cf900367 100644 --- a/vespalib/src/vespa/vespalib/btree/btreeroot.h +++ b/vespalib/src/vespa/vespalib/btree/btreeroot.h @@ -28,25 +28,22 @@ class BTreeRootT : public BTreeRootBase<KeyT, DataT, AggrT, TraitsT::LEAF_SLOTS> { public: - typedef BTreeRootBase<KeyT, DataT, AggrT, - TraitsT::INTERNAL_SLOTS, TraitsT::LEAF_SLOTS> ParentType; - typedef typename ParentType::NodeAllocatorType NodeAllocatorType; - typedef BTreeKeyData<KeyT, DataT> KeyDataType; - typedef typename ParentType::InternalNodeType InternalNodeType; - typedef typename ParentType::LeafNodeType LeafNodeType; - typedef BTreeLeafNodeTemp<KeyT, DataT, AggrT, TraitsT::LEAF_SLOTS> - LeafNodeTempType; - typedef BTreeIterator<KeyT, DataT, AggrT, CompareT, TraitsT> Iterator; - typedef BTreeConstIterator<KeyT, DataT, AggrT, CompareT, TraitsT> - ConstIterator; - - typedef typename ParentType::KeyType KeyType; - typedef typename ParentType::DataType DataType; + using ParentType = BTreeRootBase<KeyT, DataT, AggrT, + TraitsT::INTERNAL_SLOTS, TraitsT::LEAF_SLOTS>; + using NodeAllocatorType = typename ParentType::NodeAllocatorType; + using KeyDataType = BTreeKeyData<KeyT, DataT>; + using InternalNodeType = typename ParentType::InternalNodeType; + using LeafNodeType = typename ParentType::LeafNodeType; + using LeafNodeTempType = BTreeLeafNodeTemp<KeyT, DataT, AggrT, TraitsT::LEAF_SLOTS>; + using Iterator = BTreeIterator<KeyT, DataT, AggrT, CompareT, TraitsT>; + using ConstIterator = BTreeConstIterator<KeyT, DataT, AggrT, CompareT, TraitsT>; + using KeyType = typename ParentType::KeyType; + using DataType = typename ParentType::DataType; protected: - typedef typename ParentType::BTreeRootBaseType BTreeRootBaseType; - typedef BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT> BTreeRootTType; - typedef typename InternalNodeType::RefPair InternalNodeTypeRefPair; - typedef typename LeafNodeType::RefPair LeafNodeTypeRefPair; + using BTreeRootBaseType = typename ParentType::BTreeRootBaseType; + using BTreeRootTType = BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>; + using InternalNodeTypeRefPair = typename InternalNodeType::RefPair; + using LeafNodeTypeRefPair = typename LeafNodeType::RefPair; using ParentType::_root; using ParentType::getFrozenRoot; using ParentType::getFrozenRootRelaxed; @@ -63,7 +60,7 @@ public: BTreeNode::Ref _frozenRoot; const NodeAllocatorType *const _allocator; public: - typedef ConstIterator Iterator; + using Iterator = ConstIterator; FrozenView(); FrozenView(BTreeNode::Ref frozenRoot, const NodeAllocatorType & allocator); @@ -150,25 +147,24 @@ class BTreeRoot : public BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT> { public: - typedef BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT> ParentType; - typedef typename ParentType::ParentType Parent2Type; - typedef typename ParentType::NodeAllocatorType NodeAllocatorType; - typedef typename ParentType::KeyType KeyType; - typedef typename ParentType::DataType DataType; - typedef typename ParentType::LeafNodeType LeafNodeType; - typedef typename ParentType::InternalNodeType InternalNodeType; - typedef typename ParentType::LeafNodeTypeRefPair LeafNodeTypeRefPair; - typedef typename ParentType::InternalNodeTypeRefPair - InternalNodeTypeRefPair; - typedef typename ParentType::Iterator Iterator; - typedef BTreeBuilder<KeyT, DataT, AggrT, - TraitsT::INTERNAL_SLOTS, TraitsT::LEAF_SLOTS, - AggrCalcT> Builder; - typedef BTreeAggregator<KeyT, DataT, AggrT, - TraitsT::INTERNAL_SLOTS, - TraitsT::LEAF_SLOTS, - AggrCalcT> Aggregator; - typedef AggrCalcT AggrCalcType; + using ParentType = BTreeRootT<KeyT, DataT, AggrT, CompareT, TraitsT>; + using Parent2Type = typename ParentType::ParentType; + using NodeAllocatorType = typename ParentType::NodeAllocatorType; + using KeyType = typename ParentType::KeyType; + using DataType = typename ParentType::DataType; + using LeafNodeType = typename ParentType::LeafNodeType; + using InternalNodeType = typename ParentType::InternalNodeType; + using LeafNodeTypeRefPair = typename ParentType::LeafNodeTypeRefPair; + using InternalNodeTypeRefPair = typename ParentType::InternalNodeTypeRefPair; + using Iterator = typename ParentType::Iterator; + using Builder = BTreeBuilder<KeyT, DataT, AggrT, + TraitsT::INTERNAL_SLOTS, TraitsT::LEAF_SLOTS, + AggrCalcT>; + using Aggregator = BTreeAggregator<KeyT, DataT, AggrT, + TraitsT::INTERNAL_SLOTS, + TraitsT::LEAF_SLOTS, + AggrCalcT>; + using AggrCalcType = AggrCalcT; using Parent2Type::_root; using Parent2Type::getFrozenRoot; using Parent2Type::getFrozenRootRelaxed; diff --git a/vespalib/src/vespa/vespalib/btree/btreeroot.hpp b/vespalib/src/vespa/vespalib/btree/btreeroot.hpp index 6ca3720921a..fdcc957009b 100644 --- a/vespalib/src/vespa/vespalib/btree/btreeroot.hpp +++ b/vespalib/src/vespa/vespalib/btree/btreeroot.hpp @@ -453,8 +453,7 @@ insert(Iterator &itr, const KeyType &key, const DataType &data, const AggrCalcT &aggrCalc) { - typedef BTreeInserter<KeyT, DataT, AggrT, CompareT, TraitsT, - AggrCalcT> Inserter; + using Inserter = BTreeInserter<KeyT, DataT, AggrT, CompareT, TraitsT, AggrCalcT>; bool oldFrozen = isFrozen(); Inserter::insert(_root, itr, key, data, aggrCalc); @@ -487,8 +486,7 @@ BTreeRoot<KeyT, DataT, AggrT, CompareT, TraitsT, AggrCalcT>:: remove(Iterator &itr, const AggrCalcT &aggrCalc) { - typedef BTreeRemover<KeyT, DataT, AggrT, CompareT, TraitsT, AggrCalcT> - Remover; + using Remover = BTreeRemover<KeyT, DataT, AggrT, CompareT, TraitsT, AggrCalcT>; bool oldFrozen = isFrozen(); Remover::remove(_root, itr, aggrCalc); if (oldFrozen && !isFrozen()) diff --git a/vespalib/src/vespa/vespalib/btree/btreerootbase.h b/vespalib/src/vespa/vespalib/btree/btreerootbase.h index ff523afb554..6b57dda7660 100644 --- a/vespalib/src/vespa/vespalib/btree/btreerootbase.h +++ b/vespalib/src/vespa/vespalib/btree/btreerootbase.h @@ -17,15 +17,13 @@ template <typename KeyT, class BTreeRootBase { protected: - typedef KeyT KeyType; - typedef DataT DataType; - typedef AggrT AggregatedType; - typedef BTreeRootBase<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS> - BTreeRootBaseType; - typedef BTreeInternalNode<KeyT, AggrT, INTERNAL_SLOTS> InternalNodeType; - typedef BTreeLeafNode<KeyT, DataT, AggrT, LEAF_SLOTS> LeafNodeType; - typedef BTreeNodeAllocator<KeyT, DataT, AggrT, - INTERNAL_SLOTS, LEAF_SLOTS> NodeAllocatorType; + using KeyType = KeyT; + using DataType = DataT; + using AggregatedType = AggrT; + using BTreeRootBaseType = BTreeRootBase<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS>; + using InternalNodeType = BTreeInternalNode<KeyT, AggrT, INTERNAL_SLOTS>; + using LeafNodeType = BTreeLeafNode<KeyT, DataT, AggrT, LEAF_SLOTS>; + using NodeAllocatorType = BTreeNodeAllocator<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS>; BTreeNode::Ref _root; std::atomic<uint32_t> _frozenRoot; diff --git a/vespalib/src/vespa/vespalib/btree/btreestore.h b/vespalib/src/vespa/vespalib/btree/btreestore.h index e5c55d5775d..5250cfa4535 100644 --- a/vespalib/src/vespa/vespalib/btree/btreestore.h +++ b/vespalib/src/vespa/vespalib/btree/btreestore.h @@ -21,34 +21,32 @@ template <typename KeyT, class BTreeStore { public: - typedef KeyT KeyType; - typedef DataT DataType; - typedef AggrT AggregatedType; - typedef datastore::DataStoreT<datastore::EntryRefT<22> > DataStoreType; - typedef DataStoreType::RefType RefType; - typedef BTreeKeyData<KeyT, DataT> KeyDataType; - - typedef BTreeRoot<KeyT, DataT, AggrT, CompareT, TraitsT, AggrCalcT> BTreeType; - typedef BTreeInternalNode<KeyT, AggrT, - TraitsT::INTERNAL_SLOTS> InternalNodeType; - typedef BTreeLeafNode<KeyT, DataT, AggrT, TraitsT::LEAF_SLOTS> - LeafNodeType; - typedef datastore::Handle<BTreeType> BTreeTypeRefPair; - typedef datastore::Handle<KeyDataType> KeyDataTypeRefPair; - typedef typename InternalNodeType::RefPair InternalNodeTypeRefPair; - typedef typename LeafNodeType::RefPair LeafNodeTypeRefPair; - typedef vespalib::GenerationHandler::generation_t generation_t; - typedef BTreeNodeAllocator<KeyT, DataT, AggrT, - TraitsT::INTERNAL_SLOTS, - TraitsT::LEAF_SLOTS> NodeAllocatorType; - typedef typename BTreeType::Iterator Iterator; - typedef typename BTreeType::ConstIterator ConstIterator; - typedef const KeyDataType * AddIter; - typedef const KeyType * RemoveIter; - typedef BTreeBuilder<KeyT, DataT, AggrT, - TraitsT::INTERNAL_SLOTS, - TraitsT::LEAF_SLOTS, - AggrCalcT> Builder; + using KeyType = KeyT; + using DataType = DataT; + using AggregatedType = AggrT; + using DataStoreType = datastore::DataStoreT<datastore::EntryRefT<22> >; + using RefType = DataStoreType::RefType; + using KeyDataType = BTreeKeyData<KeyT, DataT>; + + using BTreeType = BTreeRoot<KeyT, DataT, AggrT, CompareT, TraitsT, AggrCalcT>; + using InternalNodeType = BTreeInternalNode<KeyT, AggrT, TraitsT::INTERNAL_SLOTS>; + using LeafNodeType = BTreeLeafNode<KeyT, DataT, AggrT, TraitsT::LEAF_SLOTS>; + using BTreeTypeRefPair = datastore::Handle<BTreeType>; + using KeyDataTypeRefPair = datastore::Handle<KeyDataType>; + using InternalNodeTypeRefPair = typename InternalNodeType::RefPair; + using LeafNodeTypeRefPair = typename LeafNodeType::RefPair; + using generation_t = vespalib::GenerationHandler::generation_t; + using NodeAllocatorType = BTreeNodeAllocator<KeyT, DataT, AggrT, + TraitsT::INTERNAL_SLOTS, + TraitsT::LEAF_SLOTS>; + using Iterator = typename BTreeType::Iterator; + using ConstIterator = typename BTreeType::ConstIterator; + using AddIter = const KeyDataType *; + using RemoveIter = const KeyType *; + using Builder = BTreeBuilder<KeyT, DataT, AggrT, + TraitsT::INTERNAL_SLOTS, + TraitsT::LEAF_SLOTS, + AggrCalcT>; using CompactionSpec = datastore::CompactionSpec; using CompactionStrategy = datastore::CompactionStrategy; using EntryRef = datastore::EntryRef; diff --git a/vespalib/src/vespa/vespalib/btree/btreestore.hpp b/vespalib/src/vespa/vespalib/btree/btreestore.hpp index ffd337d642b..6b2c4d924cd 100644 --- a/vespalib/src/vespa/vespalib/btree/btreestore.hpp +++ b/vespalib/src/vespa/vespalib/btree/btreestore.hpp @@ -148,8 +148,8 @@ makeTree(EntryRef &ref, for (uint32_t idx = 0; idx < clusterSize; ++idx, ++o) { lNode->update(idx, o->_key, o->getData()); } - typedef BTreeAggregator<KeyT, DataT, AggrT, - TraitsT::INTERNAL_SLOTS, TraitsT::LEAF_SLOTS, AggrCalcT> Aggregator; + using Aggregator = BTreeAggregator<KeyT, DataT, AggrT, + TraitsT::INTERNAL_SLOTS, TraitsT::LEAF_SLOTS, AggrCalcT>; if constexpr (AggrCalcT::hasAggregated()) { Aggregator::recalc(*lNode, _aggrCalc); } @@ -276,8 +276,8 @@ insert(EntryRef &ref, lNode->update(idx, i->_key, i->getData()); } assert(idx == clusterSize + 1); - typedef BTreeAggregator<KeyT, DataT, AggrT, - TraitsT::INTERNAL_SLOTS, TraitsT::LEAF_SLOTS, AggrCalcT> Aggregator; + using Aggregator = BTreeAggregator<KeyT, DataT, AggrT, + TraitsT::INTERNAL_SLOTS, TraitsT::LEAF_SLOTS, AggrCalcT>; if constexpr (AggrCalcT::hasAggregated()) { Aggregator::recalc(*lNode, _aggrCalc); } diff --git a/vespalib/src/vespa/vespalib/component/version.h b/vespalib/src/vespa/vespalib/component/version.h index a5c6fe756ae..b7635a54fbb 100644 --- a/vespalib/src/vespa/vespalib/component/version.h +++ b/vespalib/src/vespa/vespalib/component/version.h @@ -27,7 +27,7 @@ namespace vespalib { class Version { public: - typedef vespalib::string string; + using string = vespalib::string; private: int _major; int _minor; diff --git a/vespalib/src/vespa/vespalib/component/versionspecification.h b/vespalib/src/vespa/vespalib/component/versionspecification.h index 6137244a0f8..894d074784c 100644 --- a/vespalib/src/vespa/vespalib/component/versionspecification.h +++ b/vespalib/src/vespa/vespalib/component/versionspecification.h @@ -27,7 +27,7 @@ namespace vespalib { class VersionSpecification { public: - typedef Version::string string; + using string = Version::string; private: int _major; int _minor; diff --git a/vespalib/src/vespa/vespalib/data/databuffer.h b/vespalib/src/vespa/vespalib/data/databuffer.h index f15cba92eed..af1f33c0327 100644 --- a/vespalib/src/vespa/vespalib/data/databuffer.h +++ b/vespalib/src/vespa/vespalib/data/databuffer.h @@ -41,7 +41,7 @@ private: Alloc _buffer; public: - typedef std::unique_ptr<DataBuffer> UP; + using UP = std::unique_ptr<DataBuffer>; DataBuffer(const DataBuffer &) = delete; DataBuffer &operator=(const DataBuffer &) = delete; DataBuffer(DataBuffer &&) noexcept = default; diff --git a/vespalib/src/vespa/vespalib/data/fileheader.h b/vespalib/src/vespa/vespalib/data/fileheader.h index ca475971932..a6972607f37 100644 --- a/vespalib/src/vespa/vespalib/data/fileheader.h +++ b/vespalib/src/vespa/vespalib/data/fileheader.h @@ -142,7 +142,7 @@ public: private: static const Tag EMPTY; - typedef std::map<vespalib::string, Tag> TagMap; + using TagMap = std::map<vespalib::string, Tag>; TagMap _tags; public: diff --git a/vespalib/src/vespa/vespalib/data/slime/binary_format.cpp b/vespalib/src/vespa/vespalib/data/slime/binary_format.cpp index 947dbce7ba0..f873b33fabf 100644 --- a/vespalib/src/vespa/vespalib/data/slime/binary_format.cpp +++ b/vespalib/src/vespa/vespalib/data/slime/binary_format.cpp @@ -134,7 +134,7 @@ struct MappedSymbols { template <bool remap_symbols> struct SymbolHandler { - typedef typename std::conditional<remap_symbols, MappedSymbols, DirectSymbols>::type type; + using type = typename std::conditional<remap_symbols, MappedSymbols, DirectSymbols>::type; }; template <bool remap_symbols> diff --git a/vespalib/src/vespa/vespalib/data/slime/slime.h b/vespalib/src/vespa/vespalib/data/slime/slime.h index 028133d7be1..a426f906563 100644 --- a/vespalib/src/vespa/vespalib/data/slime/slime.h +++ b/vespalib/src/vespa/vespalib/data/slime/slime.h @@ -45,18 +45,18 @@ namespace vespalib { class Slime { private: - typedef slime::Symbol Symbol; - typedef slime::SymbolTable SymbolTable; - typedef slime::RootValue RootValue; - typedef slime::Cursor Cursor; - typedef slime::Inspector Inspector; + using Symbol = slime::Symbol; + using SymbolTable = slime::SymbolTable; + using RootValue = slime::RootValue; + using Cursor = slime::Cursor; + using Inspector = slime::Inspector; std::unique_ptr<SymbolTable> _names; std::unique_ptr<Stash> _stash; RootValue _root; public: - typedef std::unique_ptr<Slime> UP; + using UP = std::unique_ptr<Slime>; class Params { private: std::unique_ptr<SymbolTable> _symbols; diff --git a/vespalib/src/vespa/vespalib/data/slime/symbol_table.h b/vespalib/src/vespa/vespalib/data/slime/symbol_table.h index 2ad983b140c..c5f3cf12fd6 100644 --- a/vespalib/src/vespa/vespalib/data/slime/symbol_table.h +++ b/vespalib/src/vespa/vespalib/data/slime/symbol_table.h @@ -26,7 +26,7 @@ private: SymbolVector _names; public: - typedef std::unique_ptr<SymbolTable> UP; + using UP = std::unique_ptr<SymbolTable>; SymbolTable(size_t expectedNumSymbols=16); ~SymbolTable(); size_t symbols() const noexcept { return _names.size(); } diff --git a/vespalib/src/vespa/vespalib/data/slime/type.h b/vespalib/src/vespa/vespalib/data/slime/type.h index 50789d3f53b..9497ee65179 100644 --- a/vespalib/src/vespa/vespalib/data/slime/type.h +++ b/vespalib/src/vespa/vespalib/data/slime/type.h @@ -31,14 +31,14 @@ struct TypeType : public Type { static const TypeType instance; TypeType() : Type(ID) {} }; -typedef TypeType<0> NIX; -typedef TypeType<1> BOOL; -typedef TypeType<2> LONG; -typedef TypeType<3> DOUBLE; -typedef TypeType<4> STRING; -typedef TypeType<5> DATA; -typedef TypeType<6> ARRAY; -typedef TypeType<7> OBJECT; +using NIX = TypeType<0>; +using BOOL = TypeType<1>; +using LONG = TypeType<2>; +using DOUBLE = TypeType<3>; +using STRING = TypeType<4>; +using DATA = TypeType<5>; +using ARRAY = TypeType<6>; +using OBJECT = TypeType<7>; extern template struct TypeType<NIX::ID>; extern template struct TypeType<BOOL::ID>; extern template struct TypeType<LONG::ID>; diff --git a/vespalib/src/vespa/vespalib/datastore/datastore.h b/vespalib/src/vespa/vespalib/datastore/datastore.h index 95f47e98ef5..f0ca9c90700 100644 --- a/vespalib/src/vespa/vespalib/datastore/datastore.h +++ b/vespalib/src/vespa/vespalib/datastore/datastore.h @@ -30,7 +30,7 @@ private: void free_elem_internal(EntryRef ref, size_t numElems); public: - typedef RefT RefType; + using RefType = RefT; DataStoreT(const DataStoreT &rhs) = delete; DataStoreT &operator=(const DataStoreT &rhs) = delete; @@ -74,7 +74,7 @@ template <typename EntryType, typename RefT = EntryRefT<22> > class DataStore : public DataStoreT<RefT> { protected: - typedef DataStoreT<RefT> ParentType; + using ParentType = DataStoreT<RefT>; using ParentType::ensureBufferCapacity; using ParentType::getEntry; using ParentType::dropBuffers; diff --git a/vespalib/src/vespa/vespalib/geo/zcurve.cpp b/vespalib/src/vespa/vespalib/geo/zcurve.cpp index 41988276c15..3bd68857154 100644 --- a/vespalib/src/vespa/vespalib/geo/zcurve.cpp +++ b/vespalib/src/vespa/vespalib/geo/zcurve.cpp @@ -16,10 +16,10 @@ private: return (a.error() > b.error()); } }; - typedef ZCurve::Area Area; - typedef ZCurve::Range Range; - typedef ZCurve::RangeVector RangeVector; - typedef PriorityQueue<Area, MaxAreaErrorCmp, LeftArrayHeap> Queue; + using Area = ZCurve::Area; + using Range = ZCurve::Range; + using RangeVector = ZCurve::RangeVector; + using Queue = PriorityQueue<Area, MaxAreaErrorCmp, LeftArrayHeap>; Queue _queue; int64_t _total_estimate; @@ -59,8 +59,8 @@ public: class ZAreaSplitter { private: - typedef ZCurve::Area Area; - typedef ZCurve::RangeVector RangeVector; + using Area = ZCurve::Area; + using RangeVector = ZCurve::RangeVector; ZAreaQueue _queue; diff --git a/vespalib/src/vespa/vespalib/geo/zcurve.h b/vespalib/src/vespa/vespalib/geo/zcurve.h index ffc39f99266..2efcc50d1ed 100644 --- a/vespalib/src/vespa/vespalib/geo/zcurve.h +++ b/vespalib/src/vespa/vespalib/geo/zcurve.h @@ -201,7 +201,7 @@ public: void max(int64_t value) { _max = value; } bool operator<(const Range &rhs) const { return (_min < rhs._min); } }; - typedef std::vector<Range> RangeVector; + using RangeVector = std::vector<Range>; /** * Given an inclusive bounding box, return a set of ranges in diff --git a/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.h b/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.h index 6eae41ead4b..73740858a41 100644 --- a/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.h +++ b/vespalib/src/vespa/vespalib/hwaccelrated/iaccelrated.h @@ -16,7 +16,7 @@ class IAccelrated { public: virtual ~IAccelrated() = default; - typedef std::unique_ptr<IAccelrated> UP; + using UP = std::unique_ptr<IAccelrated>; virtual float dotProduct(const float * a, const float * b, size_t sz) const = 0; virtual double dotProduct(const double * a, const double * b, size_t sz) const = 0; virtual int64_t dotProduct(const int8_t * a, const int8_t * b, size_t sz) const = 0; diff --git a/vespalib/src/vespa/vespalib/io/fileutil.h b/vespalib/src/vespa/vespalib/io/fileutil.h index acbfe14020a..7d9e51532d0 100644 --- a/vespalib/src/vespa/vespalib/io/fileutil.h +++ b/vespalib/src/vespa/vespalib/io/fileutil.h @@ -39,7 +39,7 @@ namespace vespalib { * @brief Simple metadata about a file or directory. **/ struct FileInfo { - typedef std::unique_ptr<FileInfo> UP; + using UP = std::unique_ptr<FileInfo>; bool _plainfile; bool _directory; @@ -75,7 +75,7 @@ private: void verifyDirectIO(uint64_t buf, size_t bufsize, off_t offset) const; public: - typedef std::unique_ptr<File> UP; + using UP = std::unique_ptr<File>; /** * If failing to open file using direct IO it will retry using cached IO. @@ -366,7 +366,7 @@ extern void copy(const vespalib::string & frompath, /** * List the contents of the given directory. */ -typedef std::vector<vespalib::string> DirectoryList; +using DirectoryList = std::vector<vespalib::string>; extern DirectoryList listDirectory(const vespalib::string & path); extern MallocAutoPtr getAlignedBuffer(size_t size); diff --git a/vespalib/src/vespa/vespalib/metrics/counter.h b/vespalib/src/vespa/vespalib/metrics/counter.h index 751c2cc3806..604334ecd64 100644 --- a/vespalib/src/vespa/vespalib/metrics/counter.h +++ b/vespalib/src/vespa/vespalib/metrics/counter.h @@ -49,8 +49,8 @@ public: Increment(Key k, size_t v) : idx(k), value(v) {} }; - typedef CounterAggregator aggregator_type; - typedef Increment sample_type; + using aggregator_type = CounterAggregator; + using sample_type = Increment; }; } // namespace vespalib::metrics diff --git a/vespalib/src/vespa/vespalib/metrics/gauge.h b/vespalib/src/vespa/vespalib/metrics/gauge.h index 59de4a6fe4d..733aa8f685a 100644 --- a/vespalib/src/vespa/vespalib/metrics/gauge.h +++ b/vespalib/src/vespa/vespalib/metrics/gauge.h @@ -39,8 +39,8 @@ public: Measurement(Key k, double v) : idx(k), value(v) {} }; - typedef GaugeAggregator aggregator_type; - typedef Measurement sample_type; + using aggregator_type = GaugeAggregator; + using sample_type = Measurement; }; } // namespace vespalib::metrics diff --git a/vespalib/src/vespa/vespalib/metrics/stable_store.h b/vespalib/src/vespa/vespalib/metrics/stable_store.h index 289d8f84d23..f249fd7729e 100644 --- a/vespalib/src/vespa/vespalib/metrics/stable_store.h +++ b/vespalib/src/vespa/vespalib/metrics/stable_store.h @@ -16,7 +16,7 @@ class StableStore template<typename U> friend void swap(StableStore<U> &a, StableStore<U> &b); public: - typedef std::unique_ptr<MyClass> UP; + using UP = std::unique_ptr<MyClass>; StableStore(); ~StableStore() {} diff --git a/vespalib/src/vespa/vespalib/net/http/http_server.h b/vespalib/src/vespa/vespalib/net/http/http_server.h index 3d4cd557b58..705c6b51fb7 100644 --- a/vespalib/src/vespa/vespalib/net/http/http_server.h +++ b/vespalib/src/vespa/vespalib/net/http/http_server.h @@ -24,7 +24,7 @@ private: void get(Portal::GetRequest req) override; public: - typedef std::unique_ptr<HttpServer> UP; + using UP = std::unique_ptr<HttpServer>; HttpServer(int port_in); ~HttpServer(); const vespalib::string &host() const { return _server->my_host(); } diff --git a/vespalib/src/vespa/vespalib/net/http/json_handler_repo.h b/vespalib/src/vespa/vespalib/net/http/json_handler_repo.h index adbe3010f43..4ca3e061c71 100644 --- a/vespalib/src/vespa/vespalib/net/http/json_handler_repo.h +++ b/vespalib/src/vespa/vespalib/net/http/json_handler_repo.h @@ -24,7 +24,7 @@ class JsonHandlerRepo : public JsonGetHandler { public: struct Token { - typedef std::unique_ptr<Token> UP; + using UP = std::unique_ptr<Token>; virtual ~Token() {} }; @@ -53,7 +53,7 @@ private: }; struct State { - typedef std::shared_ptr<State> SP; + using SP = std::shared_ptr<State>; std::mutex lock; size_t seq; std::vector<Hook> hooks; diff --git a/vespalib/src/vespa/vespalib/net/http/state_server.h b/vespalib/src/vespa/vespalib/net/http/state_server.h index 22152fe1a1f..2ec5d705e3b 100644 --- a/vespalib/src/vespa/vespalib/net/http/state_server.h +++ b/vespalib/src/vespa/vespalib/net/http/state_server.h @@ -24,7 +24,7 @@ private: std::vector<JsonHandlerRepo::Token::UP> _tokens; public: - typedef std::unique_ptr<StateServer> UP; + using UP = std::unique_ptr<StateServer>; StateServer(int port, const HealthProducer &hp, MetricsProducer &mp, ComponentConfigProducer &ccp); ~StateServer(); int getListenPort() { return _server.port(); } diff --git a/vespalib/src/vespa/vespalib/objects/floatingpointtype.h b/vespalib/src/vespa/vespalib/objects/floatingpointtype.h index d1fd80cdcd6..63408948c1a 100644 --- a/vespalib/src/vespa/vespalib/objects/floatingpointtype.h +++ b/vespalib/src/vespa/vespalib/objects/floatingpointtype.h @@ -34,7 +34,7 @@ class FloatingPointType { Number _value; public: - typedef FloatingPointType<Number> Type; + using Type = FloatingPointType<Number>; FloatingPointType() : _value(0.0) {} FloatingPointType(Number n) : _value(n) {} @@ -66,8 +66,8 @@ public: Type operator--(int) { Type t(_value); --_value; return t; } }; -typedef FloatingPointType<double> Double; -typedef FloatingPointType<double> Float; +using Double = FloatingPointType<double>; +using Float = FloatingPointType<double>; template<typename Number> std::ostream& operator<<(std::ostream& out, FloatingPointType<Number> number); diff --git a/vespalib/src/vespa/vespalib/objects/identifiable.h b/vespalib/src/vespa/vespalib/objects/identifiable.h index 586fbc7ed0c..3b17455ef29 100644 --- a/vespalib/src/vespa/vespalib/objects/identifiable.h +++ b/vespalib/src/vespa/vespalib/objects/identifiable.h @@ -157,7 +157,7 @@ class Identifiable { const RuntimeInfo * _base; }; public: - typedef std::unique_ptr<Identifiable> UP; + using UP = std::unique_ptr<Identifiable>; class ILoader { public: @@ -221,25 +221,25 @@ public: * to cast between Identifiable objects, using the inherits() * function defined above to check if the cast should succeed. */ - template <typename T> struct BaseType { typedef T type; }; - template <typename T> struct BaseType<T &> { typedef T type; }; - template <typename T> struct BaseType<T *> { typedef T type; }; - template <typename T> struct BaseType<const T &> { typedef T type; }; - template <typename T> struct BaseType<const T *> { typedef T type; }; + template <typename T> struct BaseType { using type = T; }; + template <typename T> struct BaseType<T &> { using type = T; }; + template <typename T> struct BaseType<T *> { using type = T; }; + template <typename T> struct BaseType<const T &> { using type = T; }; + template <typename T> struct BaseType<const T *> { using type = T; }; template <typename Type> static void ERROR_Type_is_not_Identifiable() { Type *(*foo)() = &Type::identifyClassAsIdentifiable; (void) foo; } template <typename T, typename Base> static T cast(Base &p) { - typedef typename BaseType<T>::type Type; + using Type = typename BaseType<T>::type; ERROR_Type_is_not_Identifiable<Type>(); // Help diagnose errors. if (p.inherits(Type::classId)) { return static_cast<T>(p); } else { throw std::bad_cast(); } } template <typename T, typename Base> static T cast(Base *p) { - typedef typename BaseType<T>::type Type; + using Type = typename BaseType<T>::type; ERROR_Type_is_not_Identifiable<Type>(); // Help diagnose errors. if (p && p->inherits(Type::classId)) { return static_cast<T>(p); } else { return 0; } diff --git a/vespalib/src/vespa/vespalib/stllike/cache.h b/vespalib/src/vespa/vespalib/stllike/cache.h index bf58f1aef98..de4841f2284 100644 --- a/vespalib/src/vespa/vespalib/stllike/cache.h +++ b/vespalib/src/vespa/vespalib/stllike/cache.h @@ -28,9 +28,9 @@ public: template<typename P, typename B, typename sizeK = vespalib::zero<typename P::Key>, typename sizeV = vespalib::zero<typename P::Value> > struct CacheParam : public P { - typedef B BackingStore; - typedef sizeK SizeK; - typedef sizeV SizeV; + using BackingStore = B; + using SizeK = sizeK; + using SizeV = sizeV; }; /** @@ -46,13 +46,13 @@ class cache : private lrucache_map<P> { using Lru = lrucache_map<P>; protected: - typedef typename P::BackingStore BackingStore; - typedef typename P::Hash Hash; - typedef typename P::Key K; - typedef typename P::Value V; - typedef typename P::SizeK SizeK; - typedef typename P::SizeV SizeV; - typedef typename P::value_type value_type; + using BackingStore = typename P::BackingStore; + using Hash = typename P::Hash; + using K = typename P::Key; + using V = typename P::Value; + using SizeK = typename P::SizeK; + using SizeV = typename P::SizeV; + using value_type = typename P::value_type; public: /** * Will create a cache that populates on demand from the backing store. diff --git a/vespalib/src/vespa/vespalib/stllike/hash_map.h b/vespalib/src/vespa/vespalib/stllike/hash_map.h index 9e7525bdb77..48448404d9b 100644 --- a/vespalib/src/vespa/vespalib/stllike/hash_map.h +++ b/vespalib/src/vespa/vespalib/stllike/hash_map.h @@ -11,16 +11,16 @@ template< typename K, typename V, typename H = vespalib::hash<K>, typename EQ = class hash_map { public: - typedef std::pair<K, V> value_type; - typedef K key_type; - typedef V mapped_type; + using value_type = std::pair<K, V>; + using key_type = K; + using mapped_type = V; using HashTable = hashtable< K, value_type, H, EQ, Select1st<value_type>, M >; private: HashTable _ht; public: - typedef typename HashTable::iterator iterator; - typedef typename HashTable::const_iterator const_iterator; - typedef typename HashTable::insert_result insert_result; + using iterator = typename HashTable::iterator; + using const_iterator = typename HashTable::const_iterator; + using insert_result = typename HashTable::insert_result; public: hash_map(hash_map &&) noexcept = default; hash_map & operator = (hash_map &&) noexcept = default; diff --git a/vespalib/src/vespa/vespalib/stllike/hash_set.h b/vespalib/src/vespa/vespalib/stllike/hash_set.h index 0a811d54bf9..2408061a40f 100644 --- a/vespalib/src/vespa/vespalib/stllike/hash_set.h +++ b/vespalib/src/vespa/vespalib/stllike/hash_set.h @@ -15,9 +15,9 @@ private: using HashTable = hashtable< K, K, H, EQ, Identity, M>; HashTable _ht; public: - typedef typename HashTable::iterator iterator; - typedef typename HashTable::const_iterator const_iterator; - typedef typename HashTable::insert_result insert_result; + using iterator = typename HashTable::iterator; + using const_iterator = typename HashTable::const_iterator; + using insert_result = typename HashTable::insert_result; public: hash_set(hash_set &&) noexcept = default; hash_set & operator = (hash_set &&) noexcept = default; diff --git a/vespalib/src/vespa/vespalib/stllike/hashtable.h b/vespalib/src/vespa/vespalib/stllike/hashtable.h index 0be9442ad54..55b055cddaf 100644 --- a/vespalib/src/vespa/vespalib/stllike/hashtable.h +++ b/vespalib/src/vespa/vespalib/stllike/hashtable.h @@ -192,11 +192,11 @@ public: class const_iterator; class iterator { public: - typedef std::ptrdiff_t difference_type; - typedef Value value_type; - typedef Value& reference; - typedef Value* pointer; - typedef std::forward_iterator_tag iterator_category; + using difference_type = std::ptrdiff_t; + using value_type = Value; + using reference = Value&; + using pointer = Value*; + using iterator_category = std::forward_iterator_tag; iterator(hashtable * hash) : _current(0), _hashTable(hash) { if (! _hashTable->_nodes[_current].valid()) { @@ -236,11 +236,11 @@ public: }; class const_iterator { public: - typedef std::ptrdiff_t difference_type; - typedef const Value value_type; - typedef const Value& reference; - typedef const Value* pointer; - typedef std::forward_iterator_tag iterator_category; + using difference_type = std::ptrdiff_t; + using value_type = const Value; + using reference = const Value&; + using pointer = const Value*; + using iterator_category = std::forward_iterator_tag; const_iterator(const hashtable * hash) : _current(0), _hashTable(hash) { if (! _hashTable->_nodes[_current].valid()) { @@ -275,7 +275,7 @@ public: next_t _current; const hashtable * _hashTable; }; - typedef std::pair<iterator, bool> insert_result; + using insert_result = std::pair<iterator, bool>; public: hashtable(hashtable &&) noexcept = default; diff --git a/vespalib/src/vespa/vespalib/stllike/string.h b/vespalib/src/vespa/vespalib/stllike/string.h index 73b91de883d..a4eabaea42d 100644 --- a/vespalib/src/vespa/vespalib/stllike/string.h +++ b/vespalib/src/vespa/vespalib/stllike/string.h @@ -20,8 +20,8 @@ namespace vespalib { class stringref { public: - typedef const char * const_iterator; - typedef size_t size_type; + using const_iterator = const char *; + using size_type = size_t; static const size_type npos = static_cast<size_type>(-1); stringref() : _s(""), _sz(0) { } stringref(const char * s) noexcept : _s(s), _sz(strlen(s)) { } @@ -183,11 +183,11 @@ template <uint32_t StackSize> class small_string { public: - typedef size_t size_type; - typedef char * iterator; - typedef const char * const_iterator; - typedef char * reverse_iterator; - typedef const char * const_reverse_iterator; + using size_type = size_t; + using iterator = char *; + using const_iterator = const char *; + using reverse_iterator = char *; + using const_reverse_iterator = const char *; static const size_type npos = static_cast<size_type>(-1); small_string() noexcept : _buf(_stack), _sz(0), _bufferSize(StackSize) { _stack[0] = '\0'; } small_string(const char * s) noexcept : _buf(_stack), _sz(s ? strlen(s) : 0) { init(s); } @@ -585,7 +585,7 @@ private: rhs._stack[0] = 0; } } - typedef uint32_t isize_type; + using isize_type = uint32_t; bool needAlloc(isize_type add) const { return (add + _sz + 1) > _bufferSize; } bool isAllocated() const { return _buf != _stack; } char * buffer() { return _buf; } @@ -632,7 +632,7 @@ small_string<StackSize>::small_string(Iterator s, Iterator e) : template <uint32_t StackSize> const size_t small_string<StackSize>::npos; -typedef small_string<48> string; +using string = small_string<48>; template<uint32_t StackSize> small_string<StackSize> diff --git a/vespalib/src/vespa/vespalib/stllike/vector_map.h b/vespalib/src/vespa/vespalib/stllike/vector_map.h index eba50ecbb89..3925e83e425 100644 --- a/vespalib/src/vespa/vespalib/stllike/vector_map.h +++ b/vespalib/src/vespa/vespalib/stllike/vector_map.h @@ -24,9 +24,9 @@ template< typename K, typename V, typename LT = std::less<K> > class vector_map { public: - typedef std::pair<K, V> value_type; - typedef K key_type; - typedef V mapped_type; + using value_type = std::pair<K, V>; + using key_type = K; + using mapped_type = V; private: using OrderedList = std::vector<value_type>; friend bool operator < (const std::pair<K, V> & a, const std::pair<K, V> & b) { diff --git a/vespalib/src/vespa/vespalib/testkit/test_hook.h b/vespalib/src/vespa/vespalib/testkit/test_hook.h index 30a3ae875d1..d0e04ede2e9 100644 --- a/vespalib/src/vespa/vespalib/testkit/test_hook.h +++ b/vespalib/src/vespa/vespalib/testkit/test_hook.h @@ -75,8 +75,8 @@ protected: template <typename T> bool runTest(const T &fixture, size_t num_threads) { assert(num_threads > 0); - typedef std::unique_ptr<TestThreadWrapper> ThreadUP; - typedef std::unique_ptr<T> FixtureUP; + using ThreadUP = std::unique_ptr<TestThreadWrapper>; + using FixtureUP = std::unique_ptr<T>; std::vector<TestMaster::TraceItem> traceStack = TestMaster::master.getThreadTraceStack(); CountDownLatch latch(num_threads); Barrier barrier(num_threads); diff --git a/vespalib/src/vespa/vespalib/text/stringtokenizer.cpp b/vespalib/src/vespa/vespalib/text/stringtokenizer.cpp index 133260e0634..17f08ea7f05 100644 --- a/vespalib/src/vespa/vespalib/text/stringtokenizer.cpp +++ b/vespalib/src/vespa/vespalib/text/stringtokenizer.cpp @@ -24,8 +24,8 @@ private: bool _set[256]; }; -typedef vespalib::StringTokenizer::Token Token; -typedef vespalib::StringTokenizer::TokenList TokenList; +using Token = vespalib::StringTokenizer::Token; +using TokenList = vespalib::StringTokenizer::TokenList; /** * strip leading and trailing sequences diff --git a/vespalib/src/vespa/vespalib/text/stringtokenizer.h b/vespalib/src/vespa/vespalib/text/stringtokenizer.h index e88c8c04b51..a2c9b3520a1 100644 --- a/vespalib/src/vespa/vespalib/text/stringtokenizer.h +++ b/vespalib/src/vespa/vespalib/text/stringtokenizer.h @@ -21,9 +21,9 @@ namespace vespalib { class StringTokenizer { public: - typedef vespalib::stringref Token; - typedef std::vector<Token> TokenList; - typedef TokenList::const_iterator Iterator; + using Token = vespalib::stringref; + using TokenList = std::vector<Token>; + using Iterator = TokenList::const_iterator; /** * @brief Split source on separators with optional trim. diff --git a/vespalib/src/vespa/vespalib/util/alloc.cpp b/vespalib/src/vespa/vespalib/util/alloc.cpp index 8240fa2d8e6..83c8a7de7e2 100644 --- a/vespalib/src/vespa/vespalib/util/alloc.cpp +++ b/vespalib/src/vespa/vespalib/util/alloc.cpp @@ -47,7 +47,7 @@ struct MMapInfo { size_t _sz; string _stackTrace; }; -typedef std::map<const void *, MMapInfo> MMapStore; +using MMapStore = std::map<const void *, MMapInfo>; MMapStore _G_HugeMappings; size_t diff --git a/vespalib/src/vespa/vespalib/util/array.h b/vespalib/src/vespa/vespalib/util/array.h index 99bee183485..30fa4f3eb09 100644 --- a/vespalib/src/vespa/vespalib/util/array.h +++ b/vespalib/src/vespa/vespalib/util/array.h @@ -78,11 +78,11 @@ public: const T * _p; }; using Alloc = alloc::Alloc; - typedef const T * const_iterator; - typedef T * iterator; - typedef const T & const_reference; - typedef T value_type; - typedef size_t size_type; + using const_iterator = const T *; + using iterator = T *; + using const_reference = const T &; + using value_type = T; + using size_type = size_t; Array(const Alloc & initial=Alloc::alloc()); Array(size_t sz, const Alloc & initial=Alloc::alloc()); diff --git a/vespalib/src/vespa/vespalib/util/executor.h b/vespalib/src/vespa/vespalib/util/executor.h index 6346b51c2ab..fe209edc416 100644 --- a/vespalib/src/vespa/vespalib/util/executor.h +++ b/vespalib/src/vespa/vespalib/util/executor.h @@ -30,7 +30,7 @@ public: * A task that can be executed by an executor. **/ struct Task { - typedef std::unique_ptr<Task> UP; + using UP = std::unique_ptr<Task>; virtual void run() = 0; virtual ~Task() = default; }; diff --git a/vespalib/src/vespa/vespalib/util/jsonstream.h b/vespalib/src/vespa/vespalib/util/jsonstream.h index d60151f0478..e41c4238b09 100644 --- a/vespalib/src/vespa/vespalib/util/jsonstream.h +++ b/vespalib/src/vespa/vespalib/util/jsonstream.h @@ -20,9 +20,9 @@ struct JsonStreamTypes { }; // Use namespace in function to avoid prefixing namespace everywhere. namespace jsonstream { - typedef JsonStreamTypes::Object Object; - typedef JsonStreamTypes::Array Array; - typedef JsonStreamTypes::End End; + using Object = JsonStreamTypes::Object; + using Array = JsonStreamTypes::Array; + using End = JsonStreamTypes::End; } // We can disable this if it ends up being a performance issue. diff --git a/vespalib/src/vespa/vespalib/util/noncopyable.hpp b/vespalib/src/vespa/vespalib/util/noncopyable.hpp index bedd1a776f0..249d07f6d98 100644 --- a/vespalib/src/vespa/vespalib/util/noncopyable.hpp +++ b/vespalib/src/vespa/vespalib/util/noncopyable.hpp @@ -20,7 +20,7 @@ namespace noncopyable_ }; } -typedef noncopyable_::noncopyable noncopyable; +using noncopyable = noncopyable_::noncopyable; } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/util/polymorphicarray.h b/vespalib/src/vespa/vespalib/util/polymorphicarray.h index de93ae03657..d3e3b446e18 100644 --- a/vespalib/src/vespa/vespalib/util/polymorphicarray.h +++ b/vespalib/src/vespa/vespalib/util/polymorphicarray.h @@ -67,7 +67,7 @@ public: size_t _i; }; - typedef std::unique_ptr<IArrayT> UP; + using UP = std::unique_ptr<IArrayT>; virtual const B &operator[](size_t i) const = 0; virtual B &operator[](size_t i) = 0; virtual IArrayT *clone() const override = 0; diff --git a/vespalib/src/vespa/vespalib/util/polymorphicarrays.h b/vespalib/src/vespa/vespalib/util/polymorphicarrays.h index 55f64ec51cd..a716872ccc1 100644 --- a/vespalib/src/vespa/vespalib/util/polymorphicarrays.h +++ b/vespalib/src/vespa/vespalib/util/polymorphicarrays.h @@ -38,8 +38,8 @@ class ComplexArrayT final : public IArrayT<B> public: class Factory { public: - typedef std::unique_ptr<Factory> UP; - typedef vespalib::CloneablePtr<Factory> CP; + using UP = std::unique_ptr<Factory>; + using CP = vespalib::CloneablePtr<Factory>; virtual B * create() = 0; virtual Factory * clone() const = 0; virtual ~Factory() { } @@ -63,7 +63,7 @@ public: iterator erase(iterator it) override { _array.erase(_array.begin() + (it - this->begin())); return it; } void push_back(const B & v) override { _array.push_back(v.clone()); } private: - typedef vespalib::CloneablePtr<B> CP; + using CP = vespalib::CloneablePtr<B>; std::vector<CP> _array; typename Factory::CP _factory; }; diff --git a/vespalib/src/vespa/vespalib/util/programoptions.h b/vespalib/src/vespa/vespalib/util/programoptions.h index 0c75f9b2c72..6214b372032 100644 --- a/vespalib/src/vespa/vespalib/util/programoptions.h +++ b/vespalib/src/vespa/vespalib/util/programoptions.h @@ -38,7 +38,7 @@ struct ProgramOptions { class LifetimeToken { ProgramOptions& o; public: - typedef std::unique_ptr<LifetimeToken> UP; + using UP = std::unique_ptr<LifetimeToken>; LifetimeToken(ProgramOptions& op) : o(op) {} ~LifetimeToken() { o.clear(); } }; @@ -200,8 +200,8 @@ template<> inline const char* getTypeName<float>() { return "float"; } template<> inline const char* getTypeName<double>() { return "double"; } struct ProgramOptions::OptionParser { - typedef std::unique_ptr<OptionParser> UP; - typedef std::shared_ptr<OptionParser> SP; + using UP = std::unique_ptr<OptionParser>; + using SP = std::shared_ptr<OptionParser>; std::vector<std::string> _names; std::vector<std::string> _hiddenNames; @@ -310,7 +310,7 @@ struct ProgramOptions::StringOptionParser : public OptionParser { }; struct ProgramOptions::MapOptionParser : public OptionParser { - typedef std::map<std::string, std::string> MapType; + using MapType = std::map<std::string, std::string>; std::map<std::string, std::string>& _value; MapOptionParser(const std::string& nameList, diff --git a/vespalib/src/vespa/vespalib/util/sequence.h b/vespalib/src/vespa/vespalib/util/sequence.h index 7d24d2256b0..819ac4cbbf4 100644 --- a/vespalib/src/vespa/vespalib/util/sequence.h +++ b/vespalib/src/vespa/vespalib/util/sequence.h @@ -12,7 +12,7 @@ namespace vespalib { template <typename T> struct Sequence { - typedef std::unique_ptr<Sequence> UP; + using UP = std::unique_ptr<Sequence>; virtual bool valid() const = 0; virtual T get() const = 0; diff --git a/vespalib/src/vespa/vespalib/util/simple_thread_bundle.h b/vespalib/src/vespa/vespalib/util/simple_thread_bundle.h index 569500635a5..b5f371d2de3 100644 --- a/vespalib/src/vespa/vespalib/util/simple_thread_bundle.h +++ b/vespalib/src/vespa/vespalib/util/simple_thread_bundle.h @@ -91,7 +91,7 @@ public: using Signal = fixed_thread_bundle::Signal; using init_fun_t = Runnable::init_fun_t; - typedef std::unique_ptr<SimpleThreadBundle> UP; + using UP = std::unique_ptr<SimpleThreadBundle>; enum Strategy { USE_SIGNAL_LIST, USE_SIGNAL_TREE, USE_BROADCAST }; class Pool diff --git a/vespalib/src/vespa/vespalib/util/sort.h b/vespalib/src/vespa/vespalib/util/sort.h index 7d21cb4fe1a..a5fe1ae8e31 100644 --- a/vespalib/src/vespa/vespalib/util/sort.h +++ b/vespalib/src/vespa/vespalib/util/sort.h @@ -17,10 +17,10 @@ template<> class convertForSort<float, true> { public: - typedef float InputType; - typedef int32_t IntType; - typedef uint32_t UIntType; - typedef std::less<InputType> Compare; + using InputType = float; + using IntType = int32_t; + using UIntType = uint32_t; + using Compare = std::less<InputType>; static inline UIntType convert(float value) { union { float f; UIntType u; } val; @@ -35,10 +35,10 @@ template<> class convertForSort<float, false> { public: - typedef float InputType; - typedef int32_t IntType; - typedef uint32_t UIntType; - typedef std::greater<InputType> Compare; + using InputType = float; + using IntType = int32_t; + using UIntType = uint32_t; + using Compare = std::greater<InputType>; static inline UIntType convert(float value) { union { float f; UIntType u; } val; @@ -54,10 +54,10 @@ template<> class convertForSort<double, true> { public: - typedef double InputType; - typedef int64_t IntType; - typedef uint64_t UIntType; - typedef std::less<InputType> Compare; + using InputType = double; + using IntType = int64_t; + using UIntType = uint64_t; + using Compare = std::less<InputType>; static inline UIntType convert(double value) { union { double f; UIntType u; } val; @@ -72,10 +72,10 @@ template<> class convertForSort<double, false> { public: - typedef double InputType; - typedef int64_t IntType; - typedef uint64_t UIntType; - typedef std::greater<InputType> Compare; + using InputType = double; + using IntType = int64_t; + using UIntType = uint64_t; + using Compare = std::greater<InputType>; static inline UIntType convert(double value) { union { double f; UIntType u; } val; @@ -90,10 +90,10 @@ template<> class convertForSort<uint8_t, true> { public: - typedef uint8_t InputType; - typedef int8_t IntType; - typedef uint8_t UIntType; - typedef std::less<InputType> Compare; + using InputType = uint8_t; + using IntType = int8_t; + using UIntType = uint8_t; + using Compare = std::less<InputType>; static inline UIntType convert(UIntType value) { return value; } }; @@ -101,70 +101,70 @@ template<> class convertForSort<uint8_t, false> { public: - typedef uint8_t InputType; - typedef int8_t IntType; - typedef uint8_t UIntType; - typedef std::greater<InputType> Compare; + using InputType = uint8_t; + using IntType = int8_t; + using UIntType = uint8_t; + using Compare = std::greater<InputType>; static inline UIntType convert(UIntType value) { return ~value; } }; template<> class convertForSort<uint16_t, true> { public: - typedef uint16_t InputType; - typedef int16_t IntType; - typedef uint16_t UIntType; - typedef std::less<InputType> Compare; + using InputType = uint16_t; + using IntType = int16_t; + using UIntType = uint16_t; + using Compare = std::less<InputType>; static inline UIntType convert(UIntType value) { return value; } }; template<> class convertForSort<uint16_t, false> { public: - typedef uint16_t InputType; - typedef int16_t IntType; - typedef uint16_t UIntType; - typedef std::greater<InputType> Compare; + using InputType = uint16_t; + using IntType = int16_t; + using UIntType = uint16_t; + using Compare = std::greater<InputType>; static inline UIntType convert(UIntType value) { return ~value; } }; template<> class convertForSort<uint32_t, true> { public: - typedef uint32_t InputType; - typedef int32_t IntType; - typedef uint32_t UIntType; - typedef std::less<InputType> Compare; + using InputType = uint32_t; + using IntType = int32_t; + using UIntType = uint32_t; + using Compare = std::less<InputType>; static inline UIntType convert(UIntType value) { return value; } }; template<> class convertForSort<uint32_t, false> { public: - typedef uint32_t InputType; - typedef int32_t IntType; - typedef uint32_t UIntType; - typedef std::greater<InputType> Compare; + using InputType = uint32_t; + using IntType = int32_t; + using UIntType = uint32_t; + using Compare = std::greater<InputType>; static inline UIntType convert(UIntType value) { return ~value; } }; template<> class convertForSort<uint64_t, true> { public: - typedef uint64_t InputType; - typedef int64_t IntType; - typedef uint64_t UIntType; - typedef std::less<InputType> Compare; + using InputType = uint64_t; + using IntType = int64_t; + using UIntType = uint64_t; + using Compare = std::less<InputType>; static inline UIntType convert(UIntType value) { return value; } }; template<> class convertForSort<uint64_t, false> { public: - typedef uint64_t InputType; - typedef int64_t IntType; - typedef uint64_t UIntType; - typedef std::greater<InputType> Compare; + using InputType = uint64_t; + using IntType = int64_t; + using UIntType = uint64_t; + using Compare = std::greater<InputType>; static inline UIntType convert(UIntType value) { return ~value; } }; @@ -172,20 +172,20 @@ template<> class convertForSort<bool, true> { public: - typedef bool InputType; - typedef bool IntType; - typedef bool UIntType; - typedef std::less<InputType> Compare; + using InputType = bool; + using IntType = bool; + using UIntType = bool; + using Compare = std::less<InputType>; static inline UIntType convert(IntType value) { return value; } }; template<> class convertForSort<bool, false> { public: - typedef bool InputType; - typedef bool IntType; - typedef bool UIntType; - typedef std::less<InputType> Compare; + using InputType = bool; + using IntType = bool; + using UIntType = bool; + using Compare = std::less<InputType>; static inline UIntType convert(IntType value) { return !value; } }; @@ -193,80 +193,80 @@ template<> class convertForSort<int8_t, true> { public: - typedef int8_t InputType; - typedef int8_t IntType; - typedef uint8_t UIntType; - typedef std::less<InputType> Compare; + using InputType = int8_t; + using IntType = int8_t; + using UIntType = uint8_t; + using Compare = std::less<InputType>; static inline UIntType convert(IntType value) { return value ^ (std::numeric_limits<IntType>::max() + 1); } }; template<> class convertForSort<int8_t, false> { public: - typedef int8_t InputType; - typedef int8_t IntType; - typedef uint8_t UIntType; - typedef std::greater<InputType> Compare; + using InputType = int8_t; + using IntType = int8_t; + using UIntType = uint8_t; + using Compare = std::greater<InputType>; static inline UIntType convert(IntType value) { return value ^ std::numeric_limits<IntType>::max(); } }; template<> class convertForSort<int16_t, true> { public: - typedef int16_t InputType; - typedef int16_t IntType; - typedef uint16_t UIntType; - typedef std::less<InputType> Compare; + using InputType = int16_t; + using IntType = int16_t; + using UIntType = uint16_t; + using Compare = std::less<InputType>; static inline UIntType convert(IntType value) { return value ^ (std::numeric_limits<IntType>::max() + 1); } }; template<> class convertForSort<int16_t, false> { public: - typedef int16_t InputType; - typedef int16_t IntType; - typedef uint16_t UIntType; - typedef std::greater<InputType> Compare; + using InputType = int16_t; + using IntType = int16_t; + using UIntType = uint16_t; + using Compare = std::greater<InputType>; static inline UIntType convert(IntType value) { return value ^ std::numeric_limits<IntType>::max(); } }; template<> class convertForSort<int32_t, true> { public: - typedef int32_t InputType; - typedef int32_t IntType; - typedef uint32_t UIntType; - typedef std::less<InputType> Compare; + using InputType = int32_t; + using IntType = int32_t; + using UIntType = uint32_t; + using Compare = std::less<InputType>; static inline UIntType convert(IntType value) { return value ^ (UIntType(std::numeric_limits<IntType>::max()) + 1); } }; template<> class convertForSort<int32_t, false> { public: - typedef int32_t InputType; - typedef int32_t IntType; - typedef uint32_t UIntType; - typedef std::greater<InputType> Compare; + using InputType = int32_t; + using IntType = int32_t; + using UIntType = uint32_t; + using Compare = std::greater<InputType>; static inline UIntType convert(IntType value) { return value ^ std::numeric_limits<IntType>::max(); } }; template<> class convertForSort<int64_t, true> { public: - typedef int64_t InputType; - typedef int64_t IntType; - typedef uint64_t UIntType; - typedef std::less<InputType> Compare; + using InputType = int64_t; + using IntType = int64_t; + using UIntType = uint64_t; + using Compare = std::less<InputType>; static inline UIntType convert(IntType value) { return value ^ (UIntType(std::numeric_limits<IntType>::max()) + 1); } }; template<> class convertForSort<int64_t, false> { public: - typedef int64_t InputType; - typedef int64_t IntType; - typedef uint64_t UIntType; - typedef std::greater<InputType> Compare; + using InputType = int64_t; + using IntType = int64_t; + using UIntType = uint64_t; + using Compare = std::greater<InputType>; static inline UIntType convert(IntType value) { return value ^ std::numeric_limits<IntType>::max(); } }; diff --git a/vespalib/src/vespa/vespalib/util/stash.h b/vespalib/src/vespa/vespalib/util/stash.h index a56865ac0ae..5f2ad27bbcd 100644 --- a/vespalib/src/vespa/vespalib/util/stash.h +++ b/vespalib/src/vespa/vespalib/util/stash.h @@ -126,7 +126,7 @@ public: Mark() noexcept : Mark(nullptr, nullptr) {} }; - typedef std::unique_ptr<Stash> UP; + using UP = std::unique_ptr<Stash>; explicit Stash(size_t chunk_size) noexcept ; Stash() noexcept : Stash(4096) {} Stash(Stash &&rhs) noexcept; |