diff --git a/src/ripple/protocol/Feature.h b/src/ripple/protocol/Feature.h index 47825a14a..5993379b2 100644 --- a/src/ripple/protocol/Feature.h +++ b/src/ripple/protocol/Feature.h @@ -129,15 +129,12 @@ class FeatureBitset { using base = std::bitset; - void initFromFeatures() - { - } - template void initFromFeatures(uint256 const& f, Fs&&... fs) { set(f); - initFromFeatures(std::forward(fs)...); + if constexpr (sizeof...(fs) > 0) + initFromFeatures(std::forward(fs)...); } public: diff --git a/src/test/app/Path_test.cpp b/src/test/app/Path_test.cpp index 2da35c0a0..6965237fa 100644 --- a/src/test/app/Path_test.cpp +++ b/src/test/app/Path_test.cpp @@ -83,25 +83,14 @@ stpath_append_one (STPath& st, boost::none, book.currency, book.account })); } -inline -void -stpath_append (STPath& st) -{ -} - template void stpath_append (STPath& st, T const& t, Args const&... args) { stpath_append_one(st, t); - stpath_append(st, args...); -} - -inline -void -stpathset_append (STPathSet& st) -{ + if constexpr (sizeof...(args) > 0) + stpath_append(st, args...); } template @@ -110,7 +99,8 @@ stpathset_append(STPathSet& st, STPath const& p, Args const&... args) { st.push_back(p); - stpathset_append(st, args...); + if constexpr (sizeof...(args) > 0) + stpathset_append(st, args...); } } // detail diff --git a/src/test/jtx/Env.h b/src/test/jtx/Env.h index d72f00f54..3c125d106 100644 --- a/src/test/jtx/Env.h +++ b/src/test/jtx/Env.h @@ -548,14 +548,6 @@ private: STAmount const& amount, Account const& account); - // If you get an error here it means - // you're calling fund with no accounts - inline - void - fund (STAmount const&) - { - } - void fund_arg (STAmount const& amount, Account const& account) @@ -605,7 +597,8 @@ public: Arg const& arg, Args const&... args) { fund_arg (amount, arg); - fund (amount, args...); + if constexpr (sizeof...(args) > 0) + fund(amount, args...); } /** Establish trust lines. diff --git a/src/test/jtx/PathSet.h b/src/test/jtx/PathSet.h index cb94ea049..46735d4b0 100644 --- a/src/test/jtx/PathSet.h +++ b/src/test/jtx/PathSet.h @@ -69,9 +69,8 @@ public: Path& push_back (STPathElement const& pe); Json::Value json () const; private: - Path& addHelper (){return *this;} template - Path& addHelper (First&& first, Rest&&... rest); + void addHelper (First&& first, Rest&&... rest); }; inline Path& Path::push_back (STPathElement const& pe) @@ -95,10 +94,11 @@ Path& Path::push_back (jtx::Account const& account) } template -Path& Path::addHelper (First&& first, Rest&&... rest) +void Path::addHelper (First&& first, Rest&&... rest) { push_back (std::forward (first)); - return addHelper (std::forward (rest)...); + if constexpr (sizeof...(rest) > 0) + addHelper(std::forward(rest)...); } inline @@ -130,15 +130,12 @@ public: return v; } private: - PathSet& addHelper () - { - return *this; - } template - PathSet& addHelper (First first, Rest... rest) + void addHelper (First first, Rest... rest) { paths.emplace_back (std::move (first.path)); - return addHelper (std::move (rest)...); + if constexpr (sizeof...(rest) > 0) + addHelper(std::move(rest)...); } }; diff --git a/src/test/jtx/flags.h b/src/test/jtx/flags.h index 388a67fb9..19bca745a 100644 --- a/src/test/jtx/flags.h +++ b/src/test/jtx/flags.h @@ -53,12 +53,6 @@ protected: std::uint32_t mask_; private: - inline - void - set_args() - { - } - void set_args (std::uint32_t flag) { @@ -85,7 +79,9 @@ private: set_args (std::uint32_t flag, Args... args) { - set_args(flag, args...); + set_args(flag); + if constexpr (sizeof...(args)) + set_args(args...); } protected: diff --git a/src/test/jtx/multisign.h b/src/test/jtx/multisign.h index 5d06f8868..0f83e5c21 100644 --- a/src/test/jtx/multisign.h +++ b/src/test/jtx/multisign.h @@ -96,48 +96,14 @@ public: msig (std::vector signers_); template - msig (AccountType&& a0, Accounts&&... aN) - : msig(make_vector( - std::forward(a0), - std::forward(aN)...)) + explicit msig(AccountType&& a0, Accounts&&... aN) + : msig{std::vector{std::forward(a0), + std::forward(aN)...}} { } void operator()(Env&, JTx& jt) const; - -private: - template - static - void - helper (std::vector& v, - AccountType&& account) - { - v.emplace_back(std::forward< - Reg>(account)); - } - - template - static - void - helper (std::vector& v, - AccountType&& a0, Accounts&&... aN) - { - helper(v, std::forward(a0)); - helper(v, std::forward(aN)...); - } - - template - static - std::vector - make_vector(Accounts&&... signers) - { - std::vector v; - v.reserve(sizeof...(signers)); - helper(v, std::forward< - Accounts>(signers)...); - return v; - } }; //------------------------------------------------------------------------------ diff --git a/src/test/jtx/paths.h b/src/test/jtx/paths.h index 9f438d467..6d1b1d540 100644 --- a/src/test/jtx/paths.h +++ b/src/test/jtx/paths.h @@ -91,12 +91,6 @@ private: void append_one(BookSpec const& book); - inline - void - append() - { - } - template void append (T const& t, Args const&... args); @@ -114,7 +108,8 @@ void path::append (T const& t, Args const&... args) { append_one(t); - append(args...); + if constexpr (sizeof...(args) > 0) + append(args...); } } // jtx diff --git a/src/test/jtx/require.h b/src/test/jtx/require.h index 8894b83d4..dbc9f80c0 100644 --- a/src/test/jtx/require.h +++ b/src/test/jtx/require.h @@ -30,12 +30,6 @@ namespace jtx { namespace detail { -inline -void -require_args (requires_t& vec) -{ -} - template inline void @@ -43,7 +37,8 @@ require_args (requires_t& vec, Cond const& cond, Args const&... args) { vec.push_back(cond); - require_args(vec, args...); + if constexpr (sizeof...(args) > 0) + require_args(vec, args...); } } // detail diff --git a/src/test/jtx/ticket.h b/src/test/jtx/ticket.h index d46b7ce55..a34dc4e45 100644 --- a/src/test/jtx/ticket.h +++ b/src/test/jtx/ticket.h @@ -64,13 +64,6 @@ create_arg (boost::optional&, opt = value; } -inline -void -create_args (boost::optional&, - boost::optional&) -{ -} - template void create_args(boost::optional& account_opt, @@ -78,7 +71,8 @@ create_args(boost::optional& account_opt, Arg const& arg, Args const&... args) { create_arg(account_opt, expire_opt, arg); - create_args(account_opt, expire_opt, args...); + if constexpr (sizeof...(args)) + create_args(account_opt, expire_opt, args...); } } // detail @@ -91,7 +85,8 @@ create (Account const& account, { boost::optional target; boost::optional expire; - detail::create_args(target, expire, args...); + if constexpr (sizeof...(args) > 0) + detail::create_args(target, expire, args...); return detail::create( account, target, expire); }