diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-12-21 18:37:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-21 18:37:21 +0100 |
commit | 541a88143878c25d771a6878376ef66416d54102 (patch) | |
tree | 6a2d66962f39b0bb362e5dfdfc1536d1fcf7b9fb | |
parent | 766ee34d38c47deb1a234590eba6413d075d822a (diff) | |
parent | 13c416cd71b9927b60cc5ea4c9bcecafe472e8c9 (diff) |
Merge pull request #25325 from vespa-engine/geirst/typedef-to-using-in-cpp-code
Change from typedef to using in C++ code.
336 files changed, 1076 insertions, 1094 deletions
diff --git a/document/src/tests/globalidtest.cpp b/document/src/tests/globalidtest.cpp index 58767c751e1..fb11671433e 100644 --- a/document/src/tests/globalidtest.cpp +++ b/document/src/tests/globalidtest.cpp @@ -184,7 +184,7 @@ TEST_F(GlobalIdTest, testGidRangeConversion) TEST_F(GlobalIdTest, testBucketOrderCmp) { - typedef GlobalId::BucketOrderCmp C; + using C = GlobalId::BucketOrderCmp; EXPECT_TRUE(C::compareRaw(0, 0) == 0); EXPECT_TRUE(C::compareRaw(0, 1) == -1); EXPECT_TRUE(C::compareRaw(1, 0) == 1); @@ -217,7 +217,7 @@ TEST_F(GlobalIdTest, testBucketOrderCmp) GlobalId bar = GlobalId::parse("gid(0x000000100030003000700000)"); GlobalId baz = GlobalId::parse("gid(0x000000103330333000700000)"); - typedef std::map<GlobalId, uint32_t, GlobalId::BucketOrderCmp> GidMap; + using GidMap = std::map<GlobalId, uint32_t, GlobalId::BucketOrderCmp>; GidMap gidMap; gidMap[foo] = 666; gidMap[bar] = 777; diff --git a/document/src/tests/predicate/predicate_printer_test.cpp b/document/src/tests/predicate/predicate_printer_test.cpp index ba0ffe40a27..43826d7ab92 100644 --- a/document/src/tests/predicate/predicate_printer_test.cpp +++ b/document/src/tests/predicate/predicate_printer_test.cpp @@ -15,7 +15,7 @@ using namespace document; namespace { -typedef std::unique_ptr<Slime> SlimeUP; +using SlimeUP = std::unique_ptr<Slime>; using namespace document::predicate_slime_builder; TEST("require that PredicatePrinter prints FeatureSets") { diff --git a/document/src/tests/predicate/predicate_test.cpp b/document/src/tests/predicate/predicate_test.cpp index cee19e8b7ab..5efb871f31d 100644 --- a/document/src/tests/predicate/predicate_test.cpp +++ b/document/src/tests/predicate/predicate_test.cpp @@ -20,7 +20,7 @@ using namespace document; namespace { -typedef std::unique_ptr<Slime> SlimeUP; +using SlimeUP = std::unique_ptr<Slime>; TEST("require that predicate feature set slimes can be compared") { PredicateSlimeBuilder builder; diff --git a/document/src/tests/primitivefieldvaluetest.cpp b/document/src/tests/primitivefieldvaluetest.cpp index ea78baa4ee6..9ebe069e0da 100644 --- a/document/src/tests/primitivefieldvaluetest.cpp +++ b/document/src/tests/primitivefieldvaluetest.cpp @@ -208,7 +208,7 @@ namespace { void testNumeric(const std::string& maxVal, bool floatingPoint) { - typedef typename Numeric::Number Number; + using Number = typename Numeric::Number; Number maxValue(std::numeric_limits<Number>::max()); // Test common fieldvalue stuff testCommon(Numeric(), diff --git a/document/src/vespa/document/annotation/alternatespanlist.h b/document/src/vespa/document/annotation/alternatespanlist.h index f21cafedb41..b4306ce8b24 100644 --- a/document/src/vespa/document/annotation/alternatespanlist.h +++ b/document/src/vespa/document/annotation/alternatespanlist.h @@ -19,8 +19,8 @@ class AlternateSpanList : public SpanNode { void addInternal(size_t index, std::unique_ptr<SpanNode> node); public: - typedef std::unique_ptr<AlternateSpanList> UP; - typedef std::vector<Subtree>::const_iterator const_iterator; + using UP = std::unique_ptr<AlternateSpanList>; + using const_iterator = std::vector<Subtree>::const_iterator; ~AlternateSpanList(); diff --git a/document/src/vespa/document/annotation/span.h b/document/src/vespa/document/annotation/span.h index 5f3a78bf98c..68079c194e4 100644 --- a/document/src/vespa/document/annotation/span.h +++ b/document/src/vespa/document/annotation/span.h @@ -12,7 +12,7 @@ class Span : public SpanNode { int32_t _length; public: - typedef std::unique_ptr<Span> UP; + using UP = std::unique_ptr<Span>; Span(int32_t from_pos=0, int32_t len=0) noexcept : _from(from_pos), _length(len) {} diff --git a/document/src/vespa/document/annotation/spanlist.h b/document/src/vespa/document/annotation/spanlist.h index c4e71b2f29a..a579eb0df11 100644 --- a/document/src/vespa/document/annotation/spanlist.h +++ b/document/src/vespa/document/annotation/spanlist.h @@ -12,8 +12,8 @@ class SpanList : public SpanNode { std::vector<SpanNode *> _span_vector; public: - typedef std::unique_ptr<SpanList> UP; - typedef std::vector<SpanNode *>::const_iterator const_iterator; + using UP = std::unique_ptr<SpanList>; + using const_iterator = std::vector<SpanNode *>::const_iterator; ~SpanList(); @@ -34,12 +34,12 @@ public: }; class SimpleSpanList : public SpanNode { - typedef std::vector<Span> SpanVector; + using SpanVector = std::vector<Span>; SpanVector _span_vector; public: - typedef std::unique_ptr<SimpleSpanList> UP; - typedef SpanVector::const_iterator const_iterator; + using UP = std::unique_ptr<SimpleSpanList>; + using const_iterator = SpanVector::const_iterator; SimpleSpanList(size_t sz); ~SimpleSpanList(); diff --git a/document/src/vespa/document/annotation/spannode.h b/document/src/vespa/document/annotation/spannode.h index 90b49b31ba0..b80ace9ec87 100644 --- a/document/src/vespa/document/annotation/spannode.h +++ b/document/src/vespa/document/annotation/spannode.h @@ -9,7 +9,7 @@ namespace document { struct SpanTreeVisitor; struct SpanNode { - typedef std::unique_ptr<SpanNode> UP; + using UP = std::unique_ptr<SpanNode>; virtual ~SpanNode() = default; diff --git a/document/src/vespa/document/annotation/spantree.h b/document/src/vespa/document/annotation/spantree.h index 03ee820466c..a0010fafa74 100644 --- a/document/src/vespa/document/annotation/spantree.h +++ b/document/src/vespa/document/annotation/spantree.h @@ -17,8 +17,8 @@ class SpanTree { std::vector<Annotation> _annotations; public: - typedef std::unique_ptr<SpanTree> UP; - typedef AnnotationVector::const_iterator const_iterator; + using UP = std::unique_ptr<SpanTree>; + using const_iterator = AnnotationVector::const_iterator; template <typename T> SpanTree(vespalib::stringref name, std::unique_ptr<T> root) diff --git a/document/src/vespa/document/base/documentid.h b/document/src/vespa/document/base/documentid.h index 06f6a7f4342..ebf91808b49 100644 --- a/document/src/vespa/document/base/documentid.h +++ b/document/src/vespa/document/base/documentid.h @@ -31,7 +31,7 @@ class DocumentType; class DocumentId { public: - typedef std::unique_ptr<DocumentId> UP; + using UP = std::unique_ptr<DocumentId>; DocumentId(); DocumentId(vespalib::nbostream & os); diff --git a/document/src/vespa/document/base/fieldpath.h b/document/src/vespa/document/base/fieldpath.h index 95f916af118..46b757fc7dd 100644 --- a/document/src/vespa/document/base/fieldpath.h +++ b/document/src/vespa/document/base/fieldpath.h @@ -91,18 +91,17 @@ private: mutable std::unique_ptr<FieldValue> _fillInVal; }; -//typedef std::deque<FieldPathEntry> FieldPath; // Facade over FieldPathEntry container that exposes cloneability class FieldPath { - typedef std::vector<std::unique_ptr<FieldPathEntry>> Container; + using Container = std::vector<std::unique_ptr<FieldPathEntry>>; public: - typedef Container::reference reference; - typedef Container::const_reference const_reference; - typedef Container::iterator iterator; - typedef Container::const_iterator const_iterator; - typedef Container::reverse_iterator reverse_iterator; - typedef Container::const_reverse_iterator const_reverse_iterator; - typedef std::unique_ptr<FieldPath> UP; + using reference = Container::reference; + using const_reference = Container::const_reference; + using iterator = Container::iterator; + using const_iterator = Container::const_iterator; + using reverse_iterator = Container::reverse_iterator; + using const_reverse_iterator = Container::const_reverse_iterator; + using UP = std::unique_ptr<FieldPath>; FieldPath(); FieldPath(const FieldPath &); diff --git a/document/src/vespa/document/base/idstring.h b/document/src/vespa/document/base/idstring.h index 30538a5d2d4..bb752bd456e 100644 --- a/document/src/vespa/document/base/idstring.h +++ b/document/src/vespa/document/base/idstring.h @@ -19,7 +19,7 @@ namespace document { */ class IdString { public: - typedef uint64_t LocationType; + using LocationType = uint64_t; static LocationType makeLocation(vespalib::stringref s); explicit IdString(vespalib::stringref ns); diff --git a/document/src/vespa/document/bucket/bucketid.cpp b/document/src/vespa/document/bucket/bucketid.cpp index 9ca4db1e51c..06ddfa60d67 100644 --- a/document/src/vespa/document/bucket/bucketid.cpp +++ b/document/src/vespa/document/bucket/bucketid.cpp @@ -43,7 +43,7 @@ namespace { void fillUsedMasks(BucketId::Type * masks, uint8_t maxBits) { - typedef BucketId::Type Type; + using Type = BucketId::Type; for (uint32_t usedBits = 0; usedBits <= maxBits; ++usedBits) { uint8_t notused = 8 * sizeof(Type) - usedBits; masks[usedBits] = (usedBits > 0) ? ((std::numeric_limits<Type>::max() << notused) >> notused) : std::numeric_limits<Type>::max(); @@ -52,7 +52,7 @@ void fillUsedMasks(BucketId::Type * masks, uint8_t maxBits) void fillStripMasks(BucketId::Type * masks, uint8_t maxBits) { - typedef BucketId::Type Type; + using Type = BucketId::Type; for (uint32_t usedBits = 0; usedBits <= maxBits; ++usedBits) { uint8_t notused = 8 * sizeof(Type) - usedBits; Type usedMask = (usedBits > 0) ? ((std::numeric_limits<Type>::max() << notused) >> notused) : std::numeric_limits<Type>::max(); diff --git a/document/src/vespa/document/bucket/bucketselector.h b/document/src/vespa/document/bucket/bucketselector.h index 6bd37c9a7c5..36fe4c1c156 100644 --- a/document/src/vespa/document/bucket/bucketselector.h +++ b/document/src/vespa/document/bucket/bucketselector.h @@ -35,7 +35,7 @@ class BucketSelector { public: explicit BucketSelector(const BucketIdFactory& factory); - typedef std::vector<BucketId> BucketVector; + using BucketVector = std::vector<BucketId>; /** * Get a list of bucket ids that needs to be visited to be sure to find * all data matching given expression. Note that we can only detect diff --git a/document/src/vespa/document/datatype/annotationreferencedatatype.h b/document/src/vespa/document/datatype/annotationreferencedatatype.h index 32017442ce3..bf926253e4c 100644 --- a/document/src/vespa/document/datatype/annotationreferencedatatype.h +++ b/document/src/vespa/document/datatype/annotationreferencedatatype.h @@ -11,7 +11,7 @@ class AnnotationReferenceDataType final : public DataType { const AnnotationType *_type; public: - typedef std::shared_ptr<AnnotationReferenceDataType> SP; + using SP = std::shared_ptr<AnnotationReferenceDataType>; AnnotationReferenceDataType(const AnnotationType &type, int id); AnnotationReferenceDataType(const AnnotationReferenceDataType &) = delete; diff --git a/document/src/vespa/document/datatype/annotationtype.h b/document/src/vespa/document/datatype/annotationtype.h index 6a2301ca06b..80ad6ba5edc 100644 --- a/document/src/vespa/document/datatype/annotationtype.h +++ b/document/src/vespa/document/datatype/annotationtype.h @@ -16,8 +16,8 @@ class AnnotationType { const DataType *_type; public: - typedef std::unique_ptr<AnnotationType> UP; - typedef std::shared_ptr<AnnotationType> SP; + using UP = std::unique_ptr<AnnotationType>; + using SP = std::shared_ptr<AnnotationType>; AnnotationType(int id, vespalib::stringref name) : _id(id), _name(name), _type(0) {} diff --git a/document/src/vespa/document/fieldset/fieldsets.h b/document/src/vespa/document/fieldset/fieldsets.h index 4e33d658540..b2490f01232 100644 --- a/document/src/vespa/document/fieldset/fieldsets.h +++ b/document/src/vespa/document/fieldset/fieldsets.h @@ -48,7 +48,7 @@ public: class FieldCollection : public FieldSet { public: - typedef std::unique_ptr<FieldCollection> UP; + using UP = std::unique_ptr<FieldCollection>; FieldCollection(const DocumentType& docType, Field::Set set); FieldCollection(const FieldCollection &); diff --git a/document/src/vespa/document/fieldvalue/bytefieldvalue.h b/document/src/vespa/document/fieldvalue/bytefieldvalue.h index 1b810828c53..9e5bbb20987 100644 --- a/document/src/vespa/document/fieldvalue/bytefieldvalue.h +++ b/document/src/vespa/document/fieldvalue/bytefieldvalue.h @@ -14,7 +14,7 @@ namespace document { class ByteFieldValue final : public NumericFieldValue<int8_t> { public: - typedef int8_t Number; + using Number = int8_t; ByteFieldValue(Number value = 0) : NumericFieldValue<Number>(Type::BYTE, value) {} diff --git a/document/src/vespa/document/fieldvalue/document.h b/document/src/vespa/document/fieldvalue/document.h index 610b2fcbd1b..efdc61c93b0 100644 --- a/document/src/vespa/document/fieldvalue/document.h +++ b/document/src/vespa/document/fieldvalue/document.h @@ -38,8 +38,8 @@ private: int64_t _lastModified; public: - typedef std::unique_ptr<Document> UP; - typedef std::shared_ptr<Document> SP; + using UP = std::unique_ptr<Document>; + using SP = std::shared_ptr<Document>; static constexpr uint16_t getNewestSerializationVersion() { return 8; } static const DataType & verifyDocumentType(const DataType *type); diff --git a/document/src/vespa/document/fieldvalue/doublefieldvalue.h b/document/src/vespa/document/fieldvalue/doublefieldvalue.h index 56ba6e334e9..95169a7ef1b 100644 --- a/document/src/vespa/document/fieldvalue/doublefieldvalue.h +++ b/document/src/vespa/document/fieldvalue/doublefieldvalue.h @@ -14,7 +14,7 @@ namespace document { class DoubleFieldValue final : public NumericFieldValue<double> { public: - typedef double Number; + using Number = double; DoubleFieldValue(Number value = 0) : NumericFieldValue<Number>(Type::DOUBLE, value) {} diff --git a/document/src/vespa/document/fieldvalue/floatfieldvalue.h b/document/src/vespa/document/fieldvalue/floatfieldvalue.h index 783459dec64..d11f2f1f800 100644 --- a/document/src/vespa/document/fieldvalue/floatfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/floatfieldvalue.h @@ -14,7 +14,7 @@ namespace document { class FloatFieldValue final : public NumericFieldValue<float> { public: - typedef float Number; + using Number = float; FloatFieldValue(Number value = 0) : NumericFieldValue<Number>(Type::FLOAT, value) {} diff --git a/document/src/vespa/document/fieldvalue/intfieldvalue.h b/document/src/vespa/document/fieldvalue/intfieldvalue.h index 521aced292c..bfe02038711 100644 --- a/document/src/vespa/document/fieldvalue/intfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/intfieldvalue.h @@ -14,7 +14,7 @@ namespace document { class IntFieldValue final : public NumericFieldValue<int32_t> { public: - typedef int32_t Number; + using Number = int32_t; IntFieldValue(Number value = 0) : NumericFieldValue<Number>(Type::INT, value) {} diff --git a/document/src/vespa/document/fieldvalue/literalfieldvalue.h b/document/src/vespa/document/fieldvalue/literalfieldvalue.h index 89f2f6afd74..24c4988865e 100644 --- a/document/src/vespa/document/fieldvalue/literalfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/literalfieldvalue.h @@ -22,10 +22,10 @@ namespace document { class LiteralFieldValueB : public FieldValue { public: - typedef vespalib::string string; - typedef vespalib::stringref stringref; - typedef std::unique_ptr<LiteralFieldValueB> UP; - typedef string value_type; + using string = vespalib::string; + using stringref = vespalib::stringref; + using UP = std::unique_ptr<LiteralFieldValueB>; + using value_type = string; explicit LiteralFieldValueB(Type type); ~LiteralFieldValueB(); diff --git a/document/src/vespa/document/fieldvalue/longfieldvalue.h b/document/src/vespa/document/fieldvalue/longfieldvalue.h index 4b73ef0c2ea..6df082af6c3 100644 --- a/document/src/vespa/document/fieldvalue/longfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/longfieldvalue.h @@ -14,7 +14,7 @@ namespace document { class LongFieldValue final : public NumericFieldValue<int64_t> { public: - typedef int64_t Number; + using Number = int64_t; LongFieldValue(Number value = 0) : NumericFieldValue<Number>(Type::LONG, value) {} diff --git a/document/src/vespa/document/fieldvalue/mapfieldvalue.h b/document/src/vespa/document/fieldvalue/mapfieldvalue.h index b34e6aebe9b..f66438d26e0 100644 --- a/document/src/vespa/document/fieldvalue/mapfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/mapfieldvalue.h @@ -50,9 +50,9 @@ private: VESPA_DLL_LOCAL void ensureLookupMap() const; VESPA_DLL_LOCAL ssize_t findIndex(const FieldValue& fv) const; public: - typedef std::unique_ptr<MapFieldValue> UP; + using UP = std::unique_ptr<MapFieldValue>; class iterator { - typedef std::pair<FieldValue *, FieldValue *> pair; + using pair = std::pair<FieldValue *, FieldValue *>; public: iterator(MapFieldValue & map, size_t index) : _map(&map), _index(index) { } bool operator == (const iterator & rhs) const { return _map == rhs._map && _index == rhs._index; } @@ -72,7 +72,7 @@ public: }; class const_iterator { public: - typedef std::pair<const FieldValue *, const FieldValue *> pair; + using pair = std::pair<const FieldValue *, const FieldValue *>; const_iterator(const MapFieldValue & map, size_t index) : _map(&map), _index(index) { } bool operator == (const const_iterator & rhs) const { return _map == rhs._map && _index == rhs._index; } bool operator != (const const_iterator & rhs) const { return _map != rhs._map || _index != rhs._index; } diff --git a/document/src/vespa/document/fieldvalue/numericfieldvalue.h b/document/src/vespa/document/fieldvalue/numericfieldvalue.h index a19456f0e4a..b65475e6bb5 100644 --- a/document/src/vespa/document/fieldvalue/numericfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/numericfieldvalue.h @@ -29,7 +29,7 @@ protected: explicit NumericFieldValue(Type type, Number value=0) : NumericFieldValueBase(type), _value(value) { } Number _value; public: - typedef Number value_type; + using value_type = Number; value_type getValue() const { return _value; } void setValue(Number newValue) { _value = newValue; } diff --git a/document/src/vespa/document/fieldvalue/rawfieldvalue.h b/document/src/vespa/document/fieldvalue/rawfieldvalue.h index b946ecd0038..b63402a8a0a 100644 --- a/document/src/vespa/document/fieldvalue/rawfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/rawfieldvalue.h @@ -15,7 +15,7 @@ namespace document { class RawFieldValue final : public LiteralFieldValue<RawFieldValue, DataType::T_RAW> { public: - typedef LiteralFieldValue<RawFieldValue, DataType::T_RAW> Parent; + using Parent = LiteralFieldValue<RawFieldValue, DataType::T_RAW>; RawFieldValue() : Parent(Type::RAW) { } diff --git a/document/src/vespa/document/fieldvalue/shortfieldvalue.h b/document/src/vespa/document/fieldvalue/shortfieldvalue.h index e135f2a4f54..232db1eff59 100644 --- a/document/src/vespa/document/fieldvalue/shortfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/shortfieldvalue.h @@ -14,8 +14,8 @@ namespace document { class ShortFieldValue final : public NumericFieldValue<int16_t> { public: - typedef std::unique_ptr<ShortFieldValue> UP; - typedef int16_t Number; + using UP = std::unique_ptr<ShortFieldValue>; + using Number = int16_t; ShortFieldValue(Number value = 0) : NumericFieldValue<Number>(Type::SHORT, value) {} diff --git a/document/src/vespa/document/fieldvalue/stringfieldvalue.h b/document/src/vespa/document/fieldvalue/stringfieldvalue.h index 95cd9c6190c..a9d1267d21c 100644 --- a/document/src/vespa/document/fieldvalue/stringfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/stringfieldvalue.h @@ -19,8 +19,8 @@ class DocumentTypeRepo; class StringFieldValue final : public LiteralFieldValue<StringFieldValue, DataType::T_STRING> { public: - typedef LiteralFieldValue<StringFieldValue, DataType::T_STRING> Parent; - typedef std::vector<SpanTree::UP> SpanTrees; + using Parent = LiteralFieldValue<StringFieldValue, DataType::T_STRING>; + using SpanTrees = std::vector<SpanTree::UP>; StringFieldValue() : Parent(Type::STRING), _annotationData() { } StringFieldValue(const vespalib::stringref &value) @@ -62,8 +62,8 @@ private: class AnnotationData { public: - typedef std::vector<char> BackingBlob; - typedef std::unique_ptr<AnnotationData> UP; + using BackingBlob = std::vector<char>; + using UP = std::unique_ptr<AnnotationData>; VESPA_DLL_LOCAL AnnotationData(const AnnotationData & rhs); AnnotationData & operator = (const AnnotationData &) = delete; VESPA_DLL_LOCAL AnnotationData(vespalib::ConstBufferRef serialized, const FixedTypeRepo &repo, diff --git a/document/src/vespa/document/fieldvalue/structuredfieldvalue.h b/document/src/vespa/document/fieldvalue/structuredfieldvalue.h index fdc4ecf7765..b55af4d8e62 100644 --- a/document/src/vespa/document/fieldvalue/structuredfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/structuredfieldvalue.h @@ -51,7 +51,7 @@ protected: const DataType &getType() const { return *_type; } struct StructuredIterator { - typedef std::unique_ptr<StructuredIterator> UP; + using UP = std::unique_ptr<StructuredIterator>; virtual ~StructuredIterator() {} virtual const Field* getNextField() = 0; @@ -178,7 +178,7 @@ public: } virtual bool empty() const = 0; - typedef Iterator const_iterator; + using const_iterator = Iterator; const_iterator begin() const { return const_iterator(*this, nullptr); } const_iterator end() const { return const_iterator(); } diff --git a/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h b/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h index b2183efef42..74a51da616f 100644 --- a/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/weightedsetfieldvalue.h @@ -21,7 +21,7 @@ public: template<typename T> bool operator()(const T& s1, const T& s2) const { return *s1 < *s2; } }; - typedef MapFieldValue WeightedFieldValueMap; + using WeightedFieldValueMap = MapFieldValue; private: std::shared_ptr<const MapDataType> _map_type; @@ -33,7 +33,7 @@ private: bool removeValue(const FieldValue& val) override; fieldvalue::ModificationStatus onIterateNested(PathRange nested, fieldvalue::IteratorHandler& handler) const override; public: - typedef std::unique_ptr<WeightedSetFieldValue> UP; + using UP = std::unique_ptr<WeightedSetFieldValue>; /** * @param wsetType Type of the weighted set. Must be a WeightedSetDataType, @@ -79,8 +79,8 @@ public: void print(std::ostream& out, bool verbose, const std::string& indent) const override; // Implements iterating through internal content. - typedef WeightedFieldValueMap::const_iterator const_iterator; - typedef WeightedFieldValueMap::iterator iterator; + using const_iterator = WeightedFieldValueMap::const_iterator; + using iterator = WeightedFieldValueMap::iterator; const_iterator begin() const { return _map.begin(); } iterator begin() { return _map.begin(); } diff --git a/document/src/vespa/document/predicate/predicate.h b/document/src/vespa/document/predicate/predicate.h index 6972ecdc898..ec09d920ac6 100644 --- a/document/src/vespa/document/predicate/predicate.h +++ b/document/src/vespa/document/predicate/predicate.h @@ -39,7 +39,7 @@ struct Predicate { }; struct PredicateNode { - typedef std::unique_ptr<PredicateNode> UP; + using UP = std::unique_ptr<PredicateNode>; virtual ~PredicateNode() {} }; diff --git a/document/src/vespa/document/predicate/predicate_slime_builder.h b/document/src/vespa/document/predicate/predicate_slime_builder.h index 4a03a85f90d..942a81cb54b 100644 --- a/document/src/vespa/document/predicate/predicate_slime_builder.h +++ b/document/src/vespa/document/predicate/predicate_slime_builder.h @@ -11,7 +11,7 @@ class PredicateSlimeBuilder { std::unique_ptr<vespalib::Slime> _slime; vespalib::slime::Cursor *_cursor; - typedef std::unique_ptr<vespalib::Slime> SlimeUP; + using SlimeUP = std::unique_ptr<vespalib::Slime>; public: PredicateSlimeBuilder(); @@ -37,7 +37,7 @@ public: namespace predicate_slime_builder { -typedef std::unique_ptr<vespalib::Slime> SlimeUP; +using SlimeUP = std::unique_ptr<vespalib::Slime>; SlimeUP featureSet(const std::string &key, const std::initializer_list<std::string> &values); diff --git a/document/src/vespa/document/repo/documenttyperepo.cpp b/document/src/vespa/document/repo/documenttyperepo.cpp index e0db118be11..d7435c979a0 100644 --- a/document/src/vespa/document/repo/documenttyperepo.cpp +++ b/document/src/vespa/document/repo/documenttyperepo.cpp @@ -212,7 +212,7 @@ const AnnotationType *AnnotationTypeRepo::lookup(int32_t id) const { // Combination of a DocumentType and a collection of DataTypes // associated with it. struct DataTypeRepo { - typedef unique_ptr<DataTypeRepo> UP; + using UP = unique_ptr<DataTypeRepo>; std::unique_ptr<DocumentType> doc_type; Repo repo; @@ -252,7 +252,7 @@ void setAnnotationDataTypes(const vector<DocumenttypesConfig::Documenttype::Anno } } -typedef DocumenttypesConfig::Documenttype::Datatype Datatype; +using Datatype = DocumenttypesConfig::Documenttype::Datatype; void addField(const Datatype::Sstruct::Field &field, Repo &repo, StructDataType &struct_type) { diff --git a/document/src/vespa/document/select/node.h b/document/src/vespa/document/select/node.h index 6221d027af0..3618860ca96 100644 --- a/document/src/vespa/document/select/node.h +++ b/document/src/vespa/document/select/node.h @@ -26,8 +26,8 @@ protected: bool _parentheses; // Set to true if parentheses was used around this part // Set such that we can recreate original query in print. public: - typedef std::unique_ptr<Node> UP; - typedef std::shared_ptr<Node> SP; + using UP = std::unique_ptr<Node>; + using SP = std::shared_ptr<Node>; Node(vespalib::stringref name, uint32_t max_depth) : _name(name), _max_depth(max_depth), _parentheses(false) diff --git a/document/src/vespa/document/select/operator.h b/document/src/vespa/document/select/operator.h index 433ce5a3325..bdaed3004f9 100644 --- a/document/src/vespa/document/select/operator.h +++ b/document/src/vespa/document/select/operator.h @@ -19,7 +19,7 @@ namespace document::select { class Operator : public Printable { private: - typedef vespalib::hash_map<vespalib::string, const Operator*> OperatorMap; + using OperatorMap = vespalib::hash_map<vespalib::string, const Operator*>; static OperatorMap _operators; vespalib::string _name; diff --git a/document/src/vespa/document/select/resultlist.h b/document/src/vespa/document/select/resultlist.h index 36907be72a3..0bc27cd5b43 100644 --- a/document/src/vespa/document/select/resultlist.h +++ b/document/src/vespa/document/select/resultlist.h @@ -10,10 +10,10 @@ namespace document::select { class ResultList : public Printable { public: using VariableMap = fieldvalue::VariableMap; - typedef std::pair<VariableMap, const Result*> ResultPair; - typedef std::vector<ResultPair> Results; - typedef Results::iterator iterator; - typedef Results::const_iterator const_iterator; + using ResultPair = std::pair<VariableMap, const Result*>; + using Results = std::vector<ResultPair>; + using iterator = Results::iterator; + using const_iterator = Results::const_iterator; using reverse_iterator = Results::reverse_iterator; ResultList(); diff --git a/document/src/vespa/document/select/value.h b/document/src/vespa/document/select/value.h index aeb814262f2..5d94af12833 100644 --- a/document/src/vespa/document/select/value.h +++ b/document/src/vespa/document/select/value.h @@ -28,8 +28,8 @@ namespace document::select { class Value : public document::Printable { public: - typedef std::shared_ptr<Value> SP; - typedef std::unique_ptr<Value> UP; + using SP = std::shared_ptr<Value>; + using UP = std::unique_ptr<Value>; enum Type { Invalid, Null, String, Integer, Float, Array, Struct, Bucket }; Value(Type t) : _type(t) {} @@ -103,7 +103,7 @@ class FloatValue; class NumberValue : public Value { public: - typedef double CommonValueType; + using CommonValueType = double; NumberValue(Type t) : Value(t) {} @@ -120,7 +120,7 @@ public: class IntegerValue : public NumberValue { public: - typedef int64_t ValueType; + using ValueType = int64_t; IntegerValue(ValueType value, bool isBucketValue); @@ -142,7 +142,7 @@ private: class FloatValue : public NumberValue { public: - typedef double ValueType; + using ValueType = double; FloatValue(ValueType val); diff --git a/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp b/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp index 55ea4988fc4..c8074b27549 100644 --- a/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp +++ b/document/src/vespa/document/serialization/vespadocumentdeserializer.cpp @@ -292,7 +292,7 @@ VespaDocumentDeserializer::read(StringFieldValue &value) { namespace { -typedef SerializableArray::EntryMap FieldInfo; +using FieldInfo = SerializableArray::EntryMap; void readFieldInfo(nbostream& input, SerializableArray::EntryMap & field_info) __attribute__((noinline)); diff --git a/document/src/vespa/document/update/arithmeticvalueupdate.h b/document/src/vespa/document/update/arithmeticvalueupdate.h index 7651c838458..51fb975398e 100644 --- a/document/src/vespa/document/update/arithmeticvalueupdate.h +++ b/document/src/vespa/document/update/arithmeticvalueupdate.h @@ -37,7 +37,7 @@ private: ACCEPT_UPDATE_VISITOR; public: - typedef std::unique_ptr<ArithmeticValueUpdate> UP; + using UP = std::unique_ptr<ArithmeticValueUpdate>; /** * The default constructor requires initial values for all member variables. diff --git a/document/src/vespa/document/util/bytebuffer.h b/document/src/vespa/document/util/bytebuffer.h index 302d43f8742..58a26d7313a 100644 --- a/document/src/vespa/document/util/bytebuffer.h +++ b/document/src/vespa/document/util/bytebuffer.h @@ -21,7 +21,7 @@ namespace document { class ByteBuffer { public: - typedef std::unique_ptr<ByteBuffer> UP; + using UP = std::unique_ptr<ByteBuffer>; ByteBuffer(const ByteBuffer &); ByteBuffer& operator=(const ByteBuffer &) = delete; diff --git a/documentapi/src/tests/policies/testframe.h b/documentapi/src/tests/policies/testframe.h index 7cb3b830627..3b2af060a45 100644 --- a/documentapi/src/tests/policies/testframe.h +++ b/documentapi/src/tests/policies/testframe.h @@ -24,7 +24,7 @@ public: /** * Convenience typedefs. */ - typedef std::map<string, uint32_t> ReplyMap; + using ReplyMap = std::map<string, uint32_t>; /** * Create a named test frame. diff --git a/documentapi/src/vespa/documentapi/common.h b/documentapi/src/vespa/documentapi/common.h index dfc29f48317..13d67318a05 100644 --- a/documentapi/src/vespa/documentapi/common.h +++ b/documentapi/src/vespa/documentapi/common.h @@ -6,7 +6,7 @@ namespace documentapi { // Decide the type of string used once -typedef vespalib::string string; +using string = vespalib::string; } // namespace mbus diff --git a/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h b/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h index f55c05f72cd..9f0d7253335 100644 --- a/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h +++ b/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h @@ -32,8 +32,8 @@ public: /** * Convenience typedef. */ - typedef std::unique_ptr<DocumentProtocol> UP; - typedef std::shared_ptr<DocumentProtocol> SP; + using UP = std::unique_ptr<DocumentProtocol>; + using SP = std::shared_ptr<DocumentProtocol>; /** * The name of this protocol is public static so it can be referenced by all of this protocol's messages diff --git a/documentapi/src/vespa/documentapi/messagebus/iroutablefactory.h b/documentapi/src/vespa/documentapi/messagebus/iroutablefactory.h index d7e60882539..cb1a046107a 100644 --- a/documentapi/src/vespa/documentapi/messagebus/iroutablefactory.h +++ b/documentapi/src/vespa/documentapi/messagebus/iroutablefactory.h @@ -25,8 +25,8 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<IRoutableFactory> UP; - typedef std::shared_ptr<IRoutableFactory> SP; + using UP = std::unique_ptr<IRoutableFactory>; + using SP = std::shared_ptr<IRoutableFactory>; IRoutableFactory(const IRoutableFactory &) = delete; IRoutableFactory & operator = (const IRoutableFactory &) = delete; diff --git a/documentapi/src/vespa/documentapi/messagebus/iroutingpolicyfactory.h b/documentapi/src/vespa/documentapi/messagebus/iroutingpolicyfactory.h index 77e5ad7c33b..c2098608c3a 100644 --- a/documentapi/src/vespa/documentapi/messagebus/iroutingpolicyfactory.h +++ b/documentapi/src/vespa/documentapi/messagebus/iroutingpolicyfactory.h @@ -16,8 +16,8 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<IRoutingPolicyFactory> UP; - typedef std::shared_ptr<IRoutingPolicyFactory> SP; + using UP = std::unique_ptr<IRoutingPolicyFactory>; + using SP = std::shared_ptr<IRoutingPolicyFactory>; /** * Virtual destructor required for inheritance. diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/documentignoredreply.h b/documentapi/src/vespa/documentapi/messagebus/messages/documentignoredreply.h index a97f49abe99..b766a1f5459 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/documentignoredreply.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/documentignoredreply.h @@ -7,8 +7,8 @@ namespace documentapi { class DocumentIgnoredReply : public DocumentReply { public: - typedef std::unique_ptr<DocumentIgnoredReply> UP; - typedef std::shared_ptr<DocumentIgnoredReply> SP; + using UP = std::unique_ptr<DocumentIgnoredReply>; + using SP = std::shared_ptr<DocumentIgnoredReply>; DocumentIgnoredReply(); diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h index 71ca7b049de..09a565c5ea8 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h @@ -24,8 +24,8 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<DocumentMessage> UP; - typedef std::shared_ptr<DocumentMessage> SP; + using UP = std::unique_ptr<DocumentMessage>; + using SP = std::shared_ptr<DocumentMessage>; DocumentMessage(); ~DocumentMessage() override; diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h b/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h index 0b137ba7fbc..d03a1447753 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h @@ -19,8 +19,8 @@ public: /** * Convenience typedef. */ - typedef std::unique_ptr<DocumentReply> UP; - typedef std::shared_ptr<DocumentReply> SP; + using UP = std::unique_ptr<DocumentReply>; + using SP = std::shared_ptr<DocumentReply>; /** * Constructs a new reply of given type. diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h index b978bc51248..2c8149ab058 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h @@ -16,8 +16,8 @@ public: /** * Convenience typedef. */ - typedef std::unique_ptr<DocumentSummaryMessage> UP; - typedef std::shared_ptr<DocumentSummaryMessage> SP; + using UP = std::unique_ptr<DocumentSummaryMessage>; + using SP = std::shared_ptr<DocumentSummaryMessage>; /** * Constructs a new document message with no content. diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/feedmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/feedmessage.h index 0cf4ae0f412..ab95b84fac9 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/feedmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/feedmessage.h @@ -15,8 +15,8 @@ public: /** * Convenience typedef. */ - typedef std::unique_ptr<FeedMessage> UP; - typedef std::shared_ptr<FeedMessage> SP; + using UP = std::unique_ptr<FeedMessage>; + using SP = std::shared_ptr<FeedMessage>; public: /** diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/feedreply.h b/documentapi/src/vespa/documentapi/messagebus/messages/feedreply.h index ec2fccd65a0..730737e84c7 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/feedreply.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/feedreply.h @@ -14,8 +14,8 @@ public: /** * Convenience typedef. */ - typedef std::unique_ptr<FeedReply> UP; - typedef std::shared_ptr<FeedReply> SP; + using UP = std::unique_ptr<FeedReply>; + using SP = std::shared_ptr<FeedReply>; /** * Constructs a new reply for deserialization. diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentmessage.h index 497bde947bc..666d8009dce 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentmessage.h @@ -18,8 +18,8 @@ public: /** * Convenience typedef. */ - typedef std::unique_ptr<GetDocumentMessage> UP; - typedef std::shared_ptr<GetDocumentMessage> SP; + using UP = std::unique_ptr<GetDocumentMessage>; + using SP = std::shared_ptr<GetDocumentMessage>; /** * Constructs a new message for deserialization. diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentreply.h b/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentreply.h index 06558e2bbf4..54fb8d6dac2 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentreply.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getdocumentreply.h @@ -17,8 +17,8 @@ public: /** * Convenience typedef. */ - typedef std::unique_ptr<GetDocumentReply> UP; - typedef std::shared_ptr<GetDocumentReply> SP; + using UP = std::unique_ptr<GetDocumentReply>; + using SP = std::shared_ptr<GetDocumentReply>; /** * Constructs a new reply for deserialization. diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/queryresultmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/queryresultmessage.h index 3c316df50fe..561fc909e86 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/queryresultmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/queryresultmessage.h @@ -18,8 +18,8 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<QueryResultMessage> UP; - typedef std::shared_ptr<QueryResultMessage> SP; + using UP = std::unique_ptr<QueryResultMessage>; + using SP = std::shared_ptr<QueryResultMessage>; /** * Constructs a new search result message for deserialization. diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h index 1d6760beeae..665eb4aa71a 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h @@ -18,8 +18,8 @@ public: /** * Convenience typedef. */ - typedef std::unique_ptr<RemoveDocumentMessage> UP; - typedef std::shared_ptr<RemoveDocumentMessage> SP; + using UP = std::unique_ptr<RemoveDocumentMessage>; + using SP = std::shared_ptr<RemoveDocumentMessage>; /** * Constructs a new remove document message with no content. diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentreply.h b/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentreply.h index 6e831b5f53e..5ed254343bb 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentreply.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentreply.h @@ -13,8 +13,8 @@ public: /** * Convenience typedef. */ - typedef std::unique_ptr<RemoveDocumentReply> UP; - typedef std::shared_ptr<RemoveDocumentReply> SP; + using UP = std::unique_ptr<RemoveDocumentReply>; + using SP = std::shared_ptr<RemoveDocumentReply>; public: /** diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/searchresultmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/searchresultmessage.h index ad8a4cb6e7d..a464aa6218b 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/searchresultmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/searchresultmessage.h @@ -15,8 +15,8 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<SearchResultMessage> UP; - typedef std::shared_ptr<SearchResultMessage> SP; + using UP = std::unique_ptr<SearchResultMessage>; + using SP = std::shared_ptr<SearchResultMessage>; /** * Constructs a new search result message for deserialization. diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/updatedocumentreply.h b/documentapi/src/vespa/documentapi/messagebus/messages/updatedocumentreply.h index 64f34e43519..29aa358c815 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/updatedocumentreply.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/updatedocumentreply.h @@ -13,8 +13,8 @@ public: /** * Convenience typedef. */ - typedef std::unique_ptr<UpdateDocumentReply> UP; - typedef std::shared_ptr<UpdateDocumentReply> SP; + using UP = std::unique_ptr<UpdateDocumentReply>; + using SP = std::shared_ptr<UpdateDocumentReply>; public: /** diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h b/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h index 0b43b37c0b7..234c4ce1812 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h @@ -13,7 +13,7 @@ namespace document { class Document; } namespace documentapi { -typedef uint64_t Timestamp; +using Timestamp = uint64_t; /** * @class CreateVisitorMessage @@ -44,7 +44,7 @@ protected: DocumentReply::UP doCreateReply() const override; public: - typedef std::unique_ptr<CreateVisitorMessage> UP; + using UP = std::unique_ptr<CreateVisitorMessage>; CreateVisitorMessage(); // must be deserialized into CreateVisitorMessage(const string& libraryName, @@ -123,7 +123,7 @@ protected: DocumentReply::UP doCreateReply() const override; public: - typedef std::unique_ptr<DestroyVisitorMessage> UP; + using UP = std::unique_ptr<DestroyVisitorMessage>; DestroyVisitorMessage(); // must be deserialized into DestroyVisitorMessage(const string &instanceId); @@ -189,7 +189,7 @@ protected: DocumentReply::UP doCreateReply() const override; public: - typedef std::unique_ptr<VisitorInfoMessage> UP; + using UP = std::unique_ptr<VisitorInfoMessage>; VisitorInfoMessage(); ~VisitorInfoMessage(); @@ -218,7 +218,7 @@ protected: DocumentReply::UP doCreateReply() const override; public: - typedef std::unique_ptr<MapVisitorMessage> UP; + using UP = std::unique_ptr<MapVisitorMessage>; MapVisitorMessage(); diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/wrongdistributionreply.h b/documentapi/src/vespa/documentapi/messagebus/messages/wrongdistributionreply.h index 36a48ba1cca..812e7df8bc7 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/wrongdistributionreply.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/wrongdistributionreply.h @@ -10,8 +10,8 @@ private: string _systemState; public: - typedef std::unique_ptr<WrongDistributionReply> UP; - typedef std::shared_ptr<WrongDistributionReply> SP; + using UP = std::unique_ptr<WrongDistributionReply>; + using SP = std::shared_ptr<WrongDistributionReply>; WrongDistributionReply(); WrongDistributionReply(const string &systemState); diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h index 8512984766e..ff34ade5bc0 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h @@ -33,8 +33,8 @@ class DocumentRouteSelectorPolicy : public mbus::IRoutingPolicy, public config::IFetcherCallback<messagebus::protocol::DocumentrouteselectorpolicyConfig> { private: - typedef std::shared_ptr<document::select::Node> SelectorPtr; - typedef std::map<string, SelectorPtr> ConfigMap; + using SelectorPtr = std::shared_ptr<document::select::Node>; + using ConfigMap = std::map<string, SelectorPtr>; const document::DocumentTypeRepo &_repo; mutable std::mutex _lock; diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h index ffeda17d778..cf9ba17f54b 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h @@ -29,8 +29,8 @@ class MessageTypePolicy : public mbus::IRoutingPolicy, public config::IFetcherCallback<vespa::config::content::MessagetyperouteselectorpolicyConfig> { private: - typedef vespalib::PtrHolder<policy::MessageTypeMap> MessageTypeHolder; - typedef vespalib::PtrHolder<mbus::Route> RouteHolder; + using MessageTypeHolder = vespalib::PtrHolder<policy::MessageTypeMap>; + using RouteHolder = vespalib::PtrHolder<mbus::Route>; MessageTypeHolder _map; RouteHolder _defaultRoute; diff --git a/documentapi/src/vespa/documentapi/messagebus/routablerepository.h b/documentapi/src/vespa/documentapi/messagebus/routablerepository.h index 255f6abd180..d7aac105475 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablerepository.h +++ b/documentapi/src/vespa/documentapi/messagebus/routablerepository.h @@ -31,9 +31,9 @@ private: IRoutableFactory::SP getFactory(const vespalib::Version &version) const; }; - typedef std::pair<vespalib::Version, uint32_t> CacheKey; - typedef std::map<CacheKey, IRoutableFactory::SP> FactoryCache; - typedef std::map<uint32_t, VersionMap> TypeMap; + using CacheKey = std::pair<vespalib::Version, uint32_t>; + using FactoryCache = std::map<CacheKey, IRoutableFactory::SP>; + using TypeMap = std::map<uint32_t, VersionMap>; mutable std::mutex _lock; TypeMap _factoryTypes; diff --git a/documentapi/src/vespa/documentapi/messagebus/routingpolicyrepository.h b/documentapi/src/vespa/documentapi/messagebus/routingpolicyrepository.h index a57de3bfc40..7df40052178 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routingpolicyrepository.h +++ b/documentapi/src/vespa/documentapi/messagebus/routingpolicyrepository.h @@ -9,7 +9,7 @@ namespace documentapi { class RoutingPolicyRepository { private: - typedef std::map<string, IRoutingPolicyFactory::SP> FactoryMap; + using FactoryMap = std::map<string, IRoutingPolicyFactory::SP>; mutable std::mutex _lock; FactoryMap _factories; diff --git a/eval/src/vespa/eval/eval/call_nodes.h b/eval/src/vespa/eval/eval/call_nodes.h index 975f52e40a1..6ce0d720c8d 100644 --- a/eval/src/vespa/eval/eval/call_nodes.h +++ b/eval/src/vespa/eval/eval/call_nodes.h @@ -61,7 +61,7 @@ public: return str; } }; -typedef std::unique_ptr<Call> Call_UP; +using Call_UP = std::unique_ptr<Call>; //----------------------------------------------------------------------------- @@ -99,7 +99,7 @@ public: template <typename T> struct CallHelper : Call { - typedef CallHelper<T> Helper; + using Helper = CallHelper<T>; CallHelper(const vespalib::string &name_in, size_t num_params_in) : Call(name_in, num_params_in) {} void accept(NodeVisitor &visitor) const override; diff --git a/eval/src/vespa/eval/eval/interpreted_function.h b/eval/src/vespa/eval/eval/interpreted_function.h index 57f2dd93e03..4528ccb79aa 100644 --- a/eval/src/vespa/eval/eval/interpreted_function.h +++ b/eval/src/vespa/eval/eval/interpreted_function.h @@ -105,7 +105,7 @@ private: const ValueBuilderFactory &_factory; public: - typedef std::unique_ptr<InterpretedFunction> UP; + using UP = std::unique_ptr<InterpretedFunction>; // for testing; use with care; the tensor function must be kept alive InterpretedFunction(const ValueBuilderFactory &factory, const TensorFunction &function, CTFMetaData *meta); InterpretedFunction(const ValueBuilderFactory &factory, const TensorFunction &function) diff --git a/eval/src/vespa/eval/eval/llvm/compiled_function.h b/eval/src/vespa/eval/eval/llvm/compiled_function.h index bf522f5029b..f7ca54dfa23 100644 --- a/eval/src/vespa/eval/eval/llvm/compiled_function.h +++ b/eval/src/vespa/eval/eval/llvm/compiled_function.h @@ -37,7 +37,7 @@ private: PassParams _pass_params; public: - typedef std::unique_ptr<CompiledFunction> UP; + using UP = std::unique_ptr<CompiledFunction>; CompiledFunction(const nodes::Node &root_in, size_t num_params_in, PassParams pass_params_in, const gbdt::Optimize::Chain &forest_optimizers); CompiledFunction(const Function &function_in, PassParams pass_params_in, const gbdt::Optimize::Chain &forest_optimizers) diff --git a/eval/src/vespa/eval/eval/operator_nodes.h b/eval/src/vespa/eval/eval/operator_nodes.h index a47e724a6eb..827bf1da1b4 100644 --- a/eval/src/vespa/eval/eval/operator_nodes.h +++ b/eval/src/vespa/eval/eval/operator_nodes.h @@ -76,7 +76,7 @@ public: return str; } }; -typedef std::unique_ptr<Operator> Operator_UP; +using Operator_UP = std::unique_ptr<Operator>; //----------------------------------------------------------------------------- diff --git a/fbench/src/fbench/client.h b/fbench/src/fbench/client.h index f2f354a35fb..ebdcae4d6cb 100644 --- a/fbench/src/fbench/client.h +++ b/fbench/src/fbench/client.h @@ -183,7 +183,7 @@ private: void run(); public: - typedef std::unique_ptr<Client> UP; + using UP = std::unique_ptr<Client>; /** * The client arguments given to this method becomes the * responsibility of the client. diff --git a/fbench/src/util/timer.h b/fbench/src/util/timer.h index 12aa28e9247..a2ad2578ad6 100644 --- a/fbench/src/util/timer.h +++ b/fbench/src/util/timer.h @@ -17,15 +17,15 @@ class Timer { private: - typedef std::chrono::steady_clock clock; - typedef std::chrono::time_point<clock> time_point; + using clock = std::chrono::steady_clock; + using time_point = std::chrono::time_point<clock>; time_point _time; double _timespan; double _maxTime; bool _running; public: - typedef std::unique_ptr<Timer> UP; + using UP = std::unique_ptr<Timer>; /** * Create a new timer. **/ diff --git a/fnet/src/vespa/fnet/channel.h b/fnet/src/vespa/fnet/channel.h index 52d38db17f8..13052952f44 100644 --- a/fnet/src/vespa/fnet/channel.h +++ b/fnet/src/vespa/fnet/channel.h @@ -27,7 +27,7 @@ private: FNET_Channel &operator=(const FNET_Channel &); public: - typedef std::unique_ptr<FNET_Channel> UP; + using UP = std::unique_ptr<FNET_Channel>; FNET_Channel(uint32_t id = FNET_NOID, FNET_Connection * conn = nullptr, FNET_IPacketHandler * handler = nullptr, FNET_Context context = FNET_Context()) : _id(id), _conn(conn), _handler(handler), _context(context) diff --git a/fnet/src/vespa/fnet/packet.h b/fnet/src/vespa/fnet/packet.h index c32c56eb6d5..2cd620b6955 100644 --- a/fnet/src/vespa/fnet/packet.h +++ b/fnet/src/vespa/fnet/packet.h @@ -18,8 +18,8 @@ class FNET_DataBuffer; class FNET_Packet { public: - typedef std::unique_ptr<FNET_Packet> UP; - typedef std::shared_ptr<FNET_Packet> SP; + using UP = std::unique_ptr<FNET_Packet>; + using SP = std::shared_ptr<FNET_Packet>; /** Does nothing. **/ FNET_Packet() {} diff --git a/fnet/src/vespa/fnet/signalshutdown.cpp b/fnet/src/vespa/fnet/signalshutdown.cpp index cabc564b007..de1090c5b7a 100644 --- a/fnet/src/vespa/fnet/signalshutdown.cpp +++ b/fnet/src/vespa/fnet/signalshutdown.cpp @@ -14,7 +14,7 @@ FNET_SignalShutDown::FNET_SignalShutDown(FNET_Transport &t) void FNET_SignalShutDown::PerformTask() { - typedef vespalib::SignalHandler SIG; + using SIG = vespalib::SignalHandler; if (SIG::INT.check() || SIG::TERM.check()) { fprintf(stderr, "got signal, shutting down...\n"); _transport.ShutDown(false); @@ -26,7 +26,7 @@ FNET_SignalShutDown::PerformTask() void FNET_SignalShutDown::hookSignals() { - typedef vespalib::SignalHandler SIG; + using SIG = vespalib::SignalHandler; SIG::INT.hook(); SIG::TERM.hook(); } diff --git a/fsa/src/libfsa/automaton-alternate.h b/fsa/src/libfsa/automaton-alternate.h index f84ac4b7612..db17306376b 100644 --- a/fsa/src/libfsa/automaton-alternate.h +++ b/fsa/src/libfsa/automaton-alternate.h @@ -424,17 +424,17 @@ private: size_t _size; // used # of objects in current chunk static const size_t _CAPACITY = 16 * 1024 * 1024; // capacity of chunk in bytes public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; + using size_type = size_t; + using difference_type = ptrdiff_t; + using pointer = _Tp*; + using const_pointer = const _Tp*; + using reference = _Tp&; + using const_reference = const _Tp&; + using value_type = _Tp; template<typename _Tp1> struct rebind - { typedef MMapArenaAllocator<_Tp1> other; }; + { using other = MMapArenaAllocator<_Tp1>; }; MMapArenaAllocator() throw(): _chunks(), _size(0) { } @@ -520,60 +520,60 @@ private: /** * @brief Register of states, maps a transition list to a state object */ - typedef std::map< const TransitionList*,State*,TListPtrLess,MMapArenaAllocator< std::pair< const TransitionList*, State* > > > Register; + using Register = std::map< const TransitionList*,State*,TListPtrLess,MMapArenaAllocator< std::pair< const TransitionList*, State* > > >; /** * @brief State register iterator. */ - typedef std::map< const TransitionList*,State*,TListPtrLess,MMapArenaAllocator< std::pair< const TransitionList*, State* > > >::iterator RegisterIterator; + using RegisterIterator = std::map< const TransitionList*,State*,TListPtrLess,MMapArenaAllocator< std::pair< const TransitionList*, State* > > >::iterator; /** * @brief Register of states, maps a blob to a special state. */ - typedef std::map< Blob,State* > BlobRegister; + using BlobRegister = std::map< Blob,State* >; /** * @brief Blob register iterator. */ - typedef std::map< Blob,State* >::iterator BlobRegisterIterator; + using BlobRegisterIterator = std::map< Blob,State* >::iterator; /** * @brief Array of state pointers. */ - typedef std::vector< State* > StateArray; + using StateArray = std::vector< State* >; /** * @brief State* array iterator. */ - typedef std::vector< State* >::iterator StateArrayIterator; + using StateArrayIterator = std::vector< State* >::iterator; /** * @brief Array of state/cell pairs. */ - typedef std::vector< StateCellArrayItem > StateCellArray; + using StateCellArray = std::vector< StateCellArrayItem >; /** * @brief StateCell array iterator. */ - typedef std::vector< StateCellArrayItem >::iterator StateCellArrayIterator; + using StateCellArrayIterator = std::vector< StateCellArrayItem >::iterator; /** * @brief Packing map, maps a state pointer to a state ID. */ - typedef std::map< const void*, unsigned int > PackMap; + using PackMap = std::map< const void*, unsigned int >; /** * @brief Packing map iterator. */ - typedef std::map< const void*, unsigned int >::iterator PackMapIterator; + using PackMapIterator = std::map< const void*, unsigned int >::iterator; /** * @brief symbol_t list. */ - typedef std::list<symbol_t> SymList; + using SymList = std::list<symbol_t>; /** * @brief symbol_t list iterator. */ - typedef std::list<symbol_t>::iterator SymListIterator; + using SymListIterator = std::list<symbol_t>::iterator; /** * @brief symbol_t list const_iterator. */ - typedef std::list<symbol_t>::const_iterator SymListConstIterator; + using SymListConstIterator = std::list<symbol_t>::const_iterator; // }}} // {{{ Automaton::PackedAutomaton diff --git a/fsa/src/vespa/fsa/automaton.h b/fsa/src/vespa/fsa/automaton.h index 2c3f38d8a57..d59e3b8fbf2 100644 --- a/fsa/src/vespa/fsa/automaton.h +++ b/fsa/src/vespa/fsa/automaton.h @@ -508,38 +508,38 @@ private: /** * @brief Register of states, maps a transition list to a state object */ - typedef std::map< TListPtr,State* > Register; + using Register = std::map< TListPtr,State* >; /** * @brief State register iterator. */ - typedef std::map< TListPtr,State* >::iterator RegisterIterator; + using RegisterIterator = std::map< TListPtr,State* >::iterator; /** * @brief Register of states, maps a blob to a special state. */ - typedef std::map< Blob,State* > BlobRegister; + using BlobRegister = std::map< Blob,State* >; /** * @brief Blob register iterator. */ - typedef std::map< Blob,State* >::iterator BlobRegisterIterator; + using BlobRegisterIterator = std::map< Blob,State* >::iterator; /** * @brief Packing map, maps a state pointer to a state ID. */ - typedef std::map< const void*, unsigned int > PackMap; + using PackMap = std::map< const void*, unsigned int >; /** * @brief Packing map iterator. */ - typedef std::map< const void*, unsigned int >::iterator PackMapIterator; + using PackMapIterator = std::map< const void*, unsigned int >::iterator; /** * @brief symbol_t list. */ - typedef std::list<symbol_t> SymList; + using SymList = std::list<symbol_t> ; /** * @brief symbol_t list iterator. */ - typedef std::list<symbol_t>::iterator SymListIterator; + using SymListIterator = std::list<symbol_t>::iterator; // }}} // {{{ Automaton::PackedAutomaton diff --git a/fsa/src/vespa/fsa/fsa.h b/fsa/src/vespa/fsa/fsa.h index b6e5789e043..49c660755b0 100644 --- a/fsa/src/vespa/fsa/fsa.h +++ b/fsa/src/vespa/fsa/fsa.h @@ -23,22 +23,22 @@ namespace fsa { /** * @brief Symbol type used by the automaton. sizeof() should be 1. */ -typedef uint8_t symbol_t; +using symbol_t = uint8_t; /** * @brief State type used by the automaton. */ -typedef uint32_t state_t; +using state_t = uint32_t; /** * @brief Hash type used by the automaton. */ -typedef uint32_t hash_t; +using hash_t = uint32_t; /** * @brief Data type used by the automaton. sizeof() should be 1. */ -typedef uint8_t data_t; +using data_t = uint8_t; // }}} diff --git a/fsa/src/vespa/fsa/permuter.h b/fsa/src/vespa/fsa/permuter.h index f8b6933e478..279c3ade418 100644 --- a/fsa/src/vespa/fsa/permuter.h +++ b/fsa/src/vespa/fsa/permuter.h @@ -27,11 +27,11 @@ private: static const unsigned int MAX_UNIT_LENGTH = 6; - typedef std::vector<std::string> PermTab; - typedef std::vector<std::string>::iterator PermTabIterator; - typedef std::map<std::string,unsigned int> PermMap; - typedef std::map<std::string,unsigned int>::iterator PermMapIterator; - typedef std::map<std::string,unsigned int>::const_iterator PermMapConstIterator; + using PermTab = std::vector<std::string>; + using PermTabIterator = std::vector<std::string>::iterator; + using PermMap = std::map<std::string,unsigned int>; + using PermMapIterator = std::map<std::string,unsigned int>::iterator; + using PermMapConstIterator = std::map<std::string,unsigned int>::const_iterator; PermTab _permtab; PermMap _permmap; diff --git a/fsa/src/vespa/fsa/segmenter.h b/fsa/src/vespa/fsa/segmenter.h index b64956618cc..7502a887f65 100644 --- a/fsa/src/vespa/fsa/segmenter.h +++ b/fsa/src/vespa/fsa/segmenter.h @@ -102,11 +102,11 @@ public: // {{{ typedef Segmenter::Segmentation /** %Segmentation type */ - typedef std::list<int> Segmentation; + using Segmentation = std::list<int>; /** Iterator for %segmentation type */ - typedef std::list<int>::iterator SegmentationIterator; + using SegmentationIterator = std::list<int>::iterator; /** Const iterator for %segmentation type */ - typedef std::list<int>::const_iterator SegmentationConstIterator; + using SegmentationConstIterator = std::list<int>::const_iterator; // }}} diff --git a/fsa/src/vespa/fsa/unicode.h b/fsa/src/vespa/fsa/unicode.h index 4290505bf2c..2328a19e003 100644 --- a/fsa/src/vespa/fsa/unicode.h +++ b/fsa/src/vespa/fsa/unicode.h @@ -8,9 +8,9 @@ namespace fsa { /** utf8_t is the type of the multi-byte UTF-8 character components */ -typedef uint8_t utf8_t; +using utf8_t = uint8_t; /** ucs4_t is the type of the 4-byte UCS4 characters */ -typedef uint32_t ucs4_t; +using ucs4_t = uint32_t; /** diff --git a/fsa/src/vespa/fsa/vectorizer.h b/fsa/src/vespa/fsa/vectorizer.h index 7e61c4f6d88..2fe75eb7a87 100644 --- a/fsa/src/vespa/fsa/vectorizer.h +++ b/fsa/src/vespa/fsa/vectorizer.h @@ -39,8 +39,8 @@ public: */ class VectorItem { public: - typedef std::pair<unsigned int /*position*/, int /*length*/> Hit; - typedef std::vector<Hit> Hits; + using Hit = std::pair<unsigned int /*position*/, int /*length*/>; + using Hits = std::vector<Hit>; private: std::string _term; /**< Term/phrase. */ double _weight; /**< Term weight. */ @@ -334,7 +334,7 @@ public: /** * @brief Term vector type. */ - typedef std::vector<VectorItem> TermVector; + using TermVector = std::vector<VectorItem>; private: @@ -355,7 +355,7 @@ private: public: - typedef std::map<std::string, std::pair<TfIdf, VectorItem::Hits> > ItemMap; + using ItemMap = std::map<std::string, std::pair<TfIdf, VectorItem::Hits> >; // {{{ Vectorizer::RawVector::iterator diff --git a/fsa/src/vespa/fsamanagers/conceptnetmanager.h b/fsa/src/vespa/fsamanagers/conceptnetmanager.h index eddc160bb50..69ee413a569 100644 --- a/fsa/src/vespa/fsamanagers/conceptnetmanager.h +++ b/fsa/src/vespa/fsamanagers/conceptnetmanager.h @@ -44,11 +44,11 @@ private: ConceptNetManager& operator=(const ConceptNetManager&); /** %ConceptNet library type */ - typedef std::map<std::string,ConceptNet::Handle*> Library; + using Library = std::map<std::string,ConceptNet::Handle*>; /** %ConceptNet library iterator type */ - typedef std::map<std::string,ConceptNet::Handle*>::iterator LibraryIterator; + using LibraryIterator = std::map<std::string,ConceptNet::Handle*>::iterator; /** %ConceptNet library const iterator type */ - typedef std::map<std::string,ConceptNet::Handle*>::const_iterator LibraryConstIterator; + using LibraryConstIterator = std::map<std::string,ConceptNet::Handle*>::const_iterator; Library _library; /**< Library of concept networks. */ mutable RWLock _lock; /**< Read-write lock for library synchronization. */ diff --git a/fsa/src/vespa/fsamanagers/fsamanager.h b/fsa/src/vespa/fsamanagers/fsamanager.h index f2c663e6351..d1cf4b4a1fa 100644 --- a/fsa/src/vespa/fsamanagers/fsamanager.h +++ b/fsa/src/vespa/fsamanagers/fsamanager.h @@ -47,11 +47,11 @@ private: FSAManager& operator=(const FSAManager&); /** %FSA library type */ - typedef std::map<std::string,FSA::Handle*> Library; + using Library = std::map<std::string,FSA::Handle*>; /** %FSA library iterator type */ - typedef std::map<std::string,FSA::Handle*>::iterator LibraryIterator; + using LibraryIterator = std::map<std::string,FSA::Handle*>::iterator; /** %FSA library const iterator type */ - typedef std::map<std::string,FSA::Handle*>::const_iterator LibraryConstIterator; + using LibraryConstIterator = std::map<std::string,FSA::Handle*>::const_iterator; Library _library; /**< Library of automata. */ mutable RWLock _lock; /**< Read-write lock for library synchronization. */ diff --git a/fsa/src/vespa/fsamanagers/metadatamanager.h b/fsa/src/vespa/fsamanagers/metadatamanager.h index 606d4687af0..07f02a781f3 100644 --- a/fsa/src/vespa/fsamanagers/metadatamanager.h +++ b/fsa/src/vespa/fsamanagers/metadatamanager.h @@ -44,11 +44,11 @@ private: MetaDataManager& operator=(const MetaDataManager&); /** %MetaData library type */ - typedef std::map<std::string,MetaData::Handle*> Library; + using Library = std::map<std::string,MetaData::Handle*>; /** %MetaData library iterator type */ - typedef std::map<std::string,MetaData::Handle*>::iterator LibraryIterator; + using LibraryIterator = std::map<std::string,MetaData::Handle*>::iterator; /** %MetaData library const iterator type */ - typedef std::map<std::string,MetaData::Handle*>::const_iterator LibraryConstIterator; + using LibraryConstIterator = std::map<std::string,MetaData::Handle*>::const_iterator; Library _library; /**< Library of MetaData objects. */ mutable RWLock _lock; /**< Read-write lock for library synchronization. */ diff --git a/fsa/src/vespa/fsamanagers/singleton.h b/fsa/src/vespa/fsamanagers/singleton.h index 9496dada119..5a31a17f4c8 100644 --- a/fsa/src/vespa/fsamanagers/singleton.h +++ b/fsa/src/vespa/fsamanagers/singleton.h @@ -44,8 +44,8 @@ private: void destroy(); - typedef std::list<void(*)()> FunctionList; - typedef std::list<void(*)()>::iterator FunctionListIterator; + using FunctionList = std::list<void(*)()>; + using FunctionListIterator = std::list<void(*)()>::iterator; /** List of Singleton destroy functions */ FunctionList _functionList; diff --git a/messagebus/src/tests/messagebus/messagebus.cpp b/messagebus/src/tests/messagebus/messagebus.cpp index ab94d6ee183..1abf5ae8ab2 100644 --- a/messagebus/src/tests/messagebus/messagebus.cpp +++ b/messagebus/src/tests/messagebus/messagebus.cpp @@ -51,7 +51,7 @@ struct Base { }; struct Client : public Base { - typedef std::unique_ptr<Client> UP; + using UP = std::unique_ptr<Client>; TestServer server; SourceSession::UP session; Client(Slobrok &slobrok) @@ -74,7 +74,7 @@ struct Server : public Base { }; struct DocProc : public Server { - typedef std::unique_ptr<DocProc> UP; + using UP = std::unique_ptr<DocProc>; IntermediateSession::UP session; DocProc(const string &name, Slobrok &slobrok) : Server(name, slobrok), session() @@ -84,7 +84,7 @@ struct DocProc : public Server { }; struct Search : public Server { - typedef std::unique_ptr<Search> UP; + using UP = std::unique_ptr<Search>; DestinationSession::UP session; Search(const string &name, Slobrok &slobrok) : Server(name, slobrok), session() diff --git a/messagebus/src/tests/sendadapter/sendadapter.cpp b/messagebus/src/tests/sendadapter/sendadapter.cpp index 80bfc45184f..a5973bb2881 100644 --- a/messagebus/src/tests/sendadapter/sendadapter.cpp +++ b/messagebus/src/tests/sendadapter/sendadapter.cpp @@ -24,7 +24,7 @@ private: mutable vespalib::Version _lastVersion; public: - typedef std::shared_ptr<TestProtocol> SP; + using SP = std::shared_ptr<TestProtocol>; ~TestProtocol() override; mbus::Blob encode(const vespalib::Version &version, const mbus::Routable &routable) const override { _lastVersion = version; diff --git a/messagebus/src/vespa/messagebus/callstack.h b/messagebus/src/vespa/messagebus/callstack.h index 35ebc27e2af..937a9e939b6 100644 --- a/messagebus/src/vespa/messagebus/callstack.h +++ b/messagebus/src/vespa/messagebus/callstack.h @@ -30,7 +30,7 @@ private: Context ctx; }; - typedef std::vector<Frame> Stack; + using Stack = std::vector<Frame>; Stack _stack; diff --git a/messagebus/src/vespa/messagebus/configagent.cpp b/messagebus/src/vespa/messagebus/configagent.cpp index dc89e87f62a..0184f0456cf 100644 --- a/messagebus/src/vespa/messagebus/configagent.cpp +++ b/messagebus/src/vespa/messagebus/configagent.cpp @@ -18,7 +18,7 @@ ConfigAgent::configure(std::unique_ptr<MessagebusConfig> config) { const MessagebusConfig &cfg(*config); RoutingSpec spec; - typedef MessagebusConfig CFG; + using CFG = MessagebusConfig; for (uint32_t t = 0; t < cfg.routingtable.size(); ++t) { const CFG::Routingtable &table = cfg.routingtable[t]; RoutingTableSpec tableSpec(table.protocol); diff --git a/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h b/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h index 1ae7e88f876..d9fffebe595 100644 --- a/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h +++ b/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h @@ -37,8 +37,8 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<DynamicThrottlePolicy> UP; - typedef std::shared_ptr<DynamicThrottlePolicy> SP; + using UP = std::unique_ptr<DynamicThrottlePolicy>; + using SP = std::shared_ptr<DynamicThrottlePolicy>; /** * Constructs a new instance of this policy and sets the appropriate default values of member data. diff --git a/messagebus/src/vespa/messagebus/intermediatesession.h b/messagebus/src/vespa/messagebus/intermediatesession.h index 387a77e2274..0a17aa1e42a 100644 --- a/messagebus/src/vespa/messagebus/intermediatesession.h +++ b/messagebus/src/vespa/messagebus/intermediatesession.h @@ -40,7 +40,7 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<IntermediateSession> UP; + using UP = std::unique_ptr<IntermediateSession>; /** * The destructor untangles from messagebus. After this method returns, messagebus will not invoke any diff --git a/messagebus/src/vespa/messagebus/iprotocol.h b/messagebus/src/vespa/messagebus/iprotocol.h index e46a5600471..a908a9c133c 100644 --- a/messagebus/src/vespa/messagebus/iprotocol.h +++ b/messagebus/src/vespa/messagebus/iprotocol.h @@ -27,12 +27,12 @@ public: /** * Convenience typedef for an auto pointer to an IProtocol object. */ - typedef std::unique_ptr<IProtocol> UP; + using UP = std::unique_ptr<IProtocol>; /** * Convenience typedef for a shared pointer to a IProtocol object. */ - typedef std::shared_ptr<IProtocol> SP; + using SP = std::shared_ptr<IProtocol>; /** * Obtain the name of this protocol. diff --git a/messagebus/src/vespa/messagebus/ithrottlepolicy.h b/messagebus/src/vespa/messagebus/ithrottlepolicy.h index 6ae0a0426ec..f654df800c0 100644 --- a/messagebus/src/vespa/messagebus/ithrottlepolicy.h +++ b/messagebus/src/vespa/messagebus/ithrottlepolicy.h @@ -17,8 +17,8 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<IThrottlePolicy> UP; - typedef std::shared_ptr<IThrottlePolicy> SP; + using UP = std::unique_ptr<IThrottlePolicy>; + using SP = std::shared_ptr<IThrottlePolicy>; /** * Virtual destructor required for inheritance. diff --git a/messagebus/src/vespa/messagebus/itimer.h b/messagebus/src/vespa/messagebus/itimer.h index b5b32fb22f4..8841751b72d 100644 --- a/messagebus/src/vespa/messagebus/itimer.h +++ b/messagebus/src/vespa/messagebus/itimer.h @@ -15,7 +15,7 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<ITimer> UP; + using UP = std::unique_ptr<ITimer>; /** * Virtual destructor required for inheritance. diff --git a/messagebus/src/vespa/messagebus/messagebus.cpp b/messagebus/src/vespa/messagebus/messagebus.cpp index 49ea955754c..8012eabf9b1 100644 --- a/messagebus/src/vespa/messagebus/messagebus.cpp +++ b/messagebus/src/vespa/messagebus/messagebus.cpp @@ -256,7 +256,7 @@ MessageBus::unregisterSession(const string &sessionName) RoutingTable::SP MessageBus::getRoutingTable(const string &protocol) { - typedef std::map<string, RoutingTable::SP>::iterator ITR; + using ITR = std::map<string, RoutingTable::SP>::iterator; std::lock_guard guard(_lock); ITR itr = _routingTables.find(protocol); if (itr == _routingTables.end()) { diff --git a/messagebus/src/vespa/messagebus/messenger.h b/messagebus/src/vespa/messagebus/messenger.h index 0d36e6006cb..6ec42ed9c4c 100644 --- a/messagebus/src/vespa/messagebus/messenger.h +++ b/messagebus/src/vespa/messagebus/messenger.h @@ -30,7 +30,7 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<ITask> UP; + using UP = std::unique_ptr<ITask>; /** * Returns the priority of this task. diff --git a/messagebus/src/vespa/messagebus/network/iserviceaddress.h b/messagebus/src/vespa/messagebus/network/iserviceaddress.h index 0ffce7fd2d6..fe55cdd98c7 100644 --- a/messagebus/src/vespa/messagebus/network/iserviceaddress.h +++ b/messagebus/src/vespa/messagebus/network/iserviceaddress.h @@ -17,7 +17,7 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<IServiceAddress> UP; + using UP = std::unique_ptr<IServiceAddress>; /** * Virtual destructor required for inheritance. diff --git a/messagebus/src/vespa/messagebus/network/rpcsend_private.h b/messagebus/src/vespa/messagebus/network/rpcsend_private.h index 5d501cf9115..bc68f39507a 100644 --- a/messagebus/src/vespa/messagebus/network/rpcsend_private.h +++ b/messagebus/src/vespa/messagebus/network/rpcsend_private.h @@ -38,7 +38,7 @@ private: vespalib::Version _version; public: - typedef std::unique_ptr<ReplyContext> UP; + using UP = std::unique_ptr<ReplyContext>; ReplyContext(const ReplyContext &) = delete; ReplyContext & operator = (const ReplyContext &) = delete; diff --git a/messagebus/src/vespa/messagebus/network/rpcservice.h b/messagebus/src/vespa/messagebus/network/rpcservice.h index 83b7083a788..ab18503c85b 100644 --- a/messagebus/src/vespa/messagebus/network/rpcservice.h +++ b/messagebus/src/vespa/messagebus/network/rpcservice.h @@ -15,7 +15,7 @@ class RPCNetwork; */ class RPCService { private: - typedef slobrok::api::IMirrorAPI Mirror; + using Mirror = slobrok::api::IMirrorAPI ; string _serviceName; string _connectionSpec; diff --git a/messagebus/src/vespa/messagebus/network/rpcserviceaddress.h b/messagebus/src/vespa/messagebus/network/rpcserviceaddress.h index d5b7396fc50..2ca57474a80 100644 --- a/messagebus/src/vespa/messagebus/network/rpcserviceaddress.h +++ b/messagebus/src/vespa/messagebus/network/rpcserviceaddress.h @@ -23,7 +23,7 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<RPCServiceAddress> UP; + using UP = std::unique_ptr<RPCServiceAddress>; /** * Constructs a service address from the given specifications. The last component of the service is stored diff --git a/messagebus/src/vespa/messagebus/network/rpctarget.h b/messagebus/src/vespa/messagebus/network/rpctarget.h index b6f1bf116c5..fffffae64f7 100644 --- a/messagebus/src/vespa/messagebus/network/rpctarget.h +++ b/messagebus/src/vespa/messagebus/network/rpctarget.h @@ -39,7 +39,7 @@ public: }; private: - typedef std::vector<IVersionHandler*> HandlerList; + using HandlerList = std::vector<IVersionHandler*>; enum ResolveState { VERSION_NOT_RESOLVED, @@ -47,7 +47,7 @@ private: PROCESSING_HANDLERS, VERSION_RESOLVED, }; - typedef std::unique_ptr<vespalib::Version> Version_UP; + using Version_UP = std::unique_ptr<vespalib::Version>; std::mutex _lock; std::condition_variable _cond; @@ -62,7 +62,7 @@ public: /** * Convenience typedefs. */ - typedef std::shared_ptr<RPCTarget> SP; + using SP = std::shared_ptr<RPCTarget>; /** * Constructs a new instance of this class. This object creates and diff --git a/messagebus/src/vespa/messagebus/reply.h b/messagebus/src/vespa/messagebus/reply.h index 57cc02407b9..550f8e68e44 100644 --- a/messagebus/src/vespa/messagebus/reply.h +++ b/messagebus/src/vespa/messagebus/reply.h @@ -26,7 +26,7 @@ public: /** * Convenience typedef for an auto pointer to a Reply object. */ - typedef std::unique_ptr<Reply> UP; + using UP = std::unique_ptr<Reply>; /** * Constructs a new instance of this class. This object is useless until the diff --git a/messagebus/src/vespa/messagebus/routable.h b/messagebus/src/vespa/messagebus/routable.h index ca0bc6a438b..eaf14a93e87 100644 --- a/messagebus/src/vespa/messagebus/routable.h +++ b/messagebus/src/vespa/messagebus/routable.h @@ -32,7 +32,7 @@ public: /** * Convenience typedef for an auto pointer to a Routable object. */ - typedef std::unique_ptr<Routable> UP; + using UP = std::unique_ptr<Routable>; Routable(const Routable &) = delete; Routable & operator = (const Routable &) = delete; diff --git a/messagebus/src/vespa/messagebus/routing/hop.h b/messagebus/src/vespa/messagebus/routing/hop.h index af169e2dbc5..4a64c16057a 100644 --- a/messagebus/src/vespa/messagebus/routing/hop.h +++ b/messagebus/src/vespa/messagebus/routing/hop.h @@ -20,7 +20,7 @@ public: /** * Convenience typedef for an auto-pointer to a hop. */ - typedef std::unique_ptr<Hop> UP; + using UP = std::unique_ptr<Hop>; /** * Constructs an empty hop. diff --git a/messagebus/src/vespa/messagebus/routing/ihopdirective.h b/messagebus/src/vespa/messagebus/routing/ihopdirective.h index 7b0d0597fc7..d9991415d10 100644 --- a/messagebus/src/vespa/messagebus/routing/ihopdirective.h +++ b/messagebus/src/vespa/messagebus/routing/ihopdirective.h @@ -28,8 +28,8 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<IHopDirective> UP; - typedef std::shared_ptr<IHopDirective> SP; + using UP = std::unique_ptr<IHopDirective>; + using SP = std::shared_ptr<IHopDirective>; /** * Implements a virtual destructor to allow virtual methods. diff --git a/messagebus/src/vespa/messagebus/routing/iroutingpolicy.h b/messagebus/src/vespa/messagebus/routing/iroutingpolicy.h index 13fee63cd33..adb9c8890e0 100644 --- a/messagebus/src/vespa/messagebus/routing/iroutingpolicy.h +++ b/messagebus/src/vespa/messagebus/routing/iroutingpolicy.h @@ -19,8 +19,8 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<IRoutingPolicy> UP; - typedef std::shared_ptr<IRoutingPolicy> SP; + using UP = std::unique_ptr<IRoutingPolicy>; + using SP = std::shared_ptr<IRoutingPolicy>; IRoutingPolicy(const IRoutingPolicy &) = delete; IRoutingPolicy & operator = (const IRoutingPolicy &) = delete; diff --git a/messagebus/src/vespa/messagebus/routing/resender.h b/messagebus/src/vespa/messagebus/routing/resender.h index fbce5c7fe8e..b395639ec2d 100644 --- a/messagebus/src/vespa/messagebus/routing/resender.h +++ b/messagebus/src/vespa/messagebus/routing/resender.h @@ -23,7 +23,7 @@ class Resender { private: using time_point = std::chrono::steady_clock::time_point; - typedef std::pair<time_point , RoutingNode*> Entry; + using Entry = std::pair<time_point , RoutingNode*>; struct Cmp { bool operator()(const Entry &a, const Entry &b) { return (b.first < a.first); @@ -38,7 +38,7 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<Resender> UP; + using UP = std::unique_ptr<Resender>; Resender(const Resender &) = delete; Resender & operator = (const Resender &) = delete; diff --git a/messagebus/src/vespa/messagebus/routing/route.h b/messagebus/src/vespa/messagebus/routing/route.h index d5ef259212a..d5839c128d1 100644 --- a/messagebus/src/vespa/messagebus/routing/route.h +++ b/messagebus/src/vespa/messagebus/routing/route.h @@ -23,7 +23,7 @@ public: /** * Convenience typedef for an auto-pointer to a route. */ - typedef std::unique_ptr<Route> UP; + using UP = std::unique_ptr<Route>; /** * Parses the given string as a list of space-separated hops. The {@link this#toString()} method is compatible with diff --git a/messagebus/src/vespa/messagebus/routing/routingcontext.h b/messagebus/src/vespa/messagebus/routing/routingcontext.h index 2700badb1d4..d1323c35f22 100644 --- a/messagebus/src/vespa/messagebus/routing/routingcontext.h +++ b/messagebus/src/vespa/messagebus/routing/routingcontext.h @@ -31,7 +31,7 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<RoutingContext> UP; + using UP = std::unique_ptr<RoutingContext>; /** * Constructs a new routing context for a given routing node and hop. diff --git a/messagebus/src/vespa/messagebus/routing/routingnode.h b/messagebus/src/vespa/messagebus/routing/routingnode.h index f64afa07f01..d6d4da64ae4 100644 --- a/messagebus/src/vespa/messagebus/routing/routingnode.h +++ b/messagebus/src/vespa/messagebus/routing/routingnode.h @@ -211,7 +211,7 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<RoutingNode> UP; + using UP = std::unique_ptr<RoutingNode>; /** * Constructs a new instance of this class. This is the root node diff --git a/messagebus/src/vespa/messagebus/routing/routingtable.h b/messagebus/src/vespa/messagebus/routing/routingtable.h index 99d8ade2efe..1cb113fa17c 100644 --- a/messagebus/src/vespa/messagebus/routing/routingtable.h +++ b/messagebus/src/vespa/messagebus/routing/routingtable.h @@ -63,7 +63,7 @@ public: /** * Convenience typedef for a shared pointer to a RoutingTable object. */ - typedef std::shared_ptr<RoutingTable> SP; + using SP = std::shared_ptr<RoutingTable>; RoutingTable(const RoutingTable &) = delete; RoutingTable & operator = (const RoutingTable &) = delete; diff --git a/messagebus/src/vespa/messagebus/rpcmessagebus.h b/messagebus/src/vespa/messagebus/rpcmessagebus.h index ed4258bef2d..ae6fff065dd 100644 --- a/messagebus/src/vespa/messagebus/rpcmessagebus.h +++ b/messagebus/src/vespa/messagebus/rpcmessagebus.h @@ -28,8 +28,8 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<RPCMessageBus> UP; - typedef std::shared_ptr<RPCMessageBus> SP; + using UP = std::unique_ptr<RPCMessageBus>; + using SP = std::shared_ptr<RPCMessageBus>; RPCMessageBus(const RPCMessageBus &) = delete; RPCMessageBus & operator = (const RPCMessageBus &) = delete; diff --git a/messagebus/src/vespa/messagebus/sequencer.h b/messagebus/src/vespa/messagebus/sequencer.h index 676de2bd08c..be6f03497c4 100644 --- a/messagebus/src/vespa/messagebus/sequencer.h +++ b/messagebus/src/vespa/messagebus/sequencer.h @@ -24,8 +24,8 @@ private: std::mutex _lock; IMessageHandler &_sender; - typedef Queue<Message*> MessageQueue; - typedef std::map<uint64_t, MessageQueue*> QueueMap; + using MessageQueue = Queue<Message*>; + using QueueMap = std::map<uint64_t, MessageQueue*>; QueueMap _seqMap; private: @@ -51,7 +51,7 @@ public: /** * Convenience typedef for an auto pointer to a Sequencer object. */ - typedef std::unique_ptr<Sequencer> UP; + using UP = std::unique_ptr<Sequencer>; /** * Create a new Sequencer using the given sender to send messages. diff --git a/messagebus/src/vespa/messagebus/sourcesession.h b/messagebus/src/vespa/messagebus/sourcesession.h index 364533ece17..d918724ad4f 100644 --- a/messagebus/src/vespa/messagebus/sourcesession.h +++ b/messagebus/src/vespa/messagebus/sourcesession.h @@ -48,7 +48,7 @@ public: /** * Convenience typedef for an auto pointer to a SourceSession object. **/ - typedef std::unique_ptr<SourceSession> UP; + using UP = std::unique_ptr<SourceSession>; /** * The destructor untangles from messagebus. This is safe, but you will loose the replies of all pending diff --git a/messagebus/src/vespa/messagebus/staticthrottlepolicy.h b/messagebus/src/vespa/messagebus/staticthrottlepolicy.h index cbc75151306..ad5eeada309 100644 --- a/messagebus/src/vespa/messagebus/staticthrottlepolicy.h +++ b/messagebus/src/vespa/messagebus/staticthrottlepolicy.h @@ -24,8 +24,8 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<StaticThrottlePolicy> UP; - typedef std::shared_ptr<StaticThrottlePolicy> SP; + using UP = std::unique_ptr<StaticThrottlePolicy>; + using SP = std::shared_ptr<StaticThrottlePolicy>; /** * Constructs a new instance of this policy and sets the appropriate default values of member data. diff --git a/messagebus/src/vespa/messagebus/testlib/custompolicy.cpp b/messagebus/src/vespa/messagebus/testlib/custompolicy.cpp index b8518f60c76..94e051b0752 100644 --- a/messagebus/src/vespa/messagebus/testlib/custompolicy.cpp +++ b/messagebus/src/vespa/messagebus/testlib/custompolicy.cpp @@ -126,8 +126,8 @@ void CustomPolicyFactory::parseRoutes(const string &str, std::vector<Route> &routes) { - typedef boost::char_separator<char> Separator; - typedef boost::tokenizer<Separator> Tokenizer; + using Separator = boost::char_separator<char>; + using Tokenizer = boost::tokenizer<Separator>; Separator separator(","); std::string stdstr(str); Tokenizer tokenizer(stdstr, separator); diff --git a/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h b/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h index 0486f058217..1f1a4b46f07 100644 --- a/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h +++ b/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h @@ -17,7 +17,7 @@ public: /** * Convenience typedefs. */ - typedef std::shared_ptr<IPolicyFactory> SP; + using SP = std::shared_ptr<IPolicyFactory>; /** * Required for inheritance. @@ -34,7 +34,7 @@ public: }; private: - typedef std::map<string, IPolicyFactory::SP> FactoryMap; + using FactoryMap = std::map<string, IPolicyFactory::SP>; FactoryMap _policies; public: diff --git a/messagebus/src/vespa/messagebus/testlib/simplereply.h b/messagebus/src/vespa/messagebus/testlib/simplereply.h index acfa48a77fe..1e6005b586b 100644 --- a/messagebus/src/vespa/messagebus/testlib/simplereply.h +++ b/messagebus/src/vespa/messagebus/testlib/simplereply.h @@ -13,7 +13,7 @@ private: string _value; SimpleReply &operator=(const SimpleReply &); public: - typedef std::unique_ptr<SimpleReply> UP; + using UP = std::unique_ptr<SimpleReply>; SimpleReply(const string &str); virtual ~SimpleReply(); void setValue(const string &value); diff --git a/messagebus/src/vespa/messagebus/testlib/slobrok.h b/messagebus/src/vespa/messagebus/testlib/slobrok.h index 4b4b21ddcbd..7810222f07d 100644 --- a/messagebus/src/vespa/messagebus/testlib/slobrok.h +++ b/messagebus/src/vespa/messagebus/testlib/slobrok.h @@ -33,7 +33,7 @@ private: void init(); public: - typedef std::unique_ptr<Slobrok> UP; + using UP = std::unique_ptr<Slobrok>; Slobrok(); Slobrok(int port); ~Slobrok(); diff --git a/messagebus/src/vespa/messagebus/testlib/slobrokstate.h b/messagebus/src/vespa/messagebus/testlib/slobrokstate.h index 7eea0450be2..b4fe368c391 100644 --- a/messagebus/src/vespa/messagebus/testlib/slobrokstate.h +++ b/messagebus/src/vespa/messagebus/testlib/slobrokstate.h @@ -10,8 +10,8 @@ namespace mbus { class SlobrokState { public: - typedef std::vector<std::pair<string, uint32_t> > TYPE; - typedef TYPE::const_iterator ITR; + using TYPE = std::vector<std::pair<string, uint32_t> >; + using ITR = TYPE::const_iterator; private: TYPE _data; diff --git a/messagebus/src/vespa/messagebus/testlib/testserver.h b/messagebus/src/vespa/messagebus/testlib/testserver.h index 7d144689f9f..1ea96c3e13f 100644 --- a/messagebus/src/vespa/messagebus/testlib/testserver.h +++ b/messagebus/src/vespa/messagebus/testlib/testserver.h @@ -28,7 +28,7 @@ public: class TestServer { public: - typedef std::unique_ptr<TestServer> UP; + using UP = std::unique_ptr<TestServer>; TestServer(const TestServer &) = delete; TestServer & operator = (const TestServer &) = delete; diff --git a/messagebus/src/vespa/messagebus/tracelevel.h b/messagebus/src/vespa/messagebus/tracelevel.h index 949fc1ddc9a..e2bf15e02b8 100644 --- a/messagebus/src/vespa/messagebus/tracelevel.h +++ b/messagebus/src/vespa/messagebus/tracelevel.h @@ -4,7 +4,7 @@ #include <vespa/vespalib/trace/tracelevel.h> namespace mbus { - typedef vespalib::TraceLevel TraceLevel; + using TraceLevel = vespalib::TraceLevel; } // namespace mbus diff --git a/metrics/src/vespa/metrics/memoryconsumption.h b/metrics/src/vespa/metrics/memoryconsumption.h index ef86bebfa72..149b91cf700 100644 --- a/metrics/src/vespa/metrics/memoryconsumption.h +++ b/metrics/src/vespa/metrics/memoryconsumption.h @@ -27,7 +27,7 @@ struct SnapShotUsage; class MemoryConsumption : public vespalib::Printable { public: - typedef std::unique_ptr<MemoryConsumption> UP; + using UP = std::unique_ptr<MemoryConsumption>; uint32_t _consumerCount; uint32_t _consumerId; diff --git a/metrics/src/vespa/metrics/metricmanager.h b/metrics/src/vespa/metrics/metricmanager.h index 0efbe1b091a..323e90253b9 100644 --- a/metrics/src/vespa/metrics/metricmanager.h +++ b/metrics/src/vespa/metrics/metricmanager.h @@ -76,7 +76,7 @@ public: * to is a metric set. */ struct ConsumerSpec : public vespalib::Printable { - typedef std::shared_ptr<ConsumerSpec> SP; + using SP = std::shared_ptr<ConsumerSpec>; vespalib::hash_set<Metric::String> includedMetrics; ConsumerSpec(ConsumerSpec &&) noexcept = default; @@ -104,7 +104,7 @@ private: std::list<UpdateHook*> _snapshotUpdateHooks; mutable std::mutex _waiter; mutable std::condition_variable _cond; - typedef std::pair<uint32_t, time_t> PeriodTimePair; + using PeriodTimePair = std::pair<uint32_t, time_t>; std::vector<MetricSnapshotSet::SP> _snapshots; MetricSnapshot::SP _totalMetrics; std::unique_ptr<Timer> _timer; @@ -289,7 +289,7 @@ private: void handleMetricsAltered(const MetricLockGuard & guard); - typedef std::pair<uint32_t, std::string> SnapSpec; + using SnapSpec = std::pair<uint32_t, std::string>; static std::vector<SnapSpec> createSnapshotPeriods( const MetricsmanagerConfig& config); void assertMetricLockLocked(const MetricLockGuard& g) const; }; diff --git a/metrics/src/vespa/metrics/metricset.cpp b/metrics/src/vespa/metrics/metricset.cpp index c4a6861ddf1..602dd9e500c 100644 --- a/metrics/src/vespa/metrics/metricset.cpp +++ b/metrics/src/vespa/metrics/metricset.cpp @@ -191,7 +191,7 @@ MetricSet::unregisterMetric(Metric& metric) } namespace { - typedef vespalib::stringref TmpString; + using TmpString = vespalib::stringref; class StringMetric { public: StringMetric(const TmpString & s, Metric * m) : first(s), second(m) { } @@ -204,7 +204,7 @@ namespace { }; bool operator < (const TmpString & a, const StringMetric & b) { return a < b.first; } - typedef std::vector<StringMetric> SortedVector; + using SortedVector = std::vector<StringMetric>; void createMetricMap(SortedVector& metricMap, const std::vector<Metric*>& orderedList) @@ -227,7 +227,7 @@ MetricSet::addTo(Metric& other, std::vector<Metric::UP> *ownerList) const createMetricMap(map2, o._metricOrder); SortedVector::iterator source(map1.begin()); SortedVector::iterator target(map2.begin()); - typedef vespalib::hash_map<TmpString, Metric*> HashMap; + using HashMap = vespalib::hash_map<TmpString, Metric*>; HashMap newMetrics; while (source != map1.end()) { if (target == map2.end() || source->first < target->first) { diff --git a/metrics/src/vespa/metrics/metricsnapshot.h b/metrics/src/vespa/metrics/metricsnapshot.h index f75a7031b78..cc6ec4cbb2e 100644 --- a/metrics/src/vespa/metrics/metricsnapshot.h +++ b/metrics/src/vespa/metrics/metricsnapshot.h @@ -32,8 +32,8 @@ class MetricSnapshot mutable std::vector<Metric::UP> _metrics; public: - typedef std::unique_ptr<MetricSnapshot> UP; - typedef std::shared_ptr<MetricSnapshot> SP; + using UP = std::unique_ptr<MetricSnapshot>; + using SP = std::shared_ptr<MetricSnapshot>; /** Create a fresh empty top level snapshot. */ MetricSnapshot(const Metric::String& name); @@ -80,7 +80,7 @@ class MetricSnapshotSet { MetricSnapshot::UP _current; // The last full period MetricSnapshot::UP _building; // The building period public: - typedef std::shared_ptr<MetricSnapshotSet> SP; + using SP = std::shared_ptr<MetricSnapshotSet>; MetricSnapshotSet(const Metric::String& name, uint32_t period, uint32_t count, const MetricSet& source, diff --git a/metrics/src/vespa/metrics/summetric.h b/metrics/src/vespa/metrics/summetric.h index 6d51d22b450..b94c4b791ec 100644 --- a/metrics/src/vespa/metrics/summetric.h +++ b/metrics/src/vespa/metrics/summetric.h @@ -30,7 +30,7 @@ public: Metric::UP _startValue; public: - typedef std::shared_ptr<StartValue> SP; + using SP = std::shared_ptr<StartValue>; StartValue(const AddendMetric &metric) : _startValueChildren(), _startValue(metric.clone(_startValueChildren, CLONE, 0, false)) {} diff --git a/metrics/src/vespa/metrics/valuemetric.h b/metrics/src/vespa/metrics/valuemetric.h index 9d5f0a82735..1be796ab1aa 100644 --- a/metrics/src/vespa/metrics/valuemetric.h +++ b/metrics/src/vespa/metrics/valuemetric.h @@ -149,10 +149,10 @@ public: void addToSnapshot(Metric&, std::vector<Metric::UP> &) const override; }; -typedef ValueMetric<double, double, true> DoubleValueMetric; -typedef ValueMetric<double, double, false> DoubleAverageMetric; -typedef ValueMetric<int64_t, int64_t, true> LongValueMetric; -typedef ValueMetric<int64_t, int64_t, false> LongAverageMetric; +using DoubleValueMetric = ValueMetric<double, double, true>; +using DoubleAverageMetric = ValueMetric<double, double, false>; +using LongValueMetric = ValueMetric<int64_t, int64_t, true>; +using LongAverageMetric = ValueMetric<int64_t, int64_t, false>; } // metrics diff --git a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp index fac6b0562a3..8698e44bef5 100644 --- a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp +++ b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp @@ -90,8 +90,8 @@ createClusterState(const lib::State& nodeState = lib::State::UP) using storage::lib::NodeType; using storage::lib::State; using vespa::config::content::StorDistributionConfigBuilder; - typedef StorDistributionConfigBuilder::Group Group; - typedef Group::Nodes Nodes; + using Group = StorDistributionConfigBuilder::Group; + using Nodes = Group::Nodes; storage::lib::ClusterState cstate; StorDistributionConfigBuilder dc; diff --git a/persistence/src/vespa/persistence/conformancetest/conformancetest.h b/persistence/src/vespa/persistence/conformancetest/conformancetest.h index 57c67bbb641..da779e1587b 100644 --- a/persistence/src/vespa/persistence/conformancetest/conformancetest.h +++ b/persistence/src/vespa/persistence/conformancetest/conformancetest.h @@ -27,7 +27,7 @@ class ConformanceTest : public ::testing::Test { public: using PersistenceProviderUP = std::unique_ptr<PersistenceProvider>; struct PersistenceFactory { - typedef std::unique_ptr<PersistenceFactory> UP; + using UP = std::unique_ptr<PersistenceFactory>; virtual ~PersistenceFactory() = default; virtual PersistenceProviderUP getPersistenceImplementation( diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp index ccdbf01a81f..7f2b553e19d 100644 --- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp +++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp @@ -578,7 +578,7 @@ DummyPersistence::createIterator(const Bucket &b, FieldSetSP fs, const Selection const BucketContent::GidMapType& gidMap((*bc)->_gidMap); if (s.getTimestampSubset().empty()) { - typedef std::vector<BucketEntry>::const_reverse_iterator reverse_iterator; + using reverse_iterator = std::vector<BucketEntry>::const_reverse_iterator; for (reverse_iterator entryIter((*bc)->_entries.rbegin()), entryEnd((*bc)->_entries.rend()); entryIter != entryEnd; ++entryIter) diff --git a/persistence/src/vespa/persistence/spi/clusterstate.h b/persistence/src/vespa/persistence/spi/clusterstate.h index bde7e5bdbf4..0f073e3a553 100644 --- a/persistence/src/vespa/persistence/spi/clusterstate.h +++ b/persistence/src/vespa/persistence/spi/clusterstate.h @@ -19,7 +19,7 @@ class Bucket; */ class ClusterState { public: - typedef std::shared_ptr<ClusterState> SP; + using SP = std::shared_ptr<ClusterState>; ClusterState(const lib::ClusterState& state, uint16_t nodeIndex, diff --git a/persistence/src/vespa/persistence/spi/context.h b/persistence/src/vespa/persistence/spi/context.h index ab55f0d1844..4b90641d35d 100644 --- a/persistence/src/vespa/persistence/spi/context.h +++ b/persistence/src/vespa/persistence/spi/context.h @@ -34,11 +34,11 @@ namespace storage::spi { -typedef uint16_t Priority; // 0 - max pri, 255 - min pri +using Priority = uint16_t; // 0 - max pri, 255 - min pri // Define this type just because a ton of tests currently use it. struct Trace { - typedef int TraceLevel; + using TraceLevel = int; }; class Context { diff --git a/persistence/src/vespa/persistence/spi/result.h b/persistence/src/vespa/persistence/spi/result.h index 5046a380c86..54fc52f5234 100644 --- a/persistence/src/vespa/persistence/spi/result.h +++ b/persistence/src/vespa/persistence/spi/result.h @@ -11,7 +11,7 @@ class DocEntry; class Result { public: - typedef std::unique_ptr<Result> UP; + using UP = std::unique_ptr<Result>; enum class ErrorType { NONE, diff --git a/persistence/src/vespa/persistence/spi/selection.h b/persistence/src/vespa/persistence/spi/selection.h index 4f6d9f9a61f..8a476b585ff 100644 --- a/persistence/src/vespa/persistence/spi/selection.h +++ b/persistence/src/vespa/persistence/spi/selection.h @@ -15,7 +15,7 @@ namespace storage::spi { class Selection { public: - typedef std::vector<Timestamp> TimestampSubset; + using TimestampSubset = std::vector<Timestamp>; private: DocumentSelection _documentSelection; Timestamp _fromTimestamp; diff --git a/persistence/src/vespa/persistence/spi/types.h b/persistence/src/vespa/persistence/spi/types.h index a75b977c14a..33280df72f9 100644 --- a/persistence/src/vespa/persistence/spi/types.h +++ b/persistence/src/vespa/persistence/spi/types.h @@ -27,7 +27,7 @@ namespace document { class name { \ type _value; \ public: \ - typedef type Type; \ + using Type = type; \ name() noexcept : _value() {} \ explicit name(type v) noexcept : _value(v) {} \ operator type() const noexcept { return _value; } \ diff --git a/searchsummary/src/tests/juniper/auxTest.cpp b/searchsummary/src/tests/juniper/auxTest.cpp index ef22b0542af..8eda6a2132a 100644 --- a/searchsummary/src/tests/juniper/auxTest.cpp +++ b/searchsummary/src/tests/juniper/auxTest.cpp @@ -664,7 +664,7 @@ AuxTest::assertChar(ucs4_t act, char exp) return _test((char) act == exp); } -typedef std::unique_ptr<QueryNode> QueryNodeUP; +using QueryNodeUP = std::unique_ptr<QueryNode>; struct QB { QueryNodeUP q; QB(size_t numTerms) : q(new QueryNode(numTerms, 0, 0)) {} @@ -694,7 +694,7 @@ void AuxTest::TestSpecialTokenRegistry() { { - typedef SpecialTokenRegistry::CharStream CharStream; + using CharStream = SpecialTokenRegistry::CharStream; ucs4_t buf[16]; { std::string text = " c+-"; diff --git a/searchsummary/src/tests/juniper/auxTest.h b/searchsummary/src/tests/juniper/auxTest.h index 9ff391911b3..70d7c8e6d23 100644 --- a/searchsummary/src/tests/juniper/auxTest.h +++ b/searchsummary/src/tests/juniper/auxTest.h @@ -17,7 +17,7 @@ public: virtual ~AuxTest(); typedef void(AuxTest::* tst_method_ptr) (); - typedef std::map<std::string, tst_method_ptr> MethodContainer; + using MethodContainer = std::map<std::string, tst_method_ptr>; MethodContainer test_methods_; void init(); diff --git a/searchsummary/src/tests/juniper/latintokenizertest.h b/searchsummary/src/tests/juniper/latintokenizertest.h index b4d113918ee..d06a3ae9289 100644 --- a/searchsummary/src/tests/juniper/latintokenizertest.h +++ b/searchsummary/src/tests/juniper/latintokenizertest.h @@ -371,7 +371,7 @@ private: void LatinTokenizerTest::TestTypeparamObservers() { - typedef Fast_LatinTokenizer<TPS,TPS> MyTokenizer; + using MyTokenizer = Fast_LatinTokenizer<TPS,TPS>; PushDesc("TypeparamObservers\n"); std::string text("4Some6text"); @@ -390,7 +390,7 @@ void LatinTokenizerTest::TestTypeparamObservers() void LatinTokenizerTest::TestMapelURL() { - typedef Fast_LatinTokenizer<Maple_Space, Mapel_Pucntuation> MyTokenizer; + using MyTokenizer = Fast_LatinTokenizer<Maple_Space, Mapel_Pucntuation>; PushDesc("MapelURL\n"); std::string text("http://search.msn.co.uk/results.asp?q= cfg=SMCBROWSE rn=1825822 dp=1873075 v=166:"); diff --git a/searchsummary/src/tests/juniper/matchobjectTest.h b/searchsummary/src/tests/juniper/matchobjectTest.h index 9fdd3e4719f..f85973e7dd6 100644 --- a/searchsummary/src/tests/juniper/matchobjectTest.h +++ b/searchsummary/src/tests/juniper/matchobjectTest.h @@ -74,7 +74,7 @@ class MatchObjectTest : public Test { void tearDown(); typedef void(MatchObjectTest::* tst_method_ptr) (); - typedef std::map<std::string, tst_method_ptr> MethodContainer; + using MethodContainer = std::map<std::string, tst_method_ptr>; MethodContainer test_methods_; void init(); diff --git a/searchsummary/src/tests/juniper/mcandTest.h b/searchsummary/src/tests/juniper/mcandTest.h index 6eb8b4d66e5..37613c6b9ab 100644 --- a/searchsummary/src/tests/juniper/mcandTest.h +++ b/searchsummary/src/tests/juniper/mcandTest.h @@ -172,7 +172,7 @@ class MatchCandidateTest : public Test { void tearDown(); typedef void(MatchCandidateTest::* tst_method_ptr) (); - typedef std::map<std::string, tst_method_ptr> MethodContainer; + using MethodContainer = std::map<std::string, tst_method_ptr>; MethodContainer test_methods_; void init(); protected: diff --git a/searchsummary/src/tests/juniper/queryparserTest.h b/searchsummary/src/tests/juniper/queryparserTest.h index 803fbd4c999..45d2e966e99 100644 --- a/searchsummary/src/tests/juniper/queryparserTest.h +++ b/searchsummary/src/tests/juniper/queryparserTest.h @@ -73,7 +73,7 @@ class QueryParserTest : public Test { void tearDown(); typedef void(QueryParserTest::* tst_method_ptr) (); - typedef std::map<std::string, tst_method_ptr> MethodContainer; + using MethodContainer = std::map<std::string, tst_method_ptr>; MethodContainer test_methods_; void init(); diff --git a/searchsummary/src/tests/juniper/testenv.h b/searchsummary/src/tests/juniper/testenv.h index f723fb96602..11b975d0888 100644 --- a/searchsummary/src/tests/juniper/testenv.h +++ b/searchsummary/src/tests/juniper/testenv.h @@ -66,5 +66,5 @@ extern Juniper * _Juniper; } // end namespace juniper -typedef juniper::TestQuery TestQuery; +using TestQuery = juniper::TestQuery; diff --git a/searchsummary/src/vespa/juniper/Matcher.cpp b/searchsummary/src/vespa/juniper/Matcher.cpp index 76f4a17ad1c..9f7db56823a 100644 --- a/searchsummary/src/vespa/juniper/Matcher.cpp +++ b/searchsummary/src/vespa/juniper/Matcher.cpp @@ -60,7 +60,7 @@ Matcher::~Matcher() MatchCandidate* Matcher::NewCandidate(QueryExpr* query) { - typedef MatchElement * MatchElementP; + using MatchElementP = MatchElement *; return new MatchCandidate(query, new MatchElementP[query->_arity], _ctxt_start); } diff --git a/searchsummary/src/vespa/juniper/Matcher.h b/searchsummary/src/vespa/juniper/Matcher.h index 5564537ae4a..a23fd225cf3 100644 --- a/searchsummary/src/vespa/juniper/Matcher.h +++ b/searchsummary/src/vespa/juniper/Matcher.h @@ -47,7 +47,7 @@ class SummaryDesc; class SummaryConfig; class QueryTerm; -typedef std::list<MatchCandidate*> match_sequence; +using match_sequence = std::list<MatchCandidate*>; class Matcher : public ITokenProcessor { diff --git a/searchsummary/src/vespa/juniper/hashbase.h b/searchsummary/src/vespa/juniper/hashbase.h index 2cdfc02800f..6231aa97114 100644 --- a/searchsummary/src/vespa/juniper/hashbase.h +++ b/searchsummary/src/vespa/juniper/hashbase.h @@ -120,9 +120,9 @@ private: Fast_HashTable &operator=(Fast_HashTable &); public: - typedef Fast_HashTableElement<Key, T> element; - typedef Fast_HashTableIterator<Key, T, _tableSize> iterator; - typedef Key keytype; + using element = Fast_HashTableElement<Key, T>; + using iterator = Fast_HashTableIterator<Key, T, _tableSize>; + using keytype = Key; friend class Fast_HashTableIterator<Key, T, _tableSize>; @@ -144,7 +144,7 @@ protected: public: Fast_HashTable() : _numElements(0), _lookupTable(NULL), _compare() { - typedef element dummyDef; + using dummyDef = element; _lookupTable = new dummyDef* [_tableSize]; memset(_lookupTable, 0, _tableSize * sizeof(element *)); } diff --git a/searchsummary/src/vespa/juniper/latintokenizer.h b/searchsummary/src/vespa/juniper/latintokenizer.h index 7a98d780c56..1b0b49d7329 100644 --- a/searchsummary/src/vespa/juniper/latintokenizer.h +++ b/searchsummary/src/vespa/juniper/latintokenizer.h @@ -374,4 +374,4 @@ struct Fast_IsPunctuation { * @date Creation date: 2001-12-07 *****************************************************************************/ -typedef Fast_LatinTokenizer<Fast_IsSpace, Fast_IsPunctuation> Fast_SimpleLatinTokenizer; +using Fast_SimpleLatinTokenizer = Fast_LatinTokenizer<Fast_IsSpace, Fast_IsPunctuation>; diff --git a/searchsummary/src/vespa/juniper/matchelem.h b/searchsummary/src/vespa/juniper/matchelem.h index 7948eabb8ed..b8061c9213f 100644 --- a/searchsummary/src/vespa/juniper/matchelem.h +++ b/searchsummary/src/vespa/juniper/matchelem.h @@ -20,7 +20,7 @@ struct sequential_elem return m1->starttoken() < m2->starttoken(); } }; -typedef std::set<key_occ*, sequential_elem<key_occ*> > keylist; +using keylist = std::set<key_occ*, sequential_elem<key_occ*> >; class MatchElement { diff --git a/searchsummary/src/vespa/juniper/matchobject.h b/searchsummary/src/vespa/juniper/matchobject.h index 3278448e0f7..5ab90c1a61e 100644 --- a/searchsummary/src/vespa/juniper/matchobject.h +++ b/searchsummary/src/vespa/juniper/matchobject.h @@ -8,8 +8,8 @@ #include "reducematcher.h" #include "ITokenProcessor.h" -typedef juniper::Result Result; -typedef ITokenProcessor::Token Token; +using Result = juniper::Result; +using Token = ITokenProcessor::Token; // Reverse length order, longest match first - needed to allow matcher to // match on the most explicit matches before the more implicit ones @@ -72,7 +72,7 @@ public: ~MatchObject(); - typedef match_iterator iterator; + using iterator = match_iterator; /** Check if the given string matches any query term in the MatchObject * @param an iterator that will be updated to iterate over all matching query terms diff --git a/searchsummary/src/vespa/juniper/mcand.h b/searchsummary/src/vespa/juniper/mcand.h index a09a18267c1..46e095fd5cb 100644 --- a/searchsummary/src/vespa/juniper/mcand.h +++ b/searchsummary/src/vespa/juniper/mcand.h @@ -18,7 +18,7 @@ struct gtematch_cand { bool operator()(const MatchCandidate* m1, const MatchCandidate* m2) const; bool gtDistance(const MatchCandidate* m1, const MatchCandidate* m2) const; }; -typedef std::multiset<MatchCandidate*, gtematch_cand> match_candidate_set; +using match_candidate_set = std::multiset<MatchCandidate*, gtematch_cand>; class MatchCandidate : public MatchElement { diff --git a/searchsummary/src/vespa/juniper/queryhandle.h b/searchsummary/src/vespa/juniper/queryhandle.h index d0b266e99ce..a829af7f147 100644 --- a/searchsummary/src/vespa/juniper/queryhandle.h +++ b/searchsummary/src/vespa/juniper/queryhandle.h @@ -12,8 +12,8 @@ class MatchObject; #include "queryvisitor.h" #include "expcache.h" -typedef std::vector<QueryTerm*> queryterm_vector; -typedef std::vector<QueryNode*> querynode_vector; +using queryterm_vector = std::vector<QueryTerm*>; +using querynode_vector = std::vector<QueryNode*>; namespace juniper { diff --git a/searchsummary/src/vespa/juniper/querynode.h b/searchsummary/src/vespa/juniper/querynode.h index c6fecaf1b9f..1c269097940 100644 --- a/searchsummary/src/vespa/juniper/querynode.h +++ b/searchsummary/src/vespa/juniper/querynode.h @@ -33,7 +33,7 @@ class QueryNode; class QueryTerm; -typedef std::vector<QueryNode*> querynode_vector; +using querynode_vector = std::vector<QueryNode*>; // Support slightly extended visitor pattern for QueryExpr nodes.. diff --git a/searchsummary/src/vespa/juniper/queryparser.h b/searchsummary/src/vespa/juniper/queryparser.h index 99d31f4e5ff..a69971f5c8a 100644 --- a/searchsummary/src/vespa/juniper/queryparser.h +++ b/searchsummary/src/vespa/juniper/queryparser.h @@ -21,7 +21,7 @@ struct IsPunctuation { } }; -typedef Fast_LatinTokenizer<Fast_IsSpace, IsPunctuation> WildcardTokenizer; +using WildcardTokenizer = Fast_LatinTokenizer<Fast_IsSpace, IsPunctuation>; class QueryParserQueryItem; @@ -48,7 +48,7 @@ private: inline void setvisitor(IQueryVisitor* v) { _v = v; } bool match(const char* s, bool required = false); - typedef WildcardTokenizer Tokenizer; + using Tokenizer = WildcardTokenizer; Tokenizer _tokenizer; std::map<std::string, int> _op_to_type; const char* _query_string; diff --git a/searchsummary/src/vespa/juniper/queryvisitor.h b/searchsummary/src/vespa/juniper/queryvisitor.h index 7c82d3fa50a..8566e4ff73e 100644 --- a/searchsummary/src/vespa/juniper/queryvisitor.h +++ b/searchsummary/src/vespa/juniper/queryvisitor.h @@ -7,9 +7,9 @@ // Juniper internal implementation of the IQueryVisitor interface as used by // query providers (this is the initial 1.0.x structure implementation) -typedef juniper::QueryItem QueryItem; -typedef juniper::IQuery IQuery; -typedef juniper::QueryHandle QueryHandle; +using QueryItem = juniper::QueryItem; +using IQuery = juniper::IQuery; +using QueryHandle = juniper::QueryHandle; class Matcher; diff --git a/searchsummary/src/vespa/juniper/reducematcher.h b/searchsummary/src/vespa/juniper/reducematcher.h index cfdc252b17e..6be27fcd7ea 100644 --- a/searchsummary/src/vespa/juniper/reducematcher.h +++ b/searchsummary/src/vespa/juniper/reducematcher.h @@ -8,7 +8,7 @@ namespace juniper { -typedef std::map<std::string, std::vector<QueryTerm*> > string_match_table; +using string_match_table = std::map<std::string, std::vector<QueryTerm*> >; class string_matcher { diff --git a/searchsummary/src/vespa/juniper/rpinterface.h b/searchsummary/src/vespa/juniper/rpinterface.h index 41a40e2c98d..5bfee1e2691 100644 --- a/searchsummary/src/vespa/juniper/rpinterface.h +++ b/searchsummary/src/vespa/juniper/rpinterface.h @@ -73,8 +73,8 @@ public: /** * Convenience typedefs. */ - typedef std::unique_ptr<Juniper> UP; - typedef std::shared_ptr<Juniper> SP; + using UP = std::unique_ptr<Juniper>; + using SP = std::shared_ptr<Juniper>; /** Initialize the Juniper subsystem. * @param props A pointer to the object containing all available configuration diff --git a/searchsummary/src/vespa/juniper/sumdesc.h b/searchsummary/src/vespa/juniper/sumdesc.h index a0440a60fba..c1e230f1bf4 100644 --- a/searchsummary/src/vespa/juniper/sumdesc.h +++ b/searchsummary/src/vespa/juniper/sumdesc.h @@ -61,8 +61,8 @@ protected: void add_desc(off_t pos, ssize_t len, bool highlight); - typedef std::set<MatchCandidate*,sequential_elem<MatchCandidate*> > cand_list; - typedef std::list<highlight_desc> print_list; + using cand_list = std::set<MatchCandidate*,sequential_elem<MatchCandidate*> >; + using print_list = std::list<highlight_desc>; /** Helper function to build a simple query highlight of the complete document */ void build_fulldoc_desc(); diff --git a/slobrok/src/vespa/slobrok/cfg.h b/slobrok/src/vespa/slobrok/cfg.h index 9514081ca38..234d41f361b 100644 --- a/slobrok/src/vespa/slobrok/cfg.h +++ b/slobrok/src/vespa/slobrok/cfg.h @@ -26,7 +26,7 @@ public: Configurator(Configurable &target, const config::ConfigUri & uri); ~Configurator(); bool poll(); - typedef std::unique_ptr<Configurator> UP; + using UP = std::unique_ptr<Configurator>; int64_t getGeneration() const; }; diff --git a/slobrok/src/vespa/slobrok/imirrorapi.h b/slobrok/src/vespa/slobrok/imirrorapi.h index c76123d82d7..5b7d8cd9847 100644 --- a/slobrok/src/vespa/slobrok/imirrorapi.h +++ b/slobrok/src/vespa/slobrok/imirrorapi.h @@ -25,7 +25,7 @@ public: * The first element of pair is a string containing the service name. * The second is the connection spec, typically "tcp/foo.bar.com:42" **/ - typedef std::pair<std::string, std::string> Spec; + using Spec = std::pair<std::string, std::string>; /** * @brief vector of <name, connectionspec> pairs. @@ -33,7 +33,7 @@ public: * The first element of each pair is a string containing the service name. * The second is the connection spec, typically "tcp/foo.bar.com:42" **/ - typedef std::vector<Spec> SpecList; + using SpecList = std::vector<Spec>; /** * Obtain all the services matching a given pattern. diff --git a/slobrok/src/vespa/slobrok/sbmirror.h b/slobrok/src/vespa/slobrok/sbmirror.h index 348a79fff12..348f8ac535e 100644 --- a/slobrok/src/vespa/slobrok/sbmirror.h +++ b/slobrok/src/vespa/slobrok/sbmirror.h @@ -31,7 +31,7 @@ public: * * Elements are connection specs, typically "tcp/foo.bar.com:42" **/ - typedef std::vector<std::string> StringList; + using StringList = std::vector<std::string>; /** * @brief Create a new MirrorAPI object using config diff --git a/slobrok/src/vespa/slobrok/server/service_mapping.h b/slobrok/src/vespa/slobrok/server/service_mapping.h index 89a0a5db4b1..bd92a075303 100644 --- a/slobrok/src/vespa/slobrok/server/service_mapping.h +++ b/slobrok/src/vespa/slobrok/server/service_mapping.h @@ -26,6 +26,6 @@ struct ServiceMapping { } }; -typedef std::vector<ServiceMapping> ServiceMappingList; +using ServiceMappingList = std::vector<ServiceMapping>; } diff --git a/storage/src/tests/persistence/common/filestortestfixture.h b/storage/src/tests/persistence/common/filestortestfixture.h index 1a92a2c1944..d0b0f1af074 100644 --- a/storage/src/tests/persistence/common/filestortestfixture.h +++ b/storage/src/tests/persistence/common/filestortestfixture.h @@ -20,8 +20,8 @@ public: static const uint32_t MSG_WAIT_TIME = 60 * 1000; - typedef uint32_t DocumentIndex; - typedef uint64_t PutTimestamp; + using DocumentIndex = uint32_t; + using PutTimestamp = uint64_t; void SetUp() override; void TearDown() override; diff --git a/storage/src/tests/persistence/filestorage/operationabortingtest.cpp b/storage/src/tests/persistence/filestorage/operationabortingtest.cpp index ecf4ddde911..000e1e1c155 100644 --- a/storage/src/tests/persistence/filestorage/operationabortingtest.cpp +++ b/storage/src/tests/persistence/filestorage/operationabortingtest.cpp @@ -31,7 +31,7 @@ class BlockingMockProvider : public PersistenceProviderWrapper vespalib::Barrier& _queueBarrier; vespalib::Barrier& _completionBarrier; public: - typedef std::unique_ptr<BlockingMockProvider> UP; + using UP = std::unique_ptr<BlockingMockProvider>; mutable std::atomic<uint32_t> _bucketInfoInvocations; std::atomic<uint32_t> _createBucketInvocations; diff --git a/storage/src/tests/persistence/mergehandlertest.cpp b/storage/src/tests/persistence/mergehandlertest.cpp index e9d399d357f..366e976b3e2 100644 --- a/storage/src/tests/persistence/mergehandlertest.cpp +++ b/storage/src/tests/persistence/mergehandlertest.cpp @@ -876,7 +876,7 @@ TEST_F(MergeHandlerTest, merge_bucket_spi_failures) { { PersistenceProviderWrapper::FAIL_CREATE_ITERATOR, "create iterator" }, { PersistenceProviderWrapper::FAIL_ITERATE, "iterate" }, }; - typedef ExpectedExceptionSpec* ExceptionIterator; + using ExceptionIterator = ExpectedExceptionSpec*; ExceptionIterator last = exceptions + sizeof(exceptions)/sizeof(exceptions[0]); for (ExceptionIterator it = exceptions; it != last; ++it) { @@ -907,7 +907,7 @@ TEST_F(MergeHandlerTest, get_bucket_diff_spi_failures) { { PersistenceProviderWrapper::FAIL_ITERATE, "iterate" }, }; - typedef ExpectedExceptionSpec* ExceptionIterator; + using ExceptionIterator = ExpectedExceptionSpec*; ExceptionIterator last = exceptions + sizeof(exceptions)/sizeof(exceptions[0]); for (ExceptionIterator it = exceptions; it != last; ++it) { @@ -941,7 +941,7 @@ TEST_F(MergeHandlerTest, apply_bucket_diff_spi_failures) { { PersistenceProviderWrapper::FAIL_REMOVE, "Failed remove" }, }; - typedef ExpectedExceptionSpec* ExceptionIterator; + using ExceptionIterator = ExpectedExceptionSpec*; ExceptionIterator last = exceptions + sizeof(exceptions)/sizeof(exceptions[0]); for (ExceptionIterator it = exceptions; it != last; ++it) { @@ -1006,7 +1006,7 @@ TEST_F(MergeHandlerTest, get_bucket_diff_reply_spi_failures) { { PersistenceProviderWrapper::FAIL_ITERATE, "iterate" }, }; - typedef ExpectedExceptionSpec* ExceptionIterator; + using ExceptionIterator = ExpectedExceptionSpec*; ExceptionIterator last = exceptions + sizeof(exceptions)/sizeof(exceptions[0]); for (ExceptionIterator it = exceptions; it != last; ++it) { @@ -1109,7 +1109,7 @@ TEST_F(MergeHandlerTest, apply_bucket_diff_reply_spi_failures) { { PersistenceProviderWrapper::FAIL_REMOVE, "Failed remove" }, }; - typedef ExpectedExceptionSpec* ExceptionIterator; + using ExceptionIterator = ExpectedExceptionSpec*; ExceptionIterator last = exceptions + sizeof(exceptions)/sizeof(exceptions[0]); for (ExceptionIterator it = exceptions; it != last; ++it) { diff --git a/storage/src/tests/storageapi/mbusprot/storageprotocoltest.cpp b/storage/src/tests/storageapi/mbusprot/storageprotocoltest.cpp index aeef0f613b2..09ee8e46a1a 100644 --- a/storage/src/tests/storageapi/mbusprot/storageprotocoltest.cpp +++ b/storage/src/tests/storageapi/mbusprot/storageprotocoltest.cpp @@ -439,7 +439,7 @@ TEST_P(StorageProtocolTest, delete_bucket) { } TEST_P(StorageProtocolTest, merge_bucket) { - typedef api::MergeBucketCommand::Node Node; + using Node = api::MergeBucketCommand::Node; std::vector<Node> nodes; nodes.push_back(Node(4, false)); nodes.push_back(Node(13, true)); diff --git a/storage/src/tests/storageserver/testvisitormessagesession.h b/storage/src/tests/storageserver/testvisitormessagesession.h index d10e8f0c285..c0c3b8429b2 100644 --- a/storage/src/tests/storageserver/testvisitormessagesession.h +++ b/storage/src/tests/storageserver/testvisitormessagesession.h @@ -22,7 +22,7 @@ private: bool _autoReply; public: - typedef std::unique_ptr<TestVisitorMessageSession> UP; + using UP = std::unique_ptr<TestVisitorMessageSession>; VisitorThread& thread; Visitor& visitor; diff --git a/storage/src/vespa/storage/bucketdb/btree_lockable_map.h b/storage/src/vespa/storage/bucketdb/btree_lockable_map.h index 3cc3249e6e0..fdbd158864c 100644 --- a/storage/src/vespa/storage/bucketdb/btree_lockable_map.h +++ b/storage/src/vespa/storage/bucketdb/btree_lockable_map.h @@ -79,7 +79,7 @@ private: size_t operator () (const LockId & lid) const { return lid.hash(); } }; class LockIdSet : public vespalib::hash_set<LockId, hasher> { - typedef vespalib::hash_set<LockId, hasher> Hash; + using Hash = vespalib::hash_set<LockId, hasher>; public: LockIdSet(); ~LockIdSet(); @@ -89,10 +89,10 @@ private: }; class LockWaiters { - typedef vespalib::hash_map<size_t, LockId> WaiterMap; + using WaiterMap = vespalib::hash_map<size_t, LockId>; public: - typedef size_t Key; - typedef typename WaiterMap::const_iterator const_iterator; + using Key = size_t; + using const_iterator = typename WaiterMap::const_iterator; LockWaiters(); ~LockWaiters(); Key insert(const LockId & lid); diff --git a/storage/src/vespa/storage/bucketdb/bucketmanager.cpp b/storage/src/vespa/storage/bucketdb/bucketmanager.cpp index 64c66401992..8e25c9a2ffb 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanager.cpp +++ b/storage/src/vespa/storage/bucketdb/bucketmanager.cpp @@ -510,7 +510,7 @@ BucketManager::processRequestBucketInfoCommands(document::BucketSpace bucketSpac // from the current cluster state. std::set<uint16_t> seenDistributors; - typedef std::shared_ptr<api::RequestBucketInfoCommand> RBISP; + using RBISP = std::shared_ptr<api::RequestBucketInfoCommand>; std::map<uint16_t, RBISP> requests; auto distribution(_component.getBucketSpaceRepo().get(bucketSpace).getDistribution()); diff --git a/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h index a856a9bf9a1..98a0c3e7010 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h +++ b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h @@ -12,7 +12,7 @@ namespace storage { struct DataStoredMetrics : metrics::MetricSet { - typedef std::shared_ptr<DataStoredMetrics> SP; + using SP = std::shared_ptr<DataStoredMetrics>; metrics::LongValueMetric buckets; metrics::LongValueMetric docs; diff --git a/storage/src/vespa/storage/distributor/idealstatemetricsset.cpp b/storage/src/vespa/storage/distributor/idealstatemetricsset.cpp index 618e49c4238..d79bf2c4810 100644 --- a/storage/src/vespa/storage/distributor/idealstatemetricsset.cpp +++ b/storage/src/vespa/storage/distributor/idealstatemetricsset.cpp @@ -53,7 +53,7 @@ MergeBucketMetricSet::~MergeBucketMetricSet() = default; void IdealStateMetricSet::createOperationMetrics() { - typedef IdealStateOperation ISO; + using ISO = IdealStateOperation; operations.resize(ISO::OPERATION_COUNT); // Note: naked new is used instead of make_shared due to the latter not being // able to properly transitively deduce the types for the tag initializer lists. diff --git a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h index 57b5a5cbce8..93499d9ebce 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h @@ -32,7 +32,7 @@ class DistributorComponentRegisterImpl std::shared_ptr<lib::ClusterState> _clusterState; public: - typedef std::unique_ptr<DistributorComponentRegisterImpl> UP; + using UP = std::unique_ptr<DistributorComponentRegisterImpl>; DistributorComponentRegisterImpl(); ~DistributorComponentRegisterImpl() override; diff --git a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h index cc8501c8027..0909def0e5c 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h @@ -24,7 +24,7 @@ class ServiceLayerComponentRegisterImpl MinimumUsedBitsTracker _minUsedBitsTracker; public: - typedef std::unique_ptr<ServiceLayerComponentRegisterImpl> UP; + using UP = std::unique_ptr<ServiceLayerComponentRegisterImpl>; explicit ServiceLayerComponentRegisterImpl(const ContentBucketDbOptions&); diff --git a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h index 0b1447de49b..b236b6779bf 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h @@ -33,7 +33,7 @@ class StorageComponentRegisterImpl BucketspacesConfig _bucketSpacesConfig; public: - typedef std::unique_ptr<StorageComponentRegisterImpl> UP; + using UP = std::unique_ptr<StorageComponentRegisterImpl>; StorageComponentRegisterImpl(); ~StorageComponentRegisterImpl() override; diff --git a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h index 26db7ff5069..51149830329 100644 --- a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h +++ b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h @@ -53,7 +53,7 @@ class StatusWebServer : private config::IFetcherCallback<vespa::config::content: } }; struct HttpRequest { - typedef std::shared_ptr<HttpRequest> SP; + using SP = std::shared_ptr<HttpRequest>; vespalib::string _url; vespalib::string _serverSpec; diff --git a/storage/src/vespa/storage/frameworkimpl/thread/appkiller.h b/storage/src/vespa/storage/frameworkimpl/thread/appkiller.h index 54078b8d8b7..de8005bf914 100644 --- a/storage/src/vespa/storage/frameworkimpl/thread/appkiller.h +++ b/storage/src/vespa/storage/frameworkimpl/thread/appkiller.h @@ -16,7 +16,7 @@ namespace storage { struct AppKiller { - typedef std::unique_ptr<AppKiller> UP; + using UP = std::unique_ptr<AppKiller>; virtual ~AppKiller() {} virtual void kill() = 0; }; diff --git a/storage/src/vespa/storage/frameworkimpl/thread/htmltable.h b/storage/src/vespa/storage/frameworkimpl/thread/htmltable.h index 1aee514a560..71ed2da4e9e 100644 --- a/storage/src/vespa/storage/frameworkimpl/thread/htmltable.h +++ b/storage/src/vespa/storage/frameworkimpl/thread/htmltable.h @@ -164,7 +164,7 @@ struct ByteSizeColumn : public ValueColumn<uint64_t> { void printValue(std::ostream& out, uint16_t row) override; }; -typedef ValueColumn<int64_t> LongColumn; -typedef ValueColumn<double> DoubleColumn; +using LongColumn = ValueColumn<int64_t>; +using DoubleColumn = ValueColumn<double>; } // storage diff --git a/storage/src/vespa/storage/persistence/diskthread.h b/storage/src/vespa/storage/persistence/diskthread.h index 2d10349ae64..cafed748d9b 100644 --- a/storage/src/vespa/storage/persistence/diskthread.h +++ b/storage/src/vespa/storage/persistence/diskthread.h @@ -22,7 +22,7 @@ namespace storage { class DiskThread : public framework::Runnable { public: - typedef std::shared_ptr<DiskThread> SP; + using SP = std::shared_ptr<DiskThread>; DiskThread(const DiskThread &) = delete; DiskThread & operator = (const DiskThread &) = delete; diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp index 6d69a29fc6e..49b3b02e240 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp @@ -295,7 +295,7 @@ FileStorManager::mapOperationToBucketAndDisk(api::BucketCommand& cmd, const docu if (docId) { specific = _bucketIdFactory.getBucketId(*docId); } - typedef std::map<document::BucketId, StorBucketDatabase::WrappedEntry> BucketMap; + using BucketMap = std::map<document::BucketId, StorBucketDatabase::WrappedEntry>; std::shared_ptr<api::StorageReply> reply; { BucketMap results( database.getContained( specific, "FileStorManager::mapOperationToBucketAndDisk-2")); diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormetrics.h b/storage/src/vespa/storage/persistence/filestorage/filestormetrics.h index 53bf087f036..9a01cab8dd5 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestormetrics.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestormetrics.h @@ -19,7 +19,7 @@ namespace storage { struct FileStorThreadMetrics : public metrics::MetricSet { - typedef std::shared_ptr<FileStorThreadMetrics> SP; + using SP = std::shared_ptr<FileStorThreadMetrics>; struct Op : metrics::MetricSet { std::string _name; diff --git a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h index 8c0b4084428..0695c35c7ad 100644 --- a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h +++ b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h @@ -27,7 +27,7 @@ class ModifiedBucketChecker vespa::config::content::core::StorServerConfig> { public: - typedef std::unique_ptr<ModifiedBucketChecker> UP; + using UP = std::unique_ptr<ModifiedBucketChecker>; ModifiedBucketChecker(ServiceLayerComponentRegister& compReg, spi::PersistenceProvider& provide, diff --git a/storage/src/vespa/storage/persistence/mergehandler.cpp b/storage/src/vespa/storage/persistence/mergehandler.cpp index ae68a694c90..684c21e4c3e 100644 --- a/storage/src/vespa/storage/persistence/mergehandler.cpp +++ b/storage/src/vespa/storage/persistence/mergehandler.cpp @@ -179,7 +179,7 @@ MergeHandler::buildBucketInfoList( assert(output.size() == 0); assert(myNodeIndex < 16); uint32_t oldSize = output.size(); - typedef api::BucketInfo DbBucketInfo; + using DbBucketInfo = api::BucketInfo; // Always verify that bucket database is correct in merge, such that // any out of sync data get fixed. Such errors must of course also be diff --git a/storage/src/vespa/storage/persistence/messages.h b/storage/src/vespa/storage/persistence/messages.h index 86cf1ac3b06..faba3995c6f 100644 --- a/storage/src/vespa/storage/persistence/messages.h +++ b/storage/src/vespa/storage/persistence/messages.h @@ -19,8 +19,8 @@ private: public: static constexpr uint32_t ID = 1001; - typedef std::unique_ptr<GetIterCommand> UP; - typedef std::shared_ptr<GetIterCommand> SP; + using UP = std::unique_ptr<GetIterCommand>; + using SP = std::shared_ptr<GetIterCommand>; GetIterCommand(const document::Bucket &bucket, spi::IteratorId iteratorId, @@ -51,8 +51,8 @@ private: bool _completed; public: - typedef std::unique_ptr<GetIterReply> UP; - typedef std::shared_ptr<GetIterReply> SP; + using UP = std::unique_ptr<GetIterReply>; + using SP = std::shared_ptr<GetIterReply>; static constexpr uint32_t ID = 1002; explicit GetIterReply(GetIterCommand& cmd); @@ -80,8 +80,8 @@ class CreateIteratorCommand : public api::InternalCommand public: static constexpr uint32_t ID = 1003; - typedef std::unique_ptr<CreateIteratorCommand> UP; - typedef std::shared_ptr<CreateIteratorCommand> SP; + using UP = std::unique_ptr<CreateIteratorCommand>; + using SP = std::shared_ptr<CreateIteratorCommand>; CreateIteratorCommand(const document::Bucket &bucket, const spi::Selection& selection, @@ -114,8 +114,8 @@ class CreateIteratorReply : public api::InternalReply spi::IteratorId _iteratorId; public: static constexpr uint32_t ID = 1004; - typedef std::unique_ptr<CreateIteratorReply> UP; - typedef std::shared_ptr<CreateIteratorReply> SP; + using UP = std::unique_ptr<CreateIteratorReply>; + using SP = std::shared_ptr<CreateIteratorReply>; CreateIteratorReply(const CreateIteratorCommand& cmd, spi::IteratorId iteratorId); ~CreateIteratorReply() override; @@ -132,8 +132,8 @@ class DestroyIteratorCommand : public api::InternalCommand spi::IteratorId _iteratorId; public: static constexpr uint32_t ID = 1005; - typedef std::unique_ptr<DestroyIteratorCommand> UP; - typedef std::shared_ptr<DestroyIteratorCommand> SP; + using UP = std::unique_ptr<DestroyIteratorCommand>; + using SP = std::shared_ptr<DestroyIteratorCommand>; explicit DestroyIteratorCommand(spi::IteratorId iteratorId); ~DestroyIteratorCommand() override; @@ -150,8 +150,8 @@ class DestroyIteratorReply : public api::InternalReply spi::IteratorId _iteratorId; public: static constexpr uint32_t ID = 1006; - typedef std::unique_ptr<DestroyIteratorReply> UP; - typedef std::shared_ptr<DestroyIteratorReply> SP; + using UP = std::unique_ptr<DestroyIteratorReply>; + using SP = std::shared_ptr<DestroyIteratorReply>; explicit DestroyIteratorReply(const DestroyIteratorCommand& cmd); ~DestroyIteratorReply() override; @@ -164,8 +164,8 @@ class RecheckBucketInfoCommand : public api::InternalCommand document::Bucket _bucket; public: static constexpr uint32_t ID = 1007; - typedef std::shared_ptr<RecheckBucketInfoCommand> SP; - typedef std::unique_ptr<RecheckBucketInfoCommand> UP; + using SP = std::shared_ptr<RecheckBucketInfoCommand>; + using UP = std::unique_ptr<RecheckBucketInfoCommand>; explicit RecheckBucketInfoCommand(const document::Bucket &bucket); ~RecheckBucketInfoCommand() override; @@ -182,8 +182,8 @@ class RecheckBucketInfoReply : public api::InternalReply document::Bucket _bucket; public: static constexpr uint32_t ID = 1008; - typedef std::shared_ptr<RecheckBucketInfoReply> SP; - typedef std::unique_ptr<RecheckBucketInfoReply> UP; + using SP = std::shared_ptr<RecheckBucketInfoReply>; + using UP = std::unique_ptr<RecheckBucketInfoReply>; explicit RecheckBucketInfoReply(const RecheckBucketInfoCommand& cmd); ~RecheckBucketInfoReply() override; @@ -206,8 +206,8 @@ public: }; static constexpr uint32_t ID = 1009; - typedef std::shared_ptr<AbortBucketOperationsCommand> SP; - typedef std::shared_ptr<const AbortBucketOperationsCommand> CSP; + using SP = std::shared_ptr<AbortBucketOperationsCommand>; + using CSP = std::shared_ptr<const AbortBucketOperationsCommand>; private: std::unique_ptr<AbortPredicate> _predicate; public: @@ -227,8 +227,8 @@ class AbortBucketOperationsReply : public api::InternalReply { public: static constexpr uint32_t ID = 1010; - typedef std::shared_ptr<AbortBucketOperationsReply> SP; - typedef std::shared_ptr<const AbortBucketOperationsReply> CSP; + using SP = std::shared_ptr<AbortBucketOperationsReply>; + using CSP = std::shared_ptr<const AbortBucketOperationsReply>; explicit AbortBucketOperationsReply(const AbortBucketOperationsCommand& cmd); ~AbortBucketOperationsReply() override; diff --git a/storage/src/vespa/storage/persistence/splitjoinhandler.cpp b/storage/src/vespa/storage/persistence/splitjoinhandler.cpp index f86a65efd91..51fa1f1b785 100644 --- a/storage/src/vespa/storage/persistence/splitjoinhandler.cpp +++ b/storage/src/vespa/storage/persistence/splitjoinhandler.cpp @@ -81,7 +81,7 @@ SplitJoinHandler::handleSplitBucket(api::SplitBucketCommand& cmd, MessageTracker api::SplitBucketReply & splitReply = *reply; tracker->setReply(std::move(reply)); - typedef std::pair<StorBucketDatabase::WrappedEntry, FileStorHandler::RemapInfo> TargetInfo; + using TargetInfo = std::pair<StorBucketDatabase::WrappedEntry, FileStorHandler::RemapInfo>; std::vector<TargetInfo> targets; for (uint32_t i = 0; i < 2; i++) { const document::Bucket &target(i == 0 ? target1 : target2); diff --git a/storage/src/vespa/storage/persistence/types.h b/storage/src/vespa/storage/persistence/types.h index da004f85075..60de7dea4fd 100644 --- a/storage/src/vespa/storage/persistence/types.h +++ b/storage/src/vespa/storage/persistence/types.h @@ -15,12 +15,12 @@ namespace storage { class MessageTracker; struct Types { - typedef document::BucketId BucketId; - typedef document::DocumentId DocumentId; - typedef document::GlobalId GlobalId; - typedef framework::MicroSecTime Timestamp; - typedef vespalib::string String; - typedef api::BucketInfo BucketInfo; + using BucketId = document::BucketId; + using DocumentId = document::DocumentId; + using GlobalId = document::GlobalId; + using Timestamp = framework::MicroSecTime; + using String = vespalib::string; + using BucketInfo = api::BucketInfo; using MessageTrackerUP = std::unique_ptr<MessageTracker>; protected: ~Types() {} // Noone should refer to objects as Types objects diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.cpp b/storage/src/vespa/storage/storageserver/communicationmanager.cpp index 4458bf8a92d..fff40250d41 100644 --- a/storage/src/vespa/storage/storageserver/communicationmanager.cpp +++ b/storage/src/vespa/storage/storageserver/communicationmanager.cpp @@ -151,7 +151,7 @@ CommunicationManager::handleReply(std::unique_ptr<mbus::Reply> reply) std::shared_ptr<api::StorageCommand> originalCommand; { std::lock_guard lock(_messageBusSentLock); - typedef std::map<api::StorageMessage::Id, api::StorageCommand::SP> MessageMap; + using MessageMap = std::map<api::StorageMessage::Id, api::StorageCommand::SP>; MessageMap::iterator iter(_messageBusSent.find(reply->getContext().value.UINT64)); if (iter != _messageBusSent.end()) { originalCommand.swap(iter->second); diff --git a/storage/src/vespa/storage/storageserver/distributornode.h b/storage/src/vespa/storage/storageserver/distributornode.h index 8d36d1d8bc5..7224abfa59c 100644 --- a/storage/src/vespa/storage/storageserver/distributornode.h +++ b/storage/src/vespa/storage/storageserver/distributornode.h @@ -41,7 +41,7 @@ class DistributorNode constexpr static uint32_t SanityCheckMaxWallClockSecondSkew = 120; public: - typedef std::unique_ptr<DistributorNode> UP; + using UP = std::unique_ptr<DistributorNode>; DistributorNode(const config::ConfigUri & configUri, DistributorNodeContext&, diff --git a/storage/src/vespa/storage/storageserver/distributornodecontext.h b/storage/src/vespa/storage/storageserver/distributornodecontext.h index b00274431ad..d01127827e0 100644 --- a/storage/src/vespa/storage/storageserver/distributornodecontext.h +++ b/storage/src/vespa/storage/storageserver/distributornodecontext.h @@ -19,7 +19,7 @@ namespace storage { struct DistributorNodeContext : public StorageNodeContext { // Typedefs to simplify the remainder of the interface - typedef DistributorComponentRegisterImpl ComponentRegister; + using ComponentRegister = DistributorComponentRegisterImpl; /** * You can provide your own clock implementation. Useful in testing where diff --git a/storage/src/vespa/storage/storageserver/priorityconverter.h b/storage/src/vespa/storage/storageserver/priorityconverter.h index b1f774e4ff2..0abfccac3ea 100644 --- a/storage/src/vespa/storage/storageserver/priorityconverter.h +++ b/storage/src/vespa/storage/storageserver/priorityconverter.h @@ -21,7 +21,7 @@ class PriorityConverter vespa::config::content::core::StorPrioritymappingConfig> { public: - typedef vespa::config::content::core::StorPrioritymappingConfig Config; + using Config = vespa::config::content::core::StorPrioritymappingConfig; explicit PriorityConverter(const config::ConfigUri& configUri); ~PriorityConverter() override; diff --git a/storage/src/vespa/storage/storageserver/servicelayernode.h b/storage/src/vespa/storage/storageserver/servicelayernode.h index 4b0e0f73408..4f4af71ef57 100644 --- a/storage/src/vespa/storage/storageserver/servicelayernode.h +++ b/storage/src/vespa/storage/storageserver/servicelayernode.h @@ -37,7 +37,7 @@ class ServiceLayerNode bool _init_has_been_called; public: - typedef std::unique_ptr<ServiceLayerNode> UP; + using UP = std::unique_ptr<ServiceLayerNode>; ServiceLayerNode(const config::ConfigUri & configUri, ServiceLayerNodeContext& context, diff --git a/storage/src/vespa/storage/storageserver/servicelayernodecontext.h b/storage/src/vespa/storage/storageserver/servicelayernodecontext.h index 79bc0b2c3ae..d89ba472f83 100644 --- a/storage/src/vespa/storage/storageserver/servicelayernodecontext.h +++ b/storage/src/vespa/storage/storageserver/servicelayernodecontext.h @@ -19,7 +19,7 @@ namespace storage { struct ServiceLayerNodeContext : public StorageNodeContext { // Typedefs to simplify the remainder of the interface - typedef ServiceLayerComponentRegisterImpl ComponentRegister; + using ComponentRegister = ServiceLayerComponentRegisterImpl; /** * You can provide your own clock implementation. Useful in testing where diff --git a/storage/src/vespa/storage/storageserver/storagenodecontext.h b/storage/src/vespa/storage/storageserver/storagenodecontext.h index 91953e7092f..c89bb4630ce 100644 --- a/storage/src/vespa/storage/storageserver/storagenodecontext.h +++ b/storage/src/vespa/storage/storageserver/storagenodecontext.h @@ -20,8 +20,8 @@ namespace storage { struct StorageNodeContext { // Typedefs to simplify the remainder of the interface - typedef StorageComponentRegisterImpl ComponentRegister; - typedef framework::defaultimplementation::RealClock RealClock; + using ComponentRegister = StorageComponentRegisterImpl; + using RealClock = framework::defaultimplementation::RealClock; /** * Get the actual component register. Available as the actual type as the diff --git a/storage/src/vespa/storage/visiting/commandqueue.h b/storage/src/vespa/storage/visiting/commandqueue.h index 4d948051b32..c9c34b7b4e0 100644 --- a/storage/src/vespa/storage/visiting/commandqueue.h +++ b/storage/src/vespa/storage/visiting/commandqueue.h @@ -75,11 +75,11 @@ private: std::atomic<size_t> _cached_size; public: - typedef typename CommandList::iterator iterator; - typedef typename CommandList::reverse_iterator reverse_iterator; - typedef typename CommandList::const_iterator const_iterator; - typedef typename CommandList::const_reverse_iterator const_reverse_iterator; - typedef typename timelist::const_iterator const_titerator; + using iterator = typename CommandList::iterator; + using reverse_iterator = typename CommandList::reverse_iterator; + using const_iterator = typename CommandList::const_iterator; + using const_reverse_iterator = typename CommandList::const_reverse_iterator; + using const_titerator = typename timelist::const_iterator; explicit CommandQueue(const framework::Clock& clock) : _clock(clock), diff --git a/storage/src/vespa/storage/visiting/countvisitor.h b/storage/src/vespa/storage/visiting/countvisitor.h index 4120a96225f..8ae67a5e0d2 100644 --- a/storage/src/vespa/storage/visiting/countvisitor.h +++ b/storage/src/vespa/storage/visiting/countvisitor.h @@ -29,14 +29,14 @@ private: std::map<std::string, int> _schemeCount; bool _doNamespace; - typedef std::map<vespalib::string, int> NamespaceCountMap; + using NamespaceCountMap = std::map<vespalib::string, int>; NamespaceCountMap _namespaceCount; bool _doUser; std::map<uint64_t, int> _userCount; bool _doGroup; - typedef std::map<vespalib::string, int> GroupCountMap; + using GroupCountMap = std::map<vespalib::string, int>; GroupCountMap _groupCount; }; diff --git a/storage/src/vespa/storage/visiting/messagebusvisitormessagesession.h b/storage/src/vespa/storage/visiting/messagebusvisitormessagesession.h index ea9aa1f166e..a5670c637f8 100644 --- a/storage/src/vespa/storage/visiting/messagebusvisitormessagesession.h +++ b/storage/src/vespa/storage/visiting/messagebusvisitormessagesession.h @@ -21,7 +21,7 @@ class MessageBusVisitorMessageSession : public VisitorMessageSession, public mbus::IReplyHandler { public: - typedef std::unique_ptr<MessageBusVisitorMessageSession> UP; + using UP = std::unique_ptr<MessageBusVisitorMessageSession>; MessageBusVisitorMessageSession(Visitor& visitor, VisitorThread& thread) : _visitor(visitor), diff --git a/storage/src/vespa/storage/visiting/visitor.h b/storage/src/vespa/storage/visiting/visitor.h index aa1c34d10b7..0737c5612c0 100644 --- a/storage/src/vespa/storage/visiting/visitor.h +++ b/storage/src/vespa/storage/visiting/visitor.h @@ -233,7 +233,7 @@ private: // Maps from time sent to message to send. // Value refers to message id (key in _messageMeta). - typedef std::multimap<framework::MicroSecTime, uint64_t> MessageQueue; + using MessageQueue = std::multimap<framework::MicroSecTime, uint64_t>; MessageQueue _queuedMessages; @@ -273,7 +273,7 @@ private: // The iterator iterating the buckets to visit. uint32_t _currentBucket; // The states of the buckets currently being visited. - typedef std::list<BucketIterationState*> BucketStateList; + using BucketStateList = std::list<BucketIterationState*>; BucketStateList _bucketStates; // Set to true after performing given callbacks bool _calledStartingVisitor; diff --git a/storage/src/vespa/storage/visiting/visitormanager.cpp b/storage/src/vespa/storage/visiting/visitormanager.cpp index 759f1f1f059..9c9a39ff28c 100644 --- a/storage/src/vespa/storage/visiting/visitormanager.cpp +++ b/storage/src/vespa/storage/visiting/visitormanager.cpp @@ -207,7 +207,7 @@ void VisitorManager::run(framework::ThreadHandle& thread) { LOG(debug, "Started visitor manager thread with pid %d.", getpid()); - typedef CommandQueue<api::CreateVisitorCommand> CQ; + using CQ = CommandQueue<api::CreateVisitorCommand>; std::vector<CQ::CommandEntry> timedOut; // Run forever, dump messages in the visitor queue that times out. while (true) { diff --git a/storage/src/vespa/storage/visiting/visitormessagesession.h b/storage/src/vespa/storage/visiting/visitormessagesession.h index fc11c1dee81..0fefbcb067f 100644 --- a/storage/src/vespa/storage/visiting/visitormessagesession.h +++ b/storage/src/vespa/storage/visiting/visitormessagesession.h @@ -13,7 +13,7 @@ namespace documentapi { namespace storage { struct VisitorMessageSession { - typedef std::unique_ptr<VisitorMessageSession> UP; + using UP = std::unique_ptr<VisitorMessageSession>; virtual ~VisitorMessageSession() {} diff --git a/storage/src/vespa/storage/visiting/visitormessagesessionfactory.h b/storage/src/vespa/storage/visiting/visitormessagesessionfactory.h index 683588f19ab..1b0bfc23f63 100644 --- a/storage/src/vespa/storage/visiting/visitormessagesessionfactory.h +++ b/storage/src/vespa/storage/visiting/visitormessagesessionfactory.h @@ -11,7 +11,7 @@ class Visitor; class VisitorThread; struct VisitorMessageSessionFactory { - typedef std::unique_ptr<VisitorMessageSessionFactory> UP; + using UP = std::unique_ptr<VisitorMessageSessionFactory>; virtual ~VisitorMessageSessionFactory() = default; diff --git a/storage/src/vespa/storageapi/mbusprot/protocolserialization.h b/storage/src/vespa/storageapi/mbusprot/protocolserialization.h index 653e9ded85a..0daf04c75c6 100644 --- a/storage/src/vespa/storageapi/mbusprot/protocolserialization.h +++ b/storage/src/vespa/storageapi/mbusprot/protocolserialization.h @@ -70,12 +70,12 @@ protected: ProtocolSerialization() = default; virtual ~ProtocolSerialization() = default; - typedef api::StorageCommand SCmd; - typedef api::StorageReply SRep; - typedef document::ByteBuffer BBuf; - typedef vespalib::GrowableByteBuffer GBBuf; - typedef SerializationHelper SH; - typedef StorageMessage SM; + using SCmd = api::StorageCommand; + using SRep = api::StorageReply; + using BBuf = document::ByteBuffer; + using GBBuf = vespalib::GrowableByteBuffer; + using SH = SerializationHelper; + using SM = StorageMessage; virtual void onEncode(GBBuf&, const api::PutCommand&) const = 0; virtual void onEncode(GBBuf&, const api::PutReply&) const = 0; diff --git a/storage/src/vespa/storageapi/mbusprot/storagecommand.h b/storage/src/vespa/storageapi/mbusprot/storagecommand.h index e65c0295e31..09f01fe4fac 100644 --- a/storage/src/vespa/storageapi/mbusprot/storagecommand.h +++ b/storage/src/vespa/storageapi/mbusprot/storagecommand.h @@ -10,7 +10,7 @@ namespace storage::mbusprot { class StorageCommand : public mbus::Message, public StorageMessage { public: - typedef std::unique_ptr<StorageCommand> UP; + using UP = std::unique_ptr<StorageCommand>; explicit StorageCommand(api::StorageCommand::SP); diff --git a/storage/src/vespa/storageapi/mbusprot/storagemessage.h b/storage/src/vespa/storageapi/mbusprot/storagemessage.h index 61323222b89..4a7a18ce355 100644 --- a/storage/src/vespa/storageapi/mbusprot/storagemessage.h +++ b/storage/src/vespa/storageapi/mbusprot/storagemessage.h @@ -7,7 +7,7 @@ namespace storage::mbusprot { class StorageMessage { public: - typedef std::unique_ptr<StorageMessage> UP; + using UP = std::unique_ptr<StorageMessage>; virtual ~StorageMessage() {} diff --git a/storage/src/vespa/storageapi/mbusprot/storageprotocol.h b/storage/src/vespa/storageapi/mbusprot/storageprotocol.h index dbea21a4a9f..aae0754db49 100644 --- a/storage/src/vespa/storageapi/mbusprot/storageprotocol.h +++ b/storage/src/vespa/storageapi/mbusprot/storageprotocol.h @@ -9,7 +9,7 @@ namespace storage::mbusprot { class StorageProtocol final : public mbus::IProtocol { public: - typedef std::shared_ptr<StorageProtocol> SP; + using SP = std::shared_ptr<StorageProtocol>; static mbus::string NAME; diff --git a/storage/src/vespa/storageapi/mbusprot/storagereply.h b/storage/src/vespa/storageapi/mbusprot/storagereply.h index 538b7caa678..714a3affacb 100644 --- a/storage/src/vespa/storageapi/mbusprot/storagereply.h +++ b/storage/src/vespa/storageapi/mbusprot/storagereply.h @@ -16,7 +16,7 @@ class StorageReply : public mbus::Reply, public StorageMessage { mutable api::StorageReply::SP _reply; public: - typedef std::unique_ptr<StorageReply> UP; + using UP = std::unique_ptr<StorageReply>; StorageReply(mbus::BlobRef data, const ProtocolSerialization&); StorageReply(api::StorageReply::SP reply); diff --git a/storage/src/vespa/storageapi/message/bucket.h b/storage/src/vespa/storageapi/message/bucket.h index ab61a9202c8..57eed20f665 100644 --- a/storage/src/vespa/storageapi/message/bucket.h +++ b/storage/src/vespa/storageapi/message/bucket.h @@ -154,7 +154,7 @@ operator<<(std::ostream& out, const MergeBucketCommand::Node& n); */ class MergeBucketReply : public BucketReply { public: - typedef MergeBucketCommand::Node Node; + using Node = MergeBucketCommand::Node; private: std::vector<Node> _nodes; @@ -182,7 +182,7 @@ public: */ class GetBucketDiffCommand : public BucketCommand { public: - typedef MergeBucketCommand::Node Node; + using Node = MergeBucketCommand::Node; struct Entry : public document::Printable { Timestamp _timestamp; @@ -227,8 +227,8 @@ public: */ class GetBucketDiffReply : public BucketReply { public: - typedef MergeBucketCommand::Node Node; - typedef GetBucketDiffCommand::Entry Entry; + using Node = MergeBucketCommand::Node; + using Entry = GetBucketDiffCommand::Entry; private: std::vector<Node> _nodes; @@ -257,7 +257,7 @@ public: */ class ApplyBucketDiffCommand : public BucketInfoCommand { public: - typedef MergeBucketCommand::Node Node; + using Node = MergeBucketCommand::Node; struct Entry : public document::Printable { GetBucketDiffCommand::Entry _entry; vespalib::string _docName; @@ -304,8 +304,8 @@ public: */ class ApplyBucketDiffReply : public BucketInfoReply { public: - typedef MergeBucketCommand::Node Node; - typedef ApplyBucketDiffCommand::Entry Entry; + using Node = MergeBucketCommand::Node; + using Entry = ApplyBucketDiffCommand::Entry; private: std::vector<Node> _nodes; diff --git a/storage/src/vespa/storageapi/message/bucketsplitting.h b/storage/src/vespa/storageapi/message/bucketsplitting.h index 584cdfd5638..bf589b62b5b 100644 --- a/storage/src/vespa/storageapi/message/bucketsplitting.h +++ b/storage/src/vespa/storageapi/message/bucketsplitting.h @@ -69,7 +69,7 @@ public: */ class SplitBucketReply : public BucketReply { public: - typedef std::pair<document::BucketId, BucketInfo> Entry; + using Entry = std::pair<document::BucketId, BucketInfo>; explicit SplitBucketReply(const SplitBucketCommand& cmd); std::vector<Entry>& getSplitInfo() { return _result; } const std::vector<Entry>& getSplitInfo() const { return _result; } diff --git a/storage/src/vespa/storageapi/messageapi/returncode.h b/storage/src/vespa/storageapi/messageapi/returncode.h index f60cbe2b840..ed06891ffc9 100644 --- a/storage/src/vespa/storageapi/messageapi/returncode.h +++ b/storage/src/vespa/storageapi/messageapi/returncode.h @@ -17,7 +17,7 @@ namespace storage::api { class ReturnCode { public: - typedef documentapi::DocumentProtocol Protocol; + using Protocol = documentapi::DocumentProtocol; /** Return status codes */ enum Result { diff --git a/storage/src/vespa/storageapi/messageapi/storagemessage.h b/storage/src/vespa/storageapi/messageapi/storagemessage.h index 71567192bd9..6990423295b 100644 --- a/storage/src/vespa/storageapi/messageapi/storagemessage.h +++ b/storage/src/vespa/storageapi/messageapi/storagemessage.h @@ -29,9 +29,9 @@ namespace vespalib { class asciistream; } * Adds a messagehandler callback and some utilities */ #define DECLARE_POINTER_TYPEDEFS(message) \ - typedef std::unique_ptr<message> UP; \ - typedef std::shared_ptr<message> SP; \ - typedef std::shared_ptr<const message> CSP; + using UP = std::unique_ptr<message>; \ + using SP = std::shared_ptr<message>; \ + using CSP = std::shared_ptr<const message>; #define DECLARE_STORAGEREPLY(reply, callback) \ public: \ @@ -339,8 +339,8 @@ class StorageMessage : public vespalib::Printable friend class StorageMessageTest; // Used for testing only public: DECLARE_POINTER_TYPEDEFS(StorageMessage); - typedef uint64_t Id; - typedef uint8_t Priority; + using Id = uint64_t; + using Priority = uint8_t; enum LegacyPriorityValues { LOW = 225, diff --git a/storage/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.h b/storage/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.h index 6cfae8086fc..8cd4f87c404 100644 --- a/storage/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.h +++ b/storage/src/vespa/storageframework/defaultimplementation/component/componentregisterimpl.h @@ -55,7 +55,7 @@ class ComponentRegisterImpl : public virtual ComponentRegister, ShutdownListener* _shutdownListener; public: - typedef std::unique_ptr<ComponentRegisterImpl> UP; + using UP = std::unique_ptr<ComponentRegisterImpl>; ComponentRegisterImpl(); ~ComponentRegisterImpl() override; diff --git a/storage/src/vespa/storageframework/generic/thread/thread.h b/storage/src/vespa/storageframework/generic/thread/thread.h index 444376b87a5..6be65667b0f 100644 --- a/storage/src/vespa/storageframework/generic/thread/thread.h +++ b/storage/src/vespa/storageframework/generic/thread/thread.h @@ -30,7 +30,7 @@ class Thread : public ThreadHandle { vespalib::string _id; public: - typedef std::unique_ptr<Thread> UP; + using UP = std::unique_ptr<Thread>; Thread(vespalib::stringref id) : _id(id) {} virtual ~Thread() = default; diff --git a/storage/src/vespa/storageframework/generic/thread/tickingthread.cpp b/storage/src/vespa/storageframework/generic/thread/tickingthread.cpp index 1a9cb459f28..9045e989c27 100644 --- a/storage/src/vespa/storageframework/generic/thread/tickingthread.cpp +++ b/storage/src/vespa/storageframework/generic/thread/tickingthread.cpp @@ -30,7 +30,7 @@ class TickingThreadRunner final : public Runnable { char _state; public: - typedef std::shared_ptr<TickingThreadRunner> SP; + using SP = std::shared_ptr<TickingThreadRunner>; TickingThreadRunner(std::mutex& m, std::condition_variable & cond, diff --git a/streamingvisitors/src/tests/docsum/docsum.cpp b/streamingvisitors/src/tests/docsum/docsum.cpp index cff43adbb3a..b99ee360bee 100644 --- a/streamingvisitors/src/tests/docsum/docsum.cpp +++ b/streamingvisitors/src/tests/docsum/docsum.cpp @@ -21,8 +21,8 @@ public: Vector<T> & add(T v) { this->push_back(v); return *this; } }; -typedef Vector<std::string> StringList; -typedef Vector<std::pair<std::string, int32_t> > WeightedStringList; +using StringList = Vector<std::string>; +using WeightedStringList = Vector<std::pair<std::string, int32_t> >; class TestDocument : public vsm::Document diff --git a/streamingvisitors/src/tests/searcher/searcher_test.cpp b/streamingvisitors/src/tests/searcher/searcher_test.cpp index b322c1a33fc..607e418ac83 100644 --- a/streamingvisitors/src/tests/searcher/searcher_test.cpp +++ b/streamingvisitors/src/tests/searcher/searcher_test.cpp @@ -32,14 +32,14 @@ public: Vector<T> & add(T v) { this->push_back(v); return *this; } }; -typedef Vector<size_t> Hits; -typedef Vector<std::string> StringList; -typedef Vector<Hits> HitsList; -typedef Vector<bool> BoolList; -typedef Vector<int64_t> LongList; -typedef Vector<float> FloatList; -typedef QueryTerm::FieldInfo QTFieldInfo; -typedef Vector<QTFieldInfo> FieldInfoList; +using Hits = Vector<size_t>; +using StringList = Vector<std::string> ; +using HitsList = Vector<Hits>; +using BoolList = Vector<bool>; +using LongList = Vector<int64_t>; +using FloatList = Vector<float>; +using QTFieldInfo = QueryTerm::FieldInfo; +using FieldInfoList = Vector<QTFieldInfo>; class String { @@ -66,8 +66,8 @@ private: } } public: - typedef std::pair<std::string, std::string> ParsedQueryTerm; - typedef std::pair<std::string, TermType> ParsedTerm; + using ParsedQueryTerm = std::pair<std::string, std::string>; + using ParsedTerm = std::pair<std::string, TermType>; QueryNodeResultFactory eqnr; std::vector<QueryTerm::UP> qtv; QueryTermList qtl; diff --git a/streamingvisitors/src/tests/textutil/textutil.cpp b/streamingvisitors/src/tests/textutil/textutil.cpp index 2a1390eaa01..160c734ee20 100644 --- a/streamingvisitors/src/tests/textutil/textutil.cpp +++ b/streamingvisitors/src/tests/textutil/textutil.cpp @@ -19,10 +19,10 @@ public: Vector<T> & a(T v) { this->push_back(v); return *this; } }; -typedef Vector<ucs4_t> UCS4V; -typedef Vector<size_t> SizeV; -typedef UTF8StringFieldSearcherBase SFSB; -typedef FUTF8StrChrFieldSearcher FSFS; +using UCS4V = Vector<ucs4_t>; +using SizeV = Vector<size_t>; +using SFSB = UTF8StringFieldSearcherBase; +using FSFS = FUTF8StrChrFieldSearcher; class TextUtilTest : public vespalib::TestApp { diff --git a/streamingvisitors/src/vespa/searchvisitor/hitcollector.h b/streamingvisitors/src/vespa/searchvisitor/hitcollector.h index d6a05dc4f9e..6ce7459adfd 100644 --- a/streamingvisitors/src/vespa/searchvisitor/hitcollector.h +++ b/streamingvisitors/src/vespa/searchvisitor/hitcollector.h @@ -70,7 +70,7 @@ private: std::vector<search::fef::TermFieldMatchData> _matchData; vespalib::string _sortBlob; }; - typedef std::vector<Hit> HitVector; + using HitVector = std::vector<Hit>; HitVector _hits; bool _sortedByDocId; // flag for whether the hit vector is sorted on docId @@ -79,7 +79,7 @@ private: bool addHit(Hit && hit); public: - typedef std::unique_ptr<HitCollector> UP; + using UP = std::unique_ptr<HitCollector>; struct IRankProgram { virtual ~IRankProgram() {} diff --git a/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h index 3bcf1cc43a5..2cc5a450b2e 100644 --- a/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h +++ b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h @@ -21,7 +21,7 @@ namespace streaming { class IndexEnvironment : public search::fef::IIndexEnvironment { private: - typedef vespalib::hash_map<vespalib::string, uint32_t> StringInt32Map; + using StringInt32Map = vespalib::hash_map<vespalib::string, uint32_t>; const search::fef::ITableManager * _tableManager; search::fef::Properties _properties; std::vector<search::fef::FieldInfo> _fields; diff --git a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h index 1bc625f4ea3..dd543a60244 100644 --- a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h +++ b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h @@ -25,7 +25,7 @@ private: std::vector<search::common::GeoLocationSpec> _locations; public: - typedef std::unique_ptr<QueryEnvironment> UP; + using UP = std::unique_ptr<QueryEnvironment>; QueryEnvironment(const vespalib::string & location, const IndexEnvironment & indexEnv, diff --git a/streamingvisitors/src/vespa/searchvisitor/querywrapper.h b/streamingvisitors/src/vespa/searchvisitor/querywrapper.h index 90343085298..32a9c5e7c57 100644 --- a/streamingvisitors/src/vespa/searchvisitor/querywrapper.h +++ b/streamingvisitors/src/vespa/searchvisitor/querywrapper.h @@ -50,7 +50,7 @@ public: bool isGeoPosTerm() const { return (_term != nullptr) && _term->isGeoLoc(); } }; - typedef std::vector<Term> TermList; + using TermList = std::vector<Term>; private: PhraseList _phraseList; diff --git a/streamingvisitors/src/vespa/searchvisitor/rankmanager.h b/streamingvisitors/src/vespa/searchvisitor/rankmanager.h index bdf839ab824..d600d905328 100644 --- a/streamingvisitors/src/vespa/searchvisitor/rankmanager.h +++ b/streamingvisitors/src/vespa/searchvisitor/rankmanager.h @@ -18,7 +18,7 @@ class RankManager { public: /** collection of field ids for an index **/ - typedef std::vector<uint32_t> View; + using View = std::vector<uint32_t>; /** * This class represents a snapshot of the rank-profiles config with associated setup per rank profile. @@ -26,9 +26,9 @@ public: **/ class Snapshot { private: - typedef std::pair<vespalib::string, search::fef::Properties> NamedPropertySet; - typedef vespalib::hash_map<vespalib::string, View> ViewMap; - typedef vespalib::hash_map<vespalib::string, int> Map; + using NamedPropertySet = std::pair<vespalib::string, search::fef::Properties>; + using ViewMap = vespalib::hash_map<vespalib::string, View>; + using Map = vespalib::hash_map<vespalib::string, int>; search::fef::TableManager _tableManager; IndexEnvironment _protoEnv; std::vector<NamedPropertySet> _properties; // property set per rank profile @@ -48,7 +48,7 @@ public: } public: - typedef std::shared_ptr<Snapshot> SP; + using SP = std::shared_ptr<Snapshot>; Snapshot(); ~Snapshot(); const std::vector<NamedPropertySet> & getProperties() const { return _properties; } diff --git a/streamingvisitors/src/vespa/searchvisitor/rankprocessor.h b/streamingvisitors/src/vespa/searchvisitor/rankprocessor.h index 3a2a28b0ee5..c2b3d8adedf 100644 --- a/streamingvisitors/src/vespa/searchvisitor/rankprocessor.h +++ b/streamingvisitors/src/vespa/searchvisitor/rankprocessor.h @@ -53,7 +53,7 @@ private: void unpackMatchData(search::fef::MatchData &matchData); public: - typedef std::unique_ptr<RankProcessor> UP; + using UP = std::unique_ptr<RankProcessor>; RankProcessor(RankManager::Snapshot::SP snapshot, const vespalib::string &rankProfile, diff --git a/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h b/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h index f08dd6052f1..dfe1f986469 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h +++ b/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h @@ -17,7 +17,7 @@ class SearchEnvironment : public storage::VisitorEnvironment private: class Env : public config::SimpleConfigurable { public: - typedef std::shared_ptr<Env> SP; + using SP = std::shared_ptr<Env>; Env(const vespalib::string & muffens, const config::ConfigUri & configUri, Fast_NormalizeWordFolder & wf); ~Env() override; const vsm::VSMAdapter * getVSMAdapter() const { return _vsmAdapter.get(); } @@ -31,9 +31,9 @@ private: std::unique_ptr<vsm::VSMAdapter> _vsmAdapter; std::unique_ptr<RankManager> _rankManager; }; - typedef vespalib::hash_map<vespalib::string, Env::SP> EnvMap; - typedef std::unique_ptr<EnvMap> EnvMapUP; - typedef std::vector<EnvMapUP> ThreadLocals; + using EnvMap = vespalib::hash_map<vespalib::string, Env::SP>; + using EnvMapUP = std::unique_ptr<EnvMap>; + using ThreadLocals = std::vector<EnvMapUP>; static __thread EnvMap * _localEnvMap; EnvMap _envMap; diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h index 7dbf1cd521b..06ab2eaeaaa 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h +++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h @@ -381,8 +381,8 @@ private: size_t _count; size_t _limit; }; - typedef std::vector< GroupingEntry > GroupingList; - typedef std::vector<vsm::StorageDocument::UP> DocumentVector; + using GroupingList = std::vector< GroupingEntry >; + using DocumentVector = std::vector<vsm::StorageDocument::UP>; class StreamingDocsumsState { using ResolveClassInfo = search::docsummary::IDocsumWriter::ResolveClassInfo; diff --git a/streamingvisitors/src/vespa/vsm/common/charbuffer.h b/streamingvisitors/src/vespa/vsm/common/charbuffer.h index 08618a9b973..137c4facf29 100644 --- a/streamingvisitors/src/vespa/vsm/common/charbuffer.h +++ b/streamingvisitors/src/vespa/vsm/common/charbuffer.h @@ -16,7 +16,7 @@ private: size_t _pos; public: - typedef std::shared_ptr<CharBuffer> SP; + using SP = std::shared_ptr<CharBuffer>; /** * Creates a char buffer with len bytes. diff --git a/streamingvisitors/src/vespa/vsm/common/document.h b/streamingvisitors/src/vespa/vsm/common/document.h index 8c11d27072b..de9ab052aa1 100644 --- a/streamingvisitors/src/vespa/vsm/common/document.h +++ b/streamingvisitors/src/vespa/vsm/common/document.h @@ -13,15 +13,15 @@ namespace vespalib { namespace vsm { /// Type to identify fields in documents. -typedef unsigned int FieldIdT; +using FieldIdT = unsigned int; /// A type to represent a list of FieldIds. -typedef std::vector<FieldIdT> FieldIdTList; +using FieldIdTList = std::vector<FieldIdT>; /// A type to represent all the fields contained in all the indexs. -typedef vespalib::hash_map<vespalib::string, FieldIdTList> IndexFieldMapT; +using IndexFieldMapT = vespalib::hash_map<vespalib::string, FieldIdTList>; /// A type to represent all the fields contained in all the indexs in an all the document types. -typedef vespalib::hash_map<vespalib::string, IndexFieldMapT> DocumentTypeIndexFieldMapT; +using DocumentTypeIndexFieldMapT = vespalib::hash_map<vespalib::string, IndexFieldMapT>; /// A type to represent a map from fieldname to fieldid. -typedef std::map<vespalib::string, FieldIdT> StringFieldIdTMapT; +using StringFieldIdTMapT = std::map<vespalib::string, FieldIdT>; class StringFieldIdTMap { @@ -38,7 +38,7 @@ class StringFieldIdTMap StringFieldIdTMapT _map; }; -typedef vespalib::stringref FieldRef; +using FieldRef = vespalib::stringref; /** This is the base class representing a document. It gives a document some diff --git a/streamingvisitors/src/vespa/vsm/common/documenttypemapping.h b/streamingvisitors/src/vespa/vsm/common/documenttypemapping.h index 607b40cec47..0ee641135b0 100644 --- a/streamingvisitors/src/vespa/vsm/common/documenttypemapping.h +++ b/streamingvisitors/src/vespa/vsm/common/documenttypemapping.h @@ -42,8 +42,8 @@ private: void buildFieldMap(const document::DocumentType *docType, const StringFieldIdTMapT & fieldList, const vespalib::string & typeId); - typedef vespalib::hash_map<vespalib::string, FieldPathMapT> FieldPathMapMapT; - typedef std::multimap<size_t, const document::DocumentType *> DocumentTypeUsage; + using FieldPathMapMapT = vespalib::hash_map<vespalib::string, FieldPathMapT>; + using DocumentTypeUsage = std::multimap<size_t, const document::DocumentType *>; FieldPathMapMapT _fieldMap; vespalib::string _defaultDocumentTypeName; const document::DocumentType *_defaultDocumentType; diff --git a/streamingvisitors/src/vespa/vsm/common/fieldmodifier.h b/streamingvisitors/src/vespa/vsm/common/fieldmodifier.h index 60e480fa237..9fec3a82277 100644 --- a/streamingvisitors/src/vespa/vsm/common/fieldmodifier.h +++ b/streamingvisitors/src/vespa/vsm/common/fieldmodifier.h @@ -12,7 +12,7 @@ namespace vsm { class FieldModifier { public: - typedef std::unique_ptr<FieldModifier> UP; + using UP = std::unique_ptr<FieldModifier>; /** * Modifies the given field value and returns a new one. @@ -29,7 +29,7 @@ public: virtual ~FieldModifier() { } }; -typedef vespalib::hash_map<FieldIdT, FieldModifier::UP> FieldModifierMapT; +using FieldModifierMapT = vespalib::hash_map<FieldIdT, FieldModifier::UP>; /** * This class wraps a map from field id to field modifier. diff --git a/streamingvisitors/src/vespa/vsm/common/storagedocument.h b/streamingvisitors/src/vespa/vsm/common/storagedocument.h index 0ac94157462..cc7eaf391f4 100644 --- a/streamingvisitors/src/vespa/vsm/common/storagedocument.h +++ b/streamingvisitors/src/vespa/vsm/common/storagedocument.h @@ -6,14 +6,14 @@ namespace vsm { -typedef vespalib::CloneablePtr<document::FieldValue> FieldValueContainer; -typedef document::FieldPath FieldPath; // field path to navigate a field value -typedef std::vector<FieldPath> FieldPathMapT; // map from field id to field path -typedef std::shared_ptr<FieldPathMapT> SharedFieldPathMap; +using FieldValueContainer = vespalib::CloneablePtr<document::FieldValue>; +using FieldPath = document::FieldPath; // field path to navigate a field value +using FieldPathMapT = std::vector<FieldPath>; // map from field id to field path +using SharedFieldPathMap = std::shared_ptr<FieldPathMapT>; class StorageDocument : public Document { public: - typedef std::unique_ptr<StorageDocument> UP; + using UP = std::unique_ptr<StorageDocument>; class SubDocument { public: diff --git a/streamingvisitors/src/vespa/vsm/config/vsm-cfif.h b/streamingvisitors/src/vespa/vsm/config/vsm-cfif.h index 22033aee232..4adefb31867 100644 --- a/streamingvisitors/src/vespa/vsm/config/vsm-cfif.h +++ b/streamingvisitors/src/vespa/vsm/config/vsm-cfif.h @@ -12,14 +12,14 @@ using vespa::config::search::vsm::VsmfieldsConfig; namespace vsm { -typedef vespalib::PtrHolder<VsmfieldsConfig> VsmfieldsHolder; -typedef std::shared_ptr<VsmfieldsConfig> VsmfieldsHandle; +using VsmfieldsHolder = vespalib::PtrHolder<VsmfieldsConfig>; +using VsmfieldsHandle = std::shared_ptr<VsmfieldsConfig>; -typedef vespalib::PtrHolder<VsmConfig> VsmHolder; -typedef std::shared_ptr<VsmConfig> VsmHandle; +using VsmHolder = vespalib::PtrHolder<VsmConfig>; +using VsmHandle = std::shared_ptr<VsmConfig>; -typedef vespalib::PtrHolder<VsmsummaryConfig> FastS_VsmsummaryHolder; -typedef std::shared_ptr<VsmsummaryConfig> FastS_VsmsummaryHandle; +using FastS_VsmsummaryHolder = vespalib::PtrHolder<VsmsummaryConfig>; +using FastS_VsmsummaryHandle = std::shared_ptr<VsmsummaryConfig>; } diff --git a/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.h b/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.h index 5c2ef8fec28..bde23efad5a 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.h @@ -8,8 +8,8 @@ namespace vsm { -typedef size_t termcount_t; -typedef size_t termsize_t; +using termcount_t = size_t; +using termsize_t = size_t; #if defined(COLLECT_CHAR_STAT) #define NEED_CHAR_STAT(a) { a; } @@ -17,10 +17,10 @@ typedef size_t termsize_t; #define NEED_CHAR_STAT(a) #endif -typedef ucs4_t cmptype_t; -typedef vespalib::Array<cmptype_t> SearcherBuf; -typedef std::shared_ptr<SearcherBuf> SharedSearcherBuf; -typedef std::vector<char> CharVector; +using cmptype_t = ucs4_t; +using SearcherBuf = vespalib::Array<cmptype_t>; +using SharedSearcherBuf = std::shared_ptr<SearcherBuf>; +using CharVector = std::vector<char>; class FieldSearcherBase { @@ -135,8 +135,8 @@ public: static search::byte _wordChar[256]; }; -typedef std::unique_ptr<FieldSearcher> FieldSearcherContainer; -typedef std::vector<FieldSearcherContainer> FieldIdTSearcherMapT; +using FieldSearcherContainer = std::unique_ptr<FieldSearcher>; +using FieldIdTSearcherMapT = std::vector<FieldSearcherContainer>; class FieldIdTSearcherMap : public FieldIdTSearcherMapT { diff --git a/streamingvisitors/src/vespa/vsm/searcher/floatfieldsearcher.h b/streamingvisitors/src/vespa/vsm/searcher/floatfieldsearcher.h index 98018fbf4a3..80f79fd6491 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/floatfieldsearcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/floatfieldsearcher.h @@ -28,12 +28,12 @@ protected: T _upper; bool _valid; }; - typedef std::vector<FloatInfo> FloatInfoListT; + using FloatInfoListT = std::vector<FloatInfo>; FloatInfoListT _floatTerm; }; -typedef FloatFieldSearcherT<float> FloatFieldSearcherTF; -typedef FloatFieldSearcherT<double> FloatFieldSearcherTD; +using FloatFieldSearcherTF = FloatFieldSearcherT<float>; +using FloatFieldSearcherTD = FloatFieldSearcherT<double>; class FloatFieldSearcher : public FloatFieldSearcherTF { diff --git a/streamingvisitors/src/vespa/vsm/searcher/geo_pos_field_searcher.h b/streamingvisitors/src/vespa/vsm/searcher/geo_pos_field_searcher.h index ef1c5b5a1c4..307be1dacab 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/geo_pos_field_searcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/geo_pos_field_searcher.h @@ -21,7 +21,7 @@ protected: GeoPosInfo (GeoLocation loc) noexcept : GeoLocation(std::move(loc)) {} bool cmp(const document::StructFieldValue & fv) const; }; - typedef std::vector<GeoPosInfo> GeoPosInfoListT; + using GeoPosInfoListT = std::vector<GeoPosInfo>; GeoPosInfoListT _geoPosTerm; }; diff --git a/streamingvisitors/src/vespa/vsm/searcher/intfieldsearcher.h b/streamingvisitors/src/vespa/vsm/searcher/intfieldsearcher.h index a2b17a87f4b..6645a5d719a 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/intfieldsearcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/intfieldsearcher.h @@ -25,7 +25,7 @@ protected: int64_t _upper; bool _valid; }; - typedef std::vector<IntInfo> IntInfoListT; + using IntInfoListT = std::vector<IntInfo>; IntInfoListT _intTerm; }; diff --git a/streamingvisitors/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h b/streamingvisitors/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h index 0127a7f2827..4802619c3db 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h +++ b/streamingvisitors/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h @@ -6,7 +6,7 @@ namespace vsm { -typedef std::shared_ptr<std::vector<size_t> > SharedOffsetBuffer; +using SharedOffsetBuffer = std::shared_ptr<std::vector<size_t> >; /** * This class does substring searches the same way as UTF8SubStringFieldSearcher. @@ -47,7 +47,7 @@ private: void insertSeparators(const char * mbegin, const char * mend); public: - typedef std::shared_ptr<UTF8SubstringSnippetModifier> SP; + using SP = std::shared_ptr<UTF8SubstringSnippetModifier>; std::unique_ptr<FieldSearcher> duplicate() const override; diff --git a/streamingvisitors/src/vespa/vsm/vsm/docsumfieldspec.h b/streamingvisitors/src/vespa/vsm/vsm/docsumfieldspec.h index b576cb737eb..c75bace1cc7 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/docsumfieldspec.h +++ b/streamingvisitors/src/vespa/vsm/vsm/docsumfieldspec.h @@ -34,7 +34,7 @@ public: const FieldPath & getPath() const { return _path; } }; - typedef std::vector<FieldIdentifier> FieldIdentifierVector; + using FieldIdentifierVector = std::vector<FieldIdentifier>; private: bool _struct_or_multivalue; // property of the output field diff --git a/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.h b/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.h index 7b78a8634e0..14a30ed8c36 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.h +++ b/streamingvisitors/src/vespa/vsm/vsm/fieldsearchspec.h @@ -39,7 +39,7 @@ private: bool _reconfigured; }; -typedef std::map<FieldIdT, FieldSearchSpec> FieldSearchSpecMapT; +using FieldSearchSpecMapT = std::map<FieldIdT, FieldSearchSpec>; class FieldSearchSpecMap { diff --git a/streamingvisitors/src/vespa/vsm/vsm/snippetmodifier.cpp b/streamingvisitors/src/vespa/vsm/vsm/snippetmodifier.cpp index f3956cbb11f..1993f1cf657 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/snippetmodifier.cpp +++ b/streamingvisitors/src/vespa/vsm/vsm/snippetmodifier.cpp @@ -11,7 +11,7 @@ LOG_SETUP(".vsm.snippetmodifier"); using namespace document; using search::streaming::QueryTerm; using search::streaming::QueryTermList; -typedef vespalib::hash_map<vsm::FieldIdT, QueryTermList> FieldQueryTermMap; +using FieldQueryTermMap = vespalib::hash_map<vsm::FieldIdT, QueryTermList>; namespace { diff --git a/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h b/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h index 63704b1c5a7..650a7121a2e 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h +++ b/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h @@ -88,7 +88,7 @@ public: const juniper::Juniper * getJuniper() const override { return _juniper.get(); } }; -typedef std::shared_ptr<DocsumTools> DocsumToolsPtr; +using DocsumToolsPtr = std::shared_ptr<DocsumTools>; class VSMConfigSnapshot { private: diff --git a/vbench/src/apps/vbench/vbench.cpp b/vbench/src/apps/vbench/vbench.cpp index edaa68b8838..ffea64c6034 100644 --- a/vbench/src/apps/vbench/vbench.cpp +++ b/vbench/src/apps/vbench/vbench.cpp @@ -10,7 +10,7 @@ using namespace vbench; VESPA_THREAD_STACK_TAG(vbench_thread); -typedef vespalib::SignalHandler SIG; +using SIG = vespalib::SignalHandler; struct NotifyDone : public vespalib::Runnable { vespalib::Gate &done; diff --git a/vbench/src/vbench/core/stream.h b/vbench/src/vbench/core/stream.h index f6cfdc31ed7..dcbcb3080b9 100644 --- a/vbench/src/vbench/core/stream.h +++ b/vbench/src/vbench/core/stream.h @@ -21,7 +21,7 @@ struct Stream : public Input, public Taintable { ~Stream() { } - typedef std::unique_ptr<Stream> UP; + using UP = std::unique_ptr<Stream>; virtual bool eof() const = 0; }; diff --git a/vbench/src/vbench/core/string.h b/vbench/src/vbench/core/string.h index 0c374d2711a..f09f010e265 100644 --- a/vbench/src/vbench/core/string.h +++ b/vbench/src/vbench/core/string.h @@ -16,9 +16,9 @@ namespace vbench { // define which string class to use #if USE_VESPA_STRING -typedef vespalib::string string; +using string = vespalib::string; #else -typedef std::string string; +using string = std::string; #endif extern string strfmt(const char *fmt, ...) diff --git a/vbench/src/vbench/http/benchmark_headers.cpp b/vbench/src/vbench/http/benchmark_headers.cpp index d40de8da01d..04a9528f335 100644 --- a/vbench/src/vbench/http/benchmark_headers.cpp +++ b/vbench/src/vbench/http/benchmark_headers.cpp @@ -26,8 +26,8 @@ struct HeaderTraverser { }; struct HeaderMapper { typedef BenchmarkHeaders::Value BenchmarkHeaders::*ValueRef; - typedef std::map<string,ValueRef> HeaderMap; - typedef std::map<string,ValueRef>::iterator HeaderEntry; + using HeaderMap = std::map<string,ValueRef>; + using HeaderEntry = std::map<string,ValueRef>::iterator; HeaderMap map; HeaderMapper() : map() { map[NUM_HITS] = &BenchmarkHeaders::num_hits; diff --git a/vbench/src/vbench/http/http_connection.h b/vbench/src/vbench/http/http_connection.h index b0224b5f83d..232be5669c1 100644 --- a/vbench/src/vbench/http/http_connection.h +++ b/vbench/src/vbench/http/http_connection.h @@ -22,7 +22,7 @@ private: public: using CryptoEngine = vespalib::CryptoEngine; - typedef std::unique_ptr<HttpConnection> UP; + using UP = std::unique_ptr<HttpConnection>; HttpConnection(CryptoEngine &crypto, const ServerSpec &server); bool fresh() const { return (_lastUsed < 0); } diff --git a/vbench/src/vbench/http/http_connection_pool.h b/vbench/src/vbench/http/http_connection_pool.h index 6c938abd692..7b77cab1b08 100644 --- a/vbench/src/vbench/http/http_connection_pool.h +++ b/vbench/src/vbench/http/http_connection_pool.h @@ -17,8 +17,8 @@ namespace vbench { class HttpConnectionPool { private: - typedef vespalib::ArrayQueue<HttpConnection::UP> Queue; - typedef std::map<ServerSpec, size_t> Map; + using Queue = vespalib::ArrayQueue<HttpConnection::UP>; + using Map = std::map<ServerSpec, size_t>; using CryptoEngine = vespalib::CryptoEngine; std::mutex _lock; diff --git a/vbench/src/vbench/vbench/analyzer.h b/vbench/src/vbench/vbench/analyzer.h index cddae612fe9..48eb9a56084 100644 --- a/vbench/src/vbench/vbench/analyzer.h +++ b/vbench/src/vbench/vbench/analyzer.h @@ -9,7 +9,7 @@ namespace vbench { struct Analyzer : public Handler<Request> { - typedef std::unique_ptr<Analyzer> UP; + using UP = std::unique_ptr<Analyzer>; virtual void report() = 0; virtual ~Analyzer() {} }; diff --git a/vbench/src/vbench/vbench/generator.h b/vbench/src/vbench/vbench/generator.h index 527e03f24c5..405677be380 100644 --- a/vbench/src/vbench/vbench/generator.h +++ b/vbench/src/vbench/vbench/generator.h @@ -11,7 +11,7 @@ namespace vbench { struct Generator : public vespalib::Runnable, public Taintable { - typedef std::unique_ptr<Generator> UP; + using UP = std::unique_ptr<Generator>; virtual void abort() = 0; virtual ~Generator() {} }; diff --git a/vbench/src/vbench/vbench/request.h b/vbench/src/vbench/vbench/request.h index a913977a325..8fd71770c61 100644 --- a/vbench/src/vbench/vbench/request.h +++ b/vbench/src/vbench/vbench/request.h @@ -17,7 +17,7 @@ namespace vbench { class Request : public HttpResultHandler { public: - typedef std::unique_ptr<Request> UP; + using UP = std::unique_ptr<Request>; enum Status { STATUS_OK = 0, diff --git a/vbench/src/vbench/vbench/request_scheduler.h b/vbench/src/vbench/vbench/request_scheduler.h index 0776f69ceaa..a0fb1eda4e7 100644 --- a/vbench/src/vbench/vbench/request_scheduler.h +++ b/vbench/src/vbench/vbench/request_scheduler.h @@ -32,7 +32,7 @@ private: void run() override; public: - typedef std::unique_ptr<RequestScheduler> UP; + using UP = std::unique_ptr<RequestScheduler>; using CryptoEngine = vespalib::CryptoEngine; RequestScheduler(CryptoEngine::SP crypto, Handler<Request> &next, size_t numWorkers); void abort(); diff --git a/vbench/src/vbench/vbench/tagger.h b/vbench/src/vbench/vbench/tagger.h index 2fa6b411e1d..6e332fb9e10 100644 --- a/vbench/src/vbench/vbench/tagger.h +++ b/vbench/src/vbench/vbench/tagger.h @@ -9,7 +9,7 @@ namespace vbench { struct Tagger : public Handler<Request> { - typedef std::unique_ptr<Tagger> UP; + using UP = std::unique_ptr<Tagger>; virtual ~Tagger() {} }; diff --git a/vbench/src/vbench/vbench/vbench.h b/vbench/src/vbench/vbench/vbench.h index ddcc316f9e6..dbb46e72800 100644 --- a/vbench/src/vbench/vbench/vbench.h +++ b/vbench/src/vbench/vbench/vbench.h @@ -23,7 +23,7 @@ class VBench : public vespalib::Runnable, { private: struct InputChain { - typedef std::unique_ptr<InputChain> UP; + using UP = std::unique_ptr<InputChain>; std::vector<Tagger::UP> taggers; Generator::UP generator; std::unique_ptr<vespalib::Thread> thread; diff --git a/vbench/src/vbench/vbench/worker.h b/vbench/src/vbench/vbench/worker.h index e40f7cd5300..6594a4f3dd6 100644 --- a/vbench/src/vbench/vbench/worker.h +++ b/vbench/src/vbench/vbench/worker.h @@ -30,7 +30,7 @@ private: void run() override; public: - typedef std::unique_ptr<Worker> UP; + using UP = std::unique_ptr<Worker>; Worker(Provider<Request> &provider, Handler<Request> &next, HttpConnectionPool &pool, Timer &timer); void join() override { _thread.join(); } diff --git a/vdslib/src/tests/distribution/distributiontest.cpp b/vdslib/src/tests/distribution/distributiontest.cpp index dee620738c6..a10aca45b33 100644 --- a/vdslib/src/tests/distribution/distributiontest.cpp +++ b/vdslib/src/tests/distribution/distributiontest.cpp @@ -872,7 +872,7 @@ std::string groupConfig("group[3]\n" TEST(DistributionTest, test_active_per_group) { - typedef Distribution::IndexList IndexList; + using IndexList = Distribution::IndexList; // Disabled feature { Distribution distr("redundancy 4\n" + groupConfig); diff --git a/vdslib/src/vespa/vdslib/container/documentsummary.h b/vdslib/src/vespa/vdslib/container/documentsummary.h index 8bb70640d5f..8421eca3119 100644 --- a/vdslib/src/vespa/vdslib/container/documentsummary.h +++ b/vdslib/src/vespa/vdslib/container/documentsummary.h @@ -56,7 +56,7 @@ private: } }; size_t getSummarySize() const { return _summarySize; } - typedef std::shared_ptr<vespalib::MallocPtr> DocBuffer; + using DocBuffer = std::shared_ptr<vespalib::MallocPtr>; DocBuffer _summaryBuffer; // Raw zero-terminated documentids in rank order. std::vector<Summary> _summary; // Constructed vector containing offset of document in buffer. size_t _summarySize; diff --git a/vdslib/src/vespa/vdslib/container/parameters.h b/vdslib/src/vespa/vdslib/container/parameters.h index 41c95d14da4..dd5de02dee6 100644 --- a/vdslib/src/vespa/vdslib/container/parameters.h +++ b/vdslib/src/vespa/vdslib/container/parameters.h @@ -24,7 +24,7 @@ namespace vdslib { class Parameters : public vespalib::xml::XmlSerializable { public: - typedef vespalib::stringref KeyT; + using KeyT = vespalib::stringref; class Value : public vespalib::string { public: @@ -34,8 +34,8 @@ public: Value(const void *v, size_t sz) : vespalib::string(v, sz) { } size_t length() const { return size() - 1; } }; - typedef vespalib::stringref ValueRef; - typedef vespalib::hash_map<vespalib::string, Value> ParametersMap; + using ValueRef = vespalib::stringref; + using ParametersMap = vespalib::hash_map<vespalib::string, Value>; private: ParametersMap _parameters; diff --git a/vdslib/src/vespa/vdslib/container/searchresult.h b/vdslib/src/vespa/vdslib/container/searchresult.h index cb61926253f..90fb282c8fd 100644 --- a/vdslib/src/vespa/vdslib/container/searchresult.h +++ b/vdslib/src/vespa/vdslib/container/searchresult.h @@ -9,7 +9,7 @@ namespace document { class ByteBuffer; } namespace vespalib { class GrowableByteBuffer; } namespace vdslib { -typedef std::map<size_t, vespalib::MallocPtr> IntBlobMapT; +using IntBlobMapT = std::map<size_t, vespalib::MallocPtr>; class AggregatorList : public IntBlobMapT { @@ -35,14 +35,14 @@ public: void serialize(vespalib::GrowableByteBuffer & buf) const; uint32_t getSerializedSize() const { return (1 + getCount()) * sizeof(uint32_t) + getSize(); } private: - typedef vespalib::MallocPtr Blob; + using Blob = vespalib::MallocPtr; Blob _blob; std::vector<size_t> _offsets; }; class SearchResult { public: - typedef double RankType; + using RankType = double; public: SearchResult(); @@ -121,7 +121,7 @@ private: } }; size_t getBufCount() const { return _numDocIdBytes; } - typedef std::shared_ptr<vespalib::MallocPtr> DocIdBuffer; + using DocIdBuffer = std::shared_ptr<vespalib::MallocPtr>; uint32_t _totalHits; size_t _wantedHits; std::vector<Hit> _hits; // Corresponding rank. diff --git a/vdslib/src/vespa/vdslib/defs.h b/vdslib/src/vespa/vdslib/defs.h index f1c6a417b69..0832fa35987 100644 --- a/vdslib/src/vespa/vdslib/defs.h +++ b/vdslib/src/vespa/vdslib/defs.h @@ -6,7 +6,7 @@ namespace vdslib { -typedef uint64_t Timestamp; +using Timestamp = uint64_t; const Timestamp MAX_TIMESTAMP = (Timestamp)-1ll; } diff --git a/vdslib/src/vespa/vdslib/distribution/distribution.cpp b/vdslib/src/vespa/vdslib/distribution/distribution.cpp index 582839158ef..e9113d7dd23 100644 --- a/vdslib/src/vespa/vdslib/distribution/distribution.cpp +++ b/vdslib/src/vespa/vdslib/distribution/distribution.cpp @@ -109,7 +109,7 @@ Distribution::~Distribution() = default; void Distribution::configure(const vespa::config::content::StorDistributionConfig& config) { - typedef vespa::config::content::StorDistributionConfig::Group ConfigGroup; + using ConfigGroup = vespa::config::content::StorDistributionConfig::Group; std::unique_ptr<Group> nodeGraph; std::vector<const Group *> node2Group; for (uint32_t i=0, n=config.group.size(); i<n; ++i) { diff --git a/vdslib/src/vespa/vdslib/distribution/distribution.h b/vdslib/src/vespa/vdslib/distribution/distribution.h index 7b4f0b742e2..355b87884c1 100644 --- a/vdslib/src/vespa/vdslib/distribution/distribution.h +++ b/vdslib/src/vespa/vdslib/distribution/distribution.h @@ -26,8 +26,8 @@ class NodeState; class Distribution : public document::Printable { public: - typedef std::shared_ptr<Distribution> SP; - typedef std::unique_ptr<Distribution> UP; + using SP = std::shared_ptr<Distribution>; + using UP = std::unique_ptr<Distribution>; using DistributionConfig = const vespa::config::content::internal::InternalStorDistributionType; using DistributionConfigBuilder = vespa::config::content::internal::InternalStorDistributionType; @@ -166,7 +166,7 @@ public: * Utility function used by distributor to split copies into groups to * handle active per group feature. */ - typedef std::vector<uint16_t> IndexList; + using IndexList = std::vector<uint16_t>; std::vector<IndexList> splitNodesIntoLeafGroups(IndexList nodes) const; static bool allDistributorsDown(const Group&, const ClusterState&); diff --git a/vdslib/src/vespa/vdslib/distribution/idealnodecalculator.h b/vdslib/src/vespa/vdslib/distribution/idealnodecalculator.h index 8f9061ec545..bc42df1b49c 100644 --- a/vdslib/src/vespa/vdslib/distribution/idealnodecalculator.h +++ b/vdslib/src/vespa/vdslib/distribution/idealnodecalculator.h @@ -55,7 +55,7 @@ public: */ class IdealNodeCalculator { public: - typedef std::shared_ptr<IdealNodeCalculator> SP; + using SP = std::shared_ptr<IdealNodeCalculator>; enum UpStates { UpInit, UpInitMaintenance, @@ -85,7 +85,7 @@ public: class IdealNodeCalculatorConfigurable : public IdealNodeCalculator { public: - typedef std::shared_ptr<IdealNodeCalculatorConfigurable> SP; + using SP = std::shared_ptr<IdealNodeCalculatorConfigurable>; virtual void setDistribution(const Distribution&) = 0; virtual void setClusterState(const ClusterState&) = 0; diff --git a/vdslib/src/vespa/vdslib/state/clusterstate.h b/vdslib/src/vespa/vdslib/state/clusterstate.h index 5fc4680e172..3af5a45fcac 100644 --- a/vdslib/src/vespa/vdslib/state/clusterstate.h +++ b/vdslib/src/vespa/vdslib/state/clusterstate.h @@ -30,9 +30,9 @@ class ClusterState : public document::Printable { const ClusterState& other) const; public: - typedef std::shared_ptr<const ClusterState> CSP; - typedef std::shared_ptr<ClusterState> SP; - typedef std::unique_ptr<ClusterState> UP; + using CSP = std::shared_ptr<const ClusterState>; + using SP = std::shared_ptr<ClusterState>; + using UP = std::unique_ptr<ClusterState>; ClusterState(); ClusterState(const ClusterState&); diff --git a/vdslib/src/vespa/vdslib/state/nodestate.h b/vdslib/src/vespa/vdslib/state/nodestate.h index 913d4d93be8..541395e15cb 100644 --- a/vdslib/src/vespa/vdslib/state/nodestate.h +++ b/vdslib/src/vespa/vdslib/state/nodestate.h @@ -28,9 +28,9 @@ class NodeState : public document::Printable uint64_t _startTimestamp; public: - typedef std::shared_ptr<const NodeState> CSP; - typedef std::shared_ptr<NodeState> SP; - typedef std::unique_ptr<NodeState> UP; + using CSP = std::shared_ptr<const NodeState>; + using SP = std::shared_ptr<NodeState>; + using UP = std::unique_ptr<NodeState>; static double getListingBucketsInitProgressLimit() { return 0.01; } 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; |