aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/tests
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahooinc.com>2022-12-21 15:48:56 +0000
committerGeir Storli <geirst@yahooinc.com>2022-12-21 15:49:53 +0000
commit13c416cd71b9927b60cc5ea4c9bcecafe472e8c9 (patch)
treef965e2c92278d3c38dd9fafe70873893e36df263 /vespalib/src/tests
parent40add664cca86e6c1591b9503b6ce7f568874388 (diff)
Change from typedef to using in vespalib C++ code.
Diffstat (limited to 'vespalib/src/tests')
-rw-r--r--vespalib/src/tests/array/sort_benchmark.cpp16
-rw-r--r--vespalib/src/tests/arrayqueue/arrayqueue.cpp8
-rw-r--r--vespalib/src/tests/benchmark/testbase.h14
-rw-r--r--vespalib/src/tests/btree/btree_test.cpp42
-rw-r--r--vespalib/src/tests/btree/btreeaggregation_test.cpp41
-rw-r--r--vespalib/src/tests/btree/frozenbtree_test.cpp19
-rw-r--r--vespalib/src/tests/dotproduct/dotproductbenchmark.cpp2
-rw-r--r--vespalib/src/tests/executor/threadstackexecutor_test.cpp2
-rw-r--r--vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp2
-rw-r--r--vespalib/src/tests/left_right_heap/left_right_heap_test.cpp4
-rw-r--r--vespalib/src/tests/objects/objectselection/objectselection.cpp2
-rw-r--r--vespalib/src/tests/priority_queue/priority_queue_test.cpp2
-rw-r--r--vespalib/src/tests/sharedptr/ptrholder.cpp4
-rw-r--r--vespalib/src/tests/slime/type_traits.h16
-rw-r--r--vespalib/src/tests/stash/stash.cpp4
-rw-r--r--vespalib/src/tests/stllike/cache_test.cpp4
-rw-r--r--vespalib/src/tests/stllike/hash_test.cpp10
-rw-r--r--vespalib/src/tests/stllike/hashtable_test.cpp2
-rw-r--r--vespalib/src/tests/stllike/lrucache.cpp8
-rw-r--r--vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp30
-rw-r--r--vespalib/src/tests/traits/traits_test.cpp2
-rw-r--r--vespalib/src/tests/zcurve/zcurve_ranges_test.cpp2
22 files changed, 117 insertions, 119 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);