diff options
author | Geir Storli <geirst@yahooinc.com> | 2022-12-21 15:08:48 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahooinc.com> | 2022-12-21 15:49:53 +0000 |
commit | 40add664cca86e6c1591b9503b6ce7f568874388 (patch) | |
tree | 393824345d0d324b7a578ba1b25739bf4499158f | |
parent | 762d9bb079b201a4fc72c67853909a8d5a3f4f15 (diff) |
Change from typedef to using in misc C++ code.
32 files changed, 50 insertions, 50 deletions
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/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/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/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(); } |