From 38351f5778d0f2676b45c181df55570262107158 Mon Sep 17 00:00:00 2001 From: Stephane Janel Date: Wed, 11 Oct 2023 10:39:06 +0200 Subject: [PATCH] Clang 17 support - remove clang < 17 support --- .github/workflows/ubuntu-clang-tidy.yml | 2 +- .github/workflows/ubuntu.yml | 6 ++-- INSTALL.md | 4 +-- src/api-objects/include/tradeinfo.hpp | 14 -------- src/api/common/src/exchangepublicapi.cpp | 5 --- .../exchanges/include/binanceprivateapi.hpp | 5 --- .../exchanges/include/binancepublicapi.hpp | 27 -------------- .../exchanges/include/bithumbprivateapi.hpp | 5 --- .../exchanges/include/bithumbpublicapi.hpp | 19 ---------- src/api/exchanges/include/huobiprivateapi.hpp | 9 ----- src/api/exchanges/include/huobipublicapi.hpp | 27 -------------- .../exchanges/include/krakenprivateapi.hpp | 5 --- src/api/exchanges/include/krakenpublicapi.hpp | 35 ------------------- .../exchanges/include/kucoinprivateapi.hpp | 5 --- src/api/exchanges/include/kucoinpublicapi.hpp | 35 ------------------- src/api/exchanges/include/upbitprivateapi.hpp | 16 --------- src/api/exchanges/include/upbitpublicapi.hpp | 32 ----------------- src/engine/include/coincenteroptions.hpp | 3 +- .../include/commandlineoptionsparser.hpp | 5 ++- src/objects/include/exchangeinfoparser.hpp | 4 --- src/objects/include/marketorderbook.hpp | 8 ----- .../include/volumeandpricenbdecimals.hpp | 6 ---- src/tech/include/cct_config.hpp | 10 +----- src/tech/include/cct_hash.hpp | 4 --- src/tech/include/flatkeyvaluestring.hpp | 6 ---- 25 files changed, 10 insertions(+), 287 deletions(-) diff --git a/.github/workflows/ubuntu-clang-tidy.yml b/.github/workflows/ubuntu-clang-tidy.yml index 2bc810cc..97668a6f 100644 --- a/.github/workflows/ubuntu-clang-tidy.yml +++ b/.github/workflows/ubuntu-clang-tidy.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - clang-version: [14] + clang-version: [17] buildmode: [Debug] steps: diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index c3df12dd..49ee2eb0 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - compiler: [g++-11, clang++-13] + compiler: [g++-11, clang++-17] buildmode: [Debug, Release] steps: @@ -32,8 +32,8 @@ jobs: run: | wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh - sudo ./llvm.sh 13 - if: matrix.compiler == 'clang++-13' + sudo ./llvm.sh 17 + if: matrix.compiler == 'clang++-17' - name: Create Build Environment run: cmake -E make_directory ${{github.workspace}}/build diff --git a/INSTALL.md b/INSTALL.md index 2849f065..6da9d94a 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -44,14 +44,14 @@ docker run --mount type=bind,source=,target=/app/data This is a **C++20** project. -It's still currently (as of beginning of 2023) not fully supported by any compiler (although GCC is very close, see [here](https://en.cppreference.com/w/cpp/compiler_support)). +It's still currently (as of beginning of 2023) not fully supported by most compilers (MSVC does, GCC is very close, see [here](https://en.cppreference.com/w/cpp/compiler_support)). But they have partial support which is sufficient to build `coincenter`. The following compilers are known to compile `coincenter` (and are tested in the CI): - **GCC** version >= 11 -- **Clang** version >= 14 +- **Clang** version >= 17 - **MSVC** version >= 19.30 Other compilers have not been tested. diff --git a/src/api-objects/include/tradeinfo.hpp b/src/api-objects/include/tradeinfo.hpp index 9c09e5e5..f442df99 100644 --- a/src/api-objects/include/tradeinfo.hpp +++ b/src/api-objects/include/tradeinfo.hpp @@ -23,20 +23,11 @@ struct TradeContext { }; struct TradeInfo { -#ifndef CCT_AGGR_INIT_CXX20 - TradeInfo(const TradeContext &tradeContext, const TradeOptions &opts) : tradeContext(tradeContext), options(opts) {} -#endif - TradeContext tradeContext; TradeOptions options; }; struct OrderInfo { -#ifndef CCT_AGGR_INIT_CXX20 - explicit OrderInfo(const TradedAmounts &ta, bool closed = false) : tradedAmounts(ta), isClosed(closed) {} - explicit OrderInfo(TradedAmounts &&ta, bool closed = false) : tradedAmounts(std::move(ta)), isClosed(closed) {} -#endif - bool operator==(const OrderInfo &) const = default; TradedAmounts tradedAmounts; @@ -44,11 +35,6 @@ struct OrderInfo { }; struct PlaceOrderInfo { -#ifndef CCT_AGGR_INIT_CXX20 - PlaceOrderInfo(const OrderInfo &oInfo, const OrderId &orderId) : orderInfo(oInfo), orderId(orderId) {} - PlaceOrderInfo(OrderInfo &&oInfo, OrderId &&orderId) : orderInfo(std::move(oInfo)), orderId(std::move(orderId)) {} -#endif - bool isClosed() const { return orderInfo.isClosed; } void setClosed() { orderInfo.isClosed = true; } diff --git a/src/api/common/src/exchangepublicapi.cpp b/src/api/common/src/exchangepublicapi.cpp index 19fec950..0edc4dbe 100644 --- a/src/api/common/src/exchangepublicapi.cpp +++ b/src/api/common/src/exchangepublicapi.cpp @@ -64,11 +64,6 @@ namespace { // Optimized struct containing a currency and a reverse bool to keep market directionality information struct CurrencyDir { -#ifndef CCT_AGGR_INIT_CXX20 - CurrencyDir(CurrencyCode cur, bool isLastRealMarketReversed) - : cur(cur), isLastRealMarketReversed(isLastRealMarketReversed) {} -#endif - CurrencyCode cur; bool isLastRealMarketReversed; }; diff --git a/src/api/exchanges/include/binanceprivateapi.hpp b/src/api/exchanges/include/binanceprivateapi.hpp index 2b47fd5f..9e1f3a0f 100644 --- a/src/api/exchanges/include/binanceprivateapi.hpp +++ b/src/api/exchanges/include/binanceprivateapi.hpp @@ -70,11 +70,6 @@ class BinancePrivate : public ExchangePrivate { bool checkMarketAppendSymbol(Market mk, CurlPostData& params); struct BinanceContext { -#ifndef CCT_AGGR_INIT_CXX20 - BinanceContext(CurlHandle& curlHandle, const APIKey& apiKey, BinancePublic& exchangePublic, Duration& queryDelay) - : _curlHandle(curlHandle), _apiKey(apiKey), _exchangePublic(exchangePublic), _queryDelay(queryDelay) {} -#endif - CurlHandle& _curlHandle; const APIKey& _apiKey; BinancePublic& _exchangePublic; diff --git a/src/api/exchanges/include/binancepublicapi.hpp b/src/api/exchanges/include/binancepublicapi.hpp index 87c0ea57..beab4963 100644 --- a/src/api/exchanges/include/binancepublicapi.hpp +++ b/src/api/exchanges/include/binancepublicapi.hpp @@ -83,10 +83,6 @@ class BinancePublic : public ExchangePublic { struct ExchangeInfoFunc { using ExchangeInfoDataByMarket = std::unordered_map; -#ifndef CCT_AGGR_INIT_CXX20 - explicit ExchangeInfoFunc(CommonInfo& commonInfo) : _commonInfo(commonInfo) {} -#endif - ExchangeInfoDataByMarket operator()(); CommonInfo& _commonInfo; @@ -105,12 +101,6 @@ class BinancePublic : public ExchangePublic { }; struct MarketsFunc { -#ifndef CCT_AGGR_INIT_CXX20 - MarketsFunc(CachedResult& exchangeInfoCache, CurlHandle& curlHandle, - const ExchangeInfo& exchangeInfo) - : _exchangeInfoCache(exchangeInfoCache), _curlHandle(curlHandle), _exchangeInfo(exchangeInfo) {} -#endif - MarketSet operator()(); CachedResult& _exchangeInfoCache; @@ -119,12 +109,6 @@ class BinancePublic : public ExchangePublic { }; struct AllOrderBooksFunc { -#ifndef CCT_AGGR_INIT_CXX20 - AllOrderBooksFunc(CachedResult& exchangeInfoCache, CachedResult& marketsCache, - CommonInfo& commonInfo) - : _exchangeInfoCache(exchangeInfoCache), _marketsCache(marketsCache), _commonInfo(commonInfo) {} -#endif - MarketOrderBookMap operator()(int depth); CachedResult& _exchangeInfoCache; @@ -133,29 +117,18 @@ class BinancePublic : public ExchangePublic { }; struct OrderBookFunc { -#ifndef CCT_AGGR_INIT_CXX20 - explicit OrderBookFunc(CommonInfo& commonInfo) : _commonInfo(commonInfo) {} -#endif - MarketOrderBook operator()(Market mk, int depth = kDefaultDepth); CommonInfo& _commonInfo; }; struct TradedVolumeFunc { -#ifndef CCT_AGGR_INIT_CXX20 - explicit TradedVolumeFunc(CommonInfo& commonInfo) : _commonInfo(commonInfo) {} -#endif MonetaryAmount operator()(Market mk); CommonInfo& _commonInfo; }; struct TickerFunc { -#ifndef CCT_AGGR_INIT_CXX20 - explicit TickerFunc(CommonInfo& commonInfo) : _commonInfo(commonInfo) {} -#endif - MonetaryAmount operator()(Market mk); CommonInfo& _commonInfo; diff --git a/src/api/exchanges/include/bithumbprivateapi.hpp b/src/api/exchanges/include/bithumbprivateapi.hpp index bae515c8..08a517c0 100644 --- a/src/api/exchanges/include/bithumbprivateapi.hpp +++ b/src/api/exchanges/include/bithumbprivateapi.hpp @@ -58,11 +58,6 @@ class BithumbPrivate : public ExchangePrivate { friend class BithumbPrivateAPIPlaceOrderTest; struct DepositWalletFunc { -#ifndef CCT_AGGR_INIT_CXX20 - DepositWalletFunc(CurlHandle& curlHandle, const APIKey& apiKey, BithumbPublic& exchangePublic) - : _curlHandle(curlHandle), _apiKey(apiKey), _exchangePublic(exchangePublic) {} -#endif - Wallet operator()(CurrencyCode currencyCode); CurlHandle& _curlHandle; diff --git a/src/api/exchanges/include/bithumbpublicapi.hpp b/src/api/exchanges/include/bithumbpublicapi.hpp index 7d16741b..5df1e785 100644 --- a/src/api/exchanges/include/bithumbpublicapi.hpp +++ b/src/api/exchanges/include/bithumbpublicapi.hpp @@ -59,11 +59,6 @@ class BithumbPublic : public ExchangePublic { friend class BithumbPrivate; struct TradableCurrenciesFunc { -#ifndef CCT_AGGR_INIT_CXX20 - TradableCurrenciesFunc(const CoincenterInfo& config, CommonAPI& commonAPI, CurlHandle& curlHandle) - : _coincenterInfo(config), _commonAPI(commonAPI), _curlHandle(curlHandle) {} -#endif - CurrencyExchangeFlatSet operator()(); const CoincenterInfo& _coincenterInfo; @@ -84,11 +79,6 @@ class BithumbPublic : public ExchangePublic { }; struct AllOrderBooksFunc { -#ifndef CCT_AGGR_INIT_CXX20 - AllOrderBooksFunc(const CoincenterInfo& config, CurlHandle& curlHandle, const ExchangeInfo& exchangeInfo) - : _coincenterInfo(config), _curlHandle(curlHandle), _exchangeInfo(exchangeInfo) {} -#endif - MarketOrderBookMap operator()(); const CoincenterInfo& _coincenterInfo; @@ -97,11 +87,6 @@ class BithumbPublic : public ExchangePublic { }; struct OrderBookFunc { -#ifndef CCT_AGGR_INIT_CXX20 - OrderBookFunc(const CoincenterInfo& config, CurlHandle& curlHandle, const ExchangeInfo& exchangeInfo) - : _coincenterInfo(config), _curlHandle(curlHandle), _exchangeInfo(exchangeInfo) {} -#endif - MarketOrderBook operator()(Market mk, int depth); const CoincenterInfo& _coincenterInfo; @@ -110,10 +95,6 @@ class BithumbPublic : public ExchangePublic { }; struct TradedVolumeFunc { -#ifndef CCT_AGGR_INIT_CXX20 - explicit TradedVolumeFunc(CurlHandle& curlHandle) : _curlHandle(curlHandle) {} -#endif - MonetaryAmount operator()(Market mk); CurlHandle& _curlHandle; diff --git a/src/api/exchanges/include/huobiprivateapi.hpp b/src/api/exchanges/include/huobiprivateapi.hpp index 7e8e3f5d..f9952582 100644 --- a/src/api/exchanges/include/huobiprivateapi.hpp +++ b/src/api/exchanges/include/huobiprivateapi.hpp @@ -56,10 +56,6 @@ class HuobiPrivate : public ExchangePrivate { void cancelOrderProcess(OrderIdView orderId); struct AccountIdFunc { -#ifndef CCT_AGGR_INIT_CXX20 - AccountIdFunc(CurlHandle& curlHandle, const APIKey& apiKey) : _curlHandle(curlHandle), _apiKey(apiKey) {} -#endif - int operator()(); CurlHandle& _curlHandle; @@ -67,11 +63,6 @@ class HuobiPrivate : public ExchangePrivate { }; struct DepositWalletFunc { -#ifndef CCT_AGGR_INIT_CXX20 - DepositWalletFunc(CurlHandle& curlHandle, const APIKey& apiKey, const HuobiPublic& huobiPublic) - : _curlHandle(curlHandle), _apiKey(apiKey), _huobiPublic(huobiPublic) {} -#endif - Wallet operator()(CurrencyCode currencyCode); CurlHandle& _curlHandle; diff --git a/src/api/exchanges/include/huobipublicapi.hpp b/src/api/exchanges/include/huobipublicapi.hpp index 9f2367c6..b42a0634 100644 --- a/src/api/exchanges/include/huobipublicapi.hpp +++ b/src/api/exchanges/include/huobipublicapi.hpp @@ -73,21 +73,12 @@ class HuobiPublic : public ExchangePublic { friend class HuobiPrivate; struct TradableCurrenciesFunc { -#ifndef CCT_AGGR_INIT_CXX20 - explicit TradableCurrenciesFunc(CurlHandle& curlHandle) : _curlHandle(curlHandle) {} -#endif - json operator()(); CurlHandle& _curlHandle; }; struct MarketsFunc { -#ifndef CCT_AGGR_INIT_CXX20 - MarketsFunc(CurlHandle& curlHandle, const ExchangeInfo& exchangeInfo) - : _curlHandle(curlHandle), _exchangeInfo(exchangeInfo) {} -#endif - struct MarketInfo { VolAndPriNbDecimals volAndPriNbDecimals; @@ -112,11 +103,6 @@ class HuobiPublic : public ExchangePublic { }; struct AllOrderBooksFunc { -#ifndef CCT_AGGR_INIT_CXX20 - AllOrderBooksFunc(CachedResult& marketsCache, CurlHandle& curlHandle, const ExchangeInfo& exchangeInfo) - : _marketsCache(marketsCache), _curlHandle(curlHandle), _exchangeInfo(exchangeInfo) {} -#endif - MarketOrderBookMap operator()(int depth); CachedResult& _marketsCache; @@ -125,11 +111,6 @@ class HuobiPublic : public ExchangePublic { }; struct OrderBookFunc { -#ifndef CCT_AGGR_INIT_CXX20 - OrderBookFunc(CurlHandle& curlHandle, const ExchangeInfo& exchangeInfo) - : _curlHandle(curlHandle), _exchangeInfo(exchangeInfo) {} -#endif - MarketOrderBook operator()(Market mk, int depth); CurlHandle& _curlHandle; @@ -137,20 +118,12 @@ class HuobiPublic : public ExchangePublic { }; struct TradedVolumeFunc { -#ifndef CCT_AGGR_INIT_CXX20 - explicit TradedVolumeFunc(CurlHandle& curlHandle) : _curlHandle(curlHandle) {} -#endif - MonetaryAmount operator()(Market mk); CurlHandle& _curlHandle; }; struct TickerFunc { -#ifndef CCT_AGGR_INIT_CXX20 - explicit TickerFunc(CurlHandle& curlHandle) : _curlHandle(curlHandle) {} -#endif - MonetaryAmount operator()(Market mk); CurlHandle& _curlHandle; diff --git a/src/api/exchanges/include/krakenprivateapi.hpp b/src/api/exchanges/include/krakenprivateapi.hpp index a16de669..79c87b56 100644 --- a/src/api/exchanges/include/krakenprivateapi.hpp +++ b/src/api/exchanges/include/krakenprivateapi.hpp @@ -57,11 +57,6 @@ class KrakenPrivate : public ExchangePrivate { private: struct DepositWalletFunc { -#ifndef CCT_AGGR_INIT_CXX20 - DepositWalletFunc(CurlHandle& curlHandle, const APIKey& apiKey, KrakenPublic& exchangePublic) - : _curlHandle(curlHandle), _apiKey(apiKey), _exchangePublic(exchangePublic) {} -#endif - Wallet operator()(CurrencyCode currencyCode); CurlHandle& _curlHandle; diff --git a/src/api/exchanges/include/krakenpublicapi.hpp b/src/api/exchanges/include/krakenpublicapi.hpp index 4520c219..57c70dba 100644 --- a/src/api/exchanges/include/krakenpublicapi.hpp +++ b/src/api/exchanges/include/krakenpublicapi.hpp @@ -65,12 +65,6 @@ class KrakenPublic : public ExchangePublic { friend class KrakenPrivate; struct TradableCurrenciesFunc { -#ifndef CCT_AGGR_INIT_CXX20 - TradableCurrenciesFunc(const CoincenterInfo& config, CommonAPI& commonApi, CurlHandle& curlHandle, - const ExchangeInfo& exchangeInfo) - : _coincenterInfo(config), _commonApi(commonApi), _curlHandle(curlHandle), _exchangeInfo(exchangeInfo) {} -#endif - CurrencyExchangeFlatSet operator()(); const CoincenterInfo& _coincenterInfo; @@ -99,15 +93,6 @@ class KrakenPublic : public ExchangePublic { }; struct MarketsFunc { -#ifndef CCT_AGGR_INIT_CXX20 - MarketsFunc(CachedResult& currenciesCache, const CoincenterInfo& config, - CurlHandle& curlHandle, const ExchangeInfo& exchangeInfo) - : _tradableCurrenciesCache(currenciesCache), - _coincenterInfo(config), - _curlHandle(curlHandle), - _exchangeInfo(exchangeInfo) {} -#endif - struct MarketInfo { VolAndPriNbDecimals volAndPriNbDecimals; MonetaryAmount minVolumeOrder; @@ -124,15 +109,6 @@ class KrakenPublic : public ExchangePublic { }; struct AllOrderBooksFunc { -#ifndef CCT_AGGR_INIT_CXX20 - AllOrderBooksFunc(CachedResult& currenciesCache, CachedResult& marketsCache, - const CoincenterInfo& config, CurlHandle& curlHandle) - : _tradableCurrenciesCache(currenciesCache), - _marketsCache(marketsCache), - _coincenterInfo(config), - _curlHandle(curlHandle) {} -#endif - MarketOrderBookMap operator()(int depth); CachedResult& _tradableCurrenciesCache; @@ -142,12 +118,6 @@ class KrakenPublic : public ExchangePublic { }; struct OrderBookFunc { -#ifndef CCT_AGGR_INIT_CXX20 - OrderBookFunc(CachedResult& currenciesCache, CachedResult& marketsCache, - CurlHandle& curlHandle) - : _tradableCurrenciesCache(currenciesCache), _marketsCache(marketsCache), _curlHandle(curlHandle) {} -#endif - MarketOrderBook operator()(Market mk, int count); CachedResult& _tradableCurrenciesCache; @@ -158,11 +128,6 @@ class KrakenPublic : public ExchangePublic { struct TickerFunc { using Last24hTradedVolumeAndLatestPricePair = std::pair; -#ifndef CCT_AGGR_INIT_CXX20 - TickerFunc(CachedResult& tradableCurrenciesCache, CurlHandle& curlHandle) - : _tradableCurrenciesCache(tradableCurrenciesCache), _curlHandle(curlHandle) {} -#endif - Last24hTradedVolumeAndLatestPricePair operator()(Market mk); CachedResult& _tradableCurrenciesCache; diff --git a/src/api/exchanges/include/kucoinprivateapi.hpp b/src/api/exchanges/include/kucoinprivateapi.hpp index 493f9fdf..49fabd15 100644 --- a/src/api/exchanges/include/kucoinprivateapi.hpp +++ b/src/api/exchanges/include/kucoinprivateapi.hpp @@ -52,11 +52,6 @@ class KucoinPrivate : public ExchangePrivate { private: struct DepositWalletFunc { -#ifndef CCT_AGGR_INIT_CXX20 - DepositWalletFunc(CurlHandle& curlHandle, const APIKey& apiKey, const KucoinPublic& kucoinPublic) - : _curlHandle(curlHandle), _apiKey(apiKey), _kucoinPublic(kucoinPublic) {} -#endif - Wallet operator()(CurrencyCode currencyCode); CurlHandle& _curlHandle; diff --git a/src/api/exchanges/include/kucoinpublicapi.hpp b/src/api/exchanges/include/kucoinpublicapi.hpp index 4cc16aab..d47db1ce 100644 --- a/src/api/exchanges/include/kucoinpublicapi.hpp +++ b/src/api/exchanges/include/kucoinpublicapi.hpp @@ -72,19 +72,7 @@ class KucoinPublic : public ExchangePublic { friend class KucoinPrivate; struct TradableCurrenciesFunc { -#ifndef CCT_AGGR_INIT_CXX20 - TradableCurrenciesFunc(CurlHandle& curlHandle, const CoincenterInfo& coincenterInfo, CommonAPI& commonApi) - : _curlHandle(curlHandle), _coincenterInfo(coincenterInfo), _commonApi(commonApi) {} -#endif - struct CurrencyInfo { -#ifndef CCT_AGGR_INIT_CXX20 - explicit CurrencyInfo(CurrencyCode c) : currencyExchange(c) {} - - CurrencyInfo(CurrencyExchange&& c, MonetaryAmount wMS, MonetaryAmount wMF) - : currencyExchange(std::move(c)), withdrawalMinSize(wMS), withdrawalMinFee(wMF) {} -#endif - auto operator<=>(const CurrencyInfo& o) const { return currencyExchange <=> o.currencyExchange; } CurrencyExchange currencyExchange; @@ -102,11 +90,6 @@ class KucoinPublic : public ExchangePublic { }; struct MarketsFunc { -#ifndef CCT_AGGR_INIT_CXX20 - MarketsFunc(CurlHandle& curlHandle, const ExchangeInfo& exchangeInfo) - : _curlHandle(curlHandle), _exchangeInfo(exchangeInfo) {} -#endif - struct MarketInfo { MonetaryAmount baseMinSize; MonetaryAmount quoteMinSize; // quote is synonym of price @@ -127,11 +110,6 @@ class KucoinPublic : public ExchangePublic { }; struct AllOrderBooksFunc { -#ifndef CCT_AGGR_INIT_CXX20 - AllOrderBooksFunc(CachedResult& marketsCache, CurlHandle& curlHandle, const ExchangeInfo& exchangeInfo) - : _marketsCache(marketsCache), _curlHandle(curlHandle), _exchangeInfo(exchangeInfo) {} -#endif - MarketOrderBookMap operator()(int depth); CachedResult& _marketsCache; @@ -140,11 +118,6 @@ class KucoinPublic : public ExchangePublic { }; struct OrderBookFunc { -#ifndef CCT_AGGR_INIT_CXX20 - OrderBookFunc(CurlHandle& curlHandle, const ExchangeInfo& exchangeInfo) - : _curlHandle(curlHandle), _exchangeInfo(exchangeInfo) {} -#endif - MarketOrderBook operator()(Market mk, int depth); CurlHandle& _curlHandle; @@ -152,20 +125,12 @@ class KucoinPublic : public ExchangePublic { }; struct TradedVolumeFunc { -#ifndef CCT_AGGR_INIT_CXX20 - explicit TradedVolumeFunc(CurlHandle& curlHandle) : _curlHandle(curlHandle) {} -#endif - MonetaryAmount operator()(Market mk); CurlHandle& _curlHandle; }; struct TickerFunc { -#ifndef CCT_AGGR_INIT_CXX20 - explicit TickerFunc(CurlHandle& curlHandle) : _curlHandle(curlHandle) {} -#endif - MonetaryAmount operator()(Market mk); CurlHandle& _curlHandle; diff --git a/src/api/exchanges/include/upbitprivateapi.hpp b/src/api/exchanges/include/upbitprivateapi.hpp index ae825406..a0caa43d 100644 --- a/src/api/exchanges/include/upbitprivateapi.hpp +++ b/src/api/exchanges/include/upbitprivateapi.hpp @@ -57,12 +57,6 @@ class UpbitPrivate : public ExchangePrivate { private: struct TradableCurrenciesFunc { -#ifndef CCT_AGGR_INIT_CXX20 - TradableCurrenciesFunc(CurlHandle& curlHandle, const APIKey& apiKey, const ExchangeInfo& exchangeInfo, - CommonAPI& commonApi) - : _curlHandle(curlHandle), _apiKey(apiKey), _exchangeInfo(exchangeInfo), _commonApi(commonApi) {} -#endif - CurrencyExchangeFlatSet operator()(); CurlHandle& _curlHandle; @@ -72,11 +66,6 @@ class UpbitPrivate : public ExchangePrivate { }; struct DepositWalletFunc { -#ifndef CCT_AGGR_INIT_CXX20 - DepositWalletFunc(CurlHandle& curlHandle, const APIKey& apiKey, UpbitPublic& exchangePublic) - : _curlHandle(curlHandle), _apiKey(apiKey), _exchangePublic(exchangePublic) {} -#endif - Wallet operator()(CurrencyCode currencyCode); CurlHandle& _curlHandle; @@ -85,11 +74,6 @@ class UpbitPrivate : public ExchangePrivate { }; struct WithdrawFeesFunc { -#ifndef CCT_AGGR_INIT_CXX20 - WithdrawFeesFunc(CurlHandle& curlHandle, const APIKey& apiKey, UpbitPublic& exchangePublic) - : _curlHandle(curlHandle), _apiKey(apiKey), _exchangePublic(exchangePublic) {} -#endif - MonetaryAmount operator()(CurrencyCode currencyCode); CurlHandle& _curlHandle; diff --git a/src/api/exchanges/include/upbitpublicapi.hpp b/src/api/exchanges/include/upbitpublicapi.hpp index 9157bf6c..c875dcd4 100644 --- a/src/api/exchanges/include/upbitpublicapi.hpp +++ b/src/api/exchanges/include/upbitpublicapi.hpp @@ -65,11 +65,6 @@ class UpbitPublic : public ExchangePublic { static MonetaryAmount SanitizeVolume(MonetaryAmount vol, MonetaryAmount pri); struct MarketsFunc { -#ifndef CCT_AGGR_INIT_CXX20 - MarketsFunc(CurlHandle& curlHandle, const ExchangeInfo& exchangeInfo) - : _curlHandle(curlHandle), _exchangeInfo(exchangeInfo) {} -#endif - MarketSet operator()(); CurlHandle& _curlHandle; @@ -77,11 +72,6 @@ class UpbitPublic : public ExchangePublic { }; struct TradableCurrenciesFunc { -#ifndef CCT_AGGR_INIT_CXX20 - TradableCurrenciesFunc(CurlHandle& curlHandle, CachedResult& marketsCache) - : _curlHandle(curlHandle), _marketsCache(marketsCache) {} -#endif - CurrencyExchangeFlatSet operator()(); CurlHandle& _curlHandle; @@ -89,10 +79,6 @@ class UpbitPublic : public ExchangePublic { }; struct WithdrawalFeesFunc { -#ifndef CCT_AGGR_INIT_CXX20 - WithdrawalFeesFunc(const string& name, std::string_view dataDir) : _name(name), _dataDir(dataDir) {} -#endif - WithdrawalFeeMap operator()(); const string& _name; @@ -100,11 +86,6 @@ class UpbitPublic : public ExchangePublic { }; struct AllOrderBooksFunc { -#ifndef CCT_AGGR_INIT_CXX20 - AllOrderBooksFunc(CurlHandle& curlHandle, const ExchangeInfo& exchangeInfo, CachedResult& marketsCache) - : _curlHandle(curlHandle), _exchangeInfo(exchangeInfo), _marketsCache(marketsCache) {} -#endif - MarketOrderBookMap operator()(int depth); CurlHandle& _curlHandle; @@ -113,11 +94,6 @@ class UpbitPublic : public ExchangePublic { }; struct OrderBookFunc { -#ifndef CCT_AGGR_INIT_CXX20 - OrderBookFunc(CurlHandle& curlHandle, const ExchangeInfo& exchangeInfo) - : _curlHandle(curlHandle), _exchangeInfo(exchangeInfo) {} -#endif - MarketOrderBook operator()(Market mk, int depth); CurlHandle& _curlHandle; @@ -125,20 +101,12 @@ class UpbitPublic : public ExchangePublic { }; struct TradedVolumeFunc { -#ifndef CCT_AGGR_INIT_CXX20 - explicit TradedVolumeFunc(CurlHandle& curlHandle) : _curlHandle(curlHandle) {} -#endif - MonetaryAmount operator()(Market mk); CurlHandle& _curlHandle; }; struct TickerFunc { -#ifndef CCT_AGGR_INIT_CXX20 - explicit TickerFunc(CurlHandle& curlHandle) : _curlHandle(curlHandle) {} -#endif - MonetaryAmount operator()(Market mk); CurlHandle& _curlHandle; diff --git a/src/engine/include/coincenteroptions.hpp b/src/engine/include/coincenteroptions.hpp index 118bd8d9..34cf2d84 100644 --- a/src/engine/include/coincenteroptions.hpp +++ b/src/engine/include/coincenteroptions.hpp @@ -219,8 +219,7 @@ struct CoincenterCmdLineOptions { template struct CoincenterAllowedOptions { - // TODO: Once clang implements P0634R3, remove 'typename' here - using CommandLineOptionWithValue = typename AllowedCommandLineOptionsBase::CommandLineOptionWithValue; + using CommandLineOptionWithValue = AllowedCommandLineOptionsBase::CommandLineOptionWithValue; static constexpr CommandLineOptionWithValue value[] = { {{{"General", 1}, "--help", 'h', "", "Display this information"}, &OptValueType::help}, diff --git a/src/engine/include/commandlineoptionsparser.hpp b/src/engine/include/commandlineoptionsparser.hpp index a0c740d7..ddc12569 100644 --- a/src/engine/include/commandlineoptionsparser.hpp +++ b/src/engine/include/commandlineoptionsparser.hpp @@ -37,9 +37,8 @@ overloaded(Ts...) -> overloaded; template class CommandLineOptionsParser : private OptValueType { public: - // TODO: Once clang implements P0634R3, remove 'typename' here - using CommandLineOptionType = typename AllowedCommandLineOptionsBase::CommandLineOptionType; - using CommandLineOptionWithValue = typename AllowedCommandLineOptionsBase::CommandLineOptionWithValue; + using CommandLineOptionType = AllowedCommandLineOptionsBase::CommandLineOptionType; + using CommandLineOptionWithValue = AllowedCommandLineOptionsBase::CommandLineOptionWithValue; template explicit CommandLineOptionsParser(const CommandLineOptionWithValue (&init)[N]) diff --git a/src/objects/include/exchangeinfoparser.hpp b/src/objects/include/exchangeinfoparser.hpp index 6bfd4f63..71ee1033 100644 --- a/src/objects/include/exchangeinfoparser.hpp +++ b/src/objects/include/exchangeinfoparser.hpp @@ -77,10 +77,6 @@ class TopLevelOption { using JsonIt = json::const_iterator; struct DataSource { -#ifndef CCT_AGGR_INIT_CXX20 - DataSource(JsonIt it, bool isPersonal, bool isExchange) : it(it), isPersonal(isPersonal), isExchange(isExchange) {} -#endif - JsonIt exchangeIt(std::string_view exchangeName) const { JsonIt exchangeIt = it->find(exchangeName); return exchangeIt == it->end() ? it : exchangeIt; diff --git a/src/objects/include/marketorderbook.hpp b/src/objects/include/marketorderbook.hpp index 5e38dc2b..45a4fdd5 100644 --- a/src/objects/include/marketorderbook.hpp +++ b/src/objects/include/marketorderbook.hpp @@ -39,10 +39,6 @@ class MarketOrderBook { using OrderBookLineSpan = std::span; struct AmountAtPrice { -#ifndef CCT_AGGR_INIT_CXX20 - AmountAtPrice(MonetaryAmount a, MonetaryAmount p) : amount(a), price(p) {} -#endif - MonetaryAmount amount; MonetaryAmount price; }; @@ -154,10 +150,6 @@ class MarketOrderBook { struct AmountPrice { using AmountType = MonetaryAmount::AmountType; -#ifndef CCT_AGGR_INIT_CXX20 - explicit AmountPrice(AmountType a = 0, AmountType p = 0) : amount(a), price(p) {} -#endif - bool operator==(const AmountPrice& o) const = default; AmountType amount = 0; diff --git a/src/objects/include/volumeandpricenbdecimals.hpp b/src/objects/include/volumeandpricenbdecimals.hpp index 6731011d..ad1ebbd5 100644 --- a/src/objects/include/volumeandpricenbdecimals.hpp +++ b/src/objects/include/volumeandpricenbdecimals.hpp @@ -5,12 +5,6 @@ namespace cct { struct VolAndPriNbDecimals { -#ifndef CCT_AGGR_INIT_CXX20 - constexpr VolAndPriNbDecimals() noexcept = default; - - constexpr VolAndPriNbDecimals(int8_t volNbDec, int8_t priNbDec) : volNbDecimals(volNbDec), priNbDecimals(priNbDec) {} -#endif - constexpr bool operator==(const VolAndPriNbDecimals &o) const = default; int8_t volNbDecimals = std::numeric_limits::digits10; diff --git a/src/tech/include/cct_config.hpp b/src/tech/include/cct_config.hpp index 1d66039a..3b3bc93a 100644 --- a/src/tech/include/cct_config.hpp +++ b/src/tech/include/cct_config.hpp @@ -55,12 +55,4 @@ #define CCT_COMPILER_VERSION CCT_COMPILER_NAME " " CCT_STRINGIFY(_MSC_FULL_VER) #else #error "Unknown compiler. Only clang, gcc and MSVC are supported." -#endif - -#ifndef CCT_CLANG -// Clang does not support 'Allow initializing aggregates from a parenthesized list of values' (nor CTAD) yet. -// Although it's a C++20 project, it's nice to support clang so let's keep this switch for now, until clang finally -// implements it. More information here: -// https://stackoverflow.com/questions/70260994/automatic-template-deduction-c20-with-aggregate-type -#define CCT_AGGR_INIT_CXX20 -#endif +#endif \ No newline at end of file diff --git a/src/tech/include/cct_hash.hpp b/src/tech/include/cct_hash.hpp index f824c178..4683f683 100644 --- a/src/tech/include/cct_hash.hpp +++ b/src/tech/include/cct_hash.hpp @@ -43,10 +43,6 @@ class HashTuple { struct Component { const T& value; -#ifndef CCT_AGGR_INIT_CXX20 - explicit Component(const T& v) : value(v) {} -#endif - size_t operator,(size_t n) const { return HashCombine(std::hash()(value), n); } }; }; diff --git a/src/tech/include/flatkeyvaluestring.hpp b/src/tech/include/flatkeyvaluestring.hpp index 5b358d62..c1ea68c4 100644 --- a/src/tech/include/flatkeyvaluestring.hpp +++ b/src/tech/include/flatkeyvaluestring.hpp @@ -25,12 +25,6 @@ namespace cct { struct KeyValuePair { using IntegralType = int64_t; -#ifndef CCT_AGGR_INIT_CXX20 - KeyValuePair(std::string_view k, std::string_view v) : key(k), val(v) {} - - KeyValuePair(std::string_view k, IntegralType v) : key(k), val(v) {} -#endif - std::string_view key; std::variant val; };