From a2d1a974e66454aee161f018d623dc20e200ffa3 Mon Sep 17 00:00:00 2001 From: motxx Date: Sun, 5 Nov 2017 15:25:47 +0900 Subject: [PATCH] Fix review issues Signed-off-by: motxx --- .../interfaces/common_objects/account.hpp | 15 +- .../common_objects/account_asset.hpp | 6 +- .../interfaces/common_objects/amount.hpp | 13 +- .../interfaces/common_objects/asset.hpp | 4 +- .../interfaces/common_objects/signature.hpp | 4 +- .../abstract_error_response.hpp | 64 ++++++++ .../account_asset_response.hpp | 2 + .../query_responses/account_response.hpp | 11 +- .../query_responses/asset_response.hpp | 3 + .../query_responses/error_response.hpp | 146 ------------------ .../query_responses/query_response.hpp | 19 +-- .../query_responses/role_permissions.hpp | 1 - .../query_responses/roles_response.hpp | 1 - .../query_responses/signatories_response.hpp | 5 +- .../stateless_failed_error_response.hpp | 49 ++++++ .../query_responses/transactions_response.hpp | 3 - .../interfaces/visitor_apply_for_all.hpp | 49 +----- 17 files changed, 154 insertions(+), 241 deletions(-) create mode 100644 shared_model/interfaces/query_responses/abstract_error_response.hpp delete mode 100644 shared_model/interfaces/query_responses/error_response.hpp create mode 100644 shared_model/interfaces/query_responses/stateless_failed_error_response.hpp diff --git a/shared_model/interfaces/common_objects/account.hpp b/shared_model/interfaces/common_objects/account.hpp index 53eecbbb16..fb9614de18 100644 --- a/shared_model/interfaces/common_objects/account.hpp +++ b/shared_model/interfaces/common_objects/account.hpp @@ -19,13 +19,14 @@ #define IROHA_SHARED_MODEL_ACCOUNT_HPP #include "interfaces/common_objects/types.hpp" -#include "interfaces/primitive.hpp" +#include "interfaces/hashable.hpp" +#include "cryptography/hash.hpp" #include "model/account.hpp" #include "utils/string_builder.hpp" namespace shared_model { namespace interface { - class Account : public Primitive { + class Account : public Hashable { public: /** * @return Identity of user, for fetching data @@ -55,16 +56,6 @@ namespace shared_model { .finalize(); } - /** - * Checks equality of objects inside - * @param rhs - other wrapped value - * @return true, if wrapped objects are same - */ - bool operator==(const ModelType &rhs) const override { - return accountId() == rhs.accountId() and domainId() == rhs.domainId() - and quorum() == rhs.quorum(); - } - /** * Makes old model. * @return An allocated old model of account asset response. diff --git a/shared_model/interfaces/common_objects/account_asset.hpp b/shared_model/interfaces/common_objects/account_asset.hpp index 209cbebfc4..f627bb47bb 100644 --- a/shared_model/interfaces/common_objects/account_asset.hpp +++ b/shared_model/interfaces/common_objects/account_asset.hpp @@ -21,14 +21,14 @@ #include #include "interfaces/common_objects/amount.hpp" #include "interfaces/common_objects/types.hpp" -#include "interfaces/primitive.hpp" +#include "interfaces/hashable.hpp" #include "model/account_asset.hpp" #include "utils/string_builder.hpp" namespace shared_model { namespace interface { class AccountAsset - : public Primitive { + : public Hashable { public: /** * @return Identity of user, for fetching data @@ -77,6 +77,8 @@ namespace shared_model { oldModel->account_id = accountId(); oldModel->asset_id = assetId(); using OldBalanceType = decltype(oldModel->balance); + /// Use shared_ptr and placement-new to copy new model field to oldModel's field and + /// to return raw pointer auto p = std::shared_ptr(balance().makeOldModel()); new (&oldModel->balance) OldBalanceType(*p); return oldModel; diff --git a/shared_model/interfaces/common_objects/amount.hpp b/shared_model/interfaces/common_objects/amount.hpp index b9222eda16..243bd64040 100644 --- a/shared_model/interfaces/common_objects/amount.hpp +++ b/shared_model/interfaces/common_objects/amount.hpp @@ -25,12 +25,12 @@ #include "interfaces/common_objects/amount.hpp" #include "interfaces/common_objects/types.hpp" #include "interfaces/polymorphic_wrapper.hpp" -#include "interfaces/primitive.hpp" +#include "interfaces/hashable.hpp" #include "utils/string_builder.hpp" namespace shared_model { namespace interface { - class Amount : public Primitive { + class Amount : public Hashable { public: /** * Converts to uint64_t vector @@ -67,10 +67,6 @@ namespace shared_model { virtual detail::PolymorphicWrapper percentage( const Amount &percents) const = 0; - /** - * Comparisons are possible between amounts with different precisions. - */ - /** * Checks equality of objects inside * @param rhs - other wrapped value @@ -80,11 +76,6 @@ namespace shared_model { return intValue() == rhs.intValue() and precision() == rhs.precision(); } - virtual bool operator<(const Amount &) const = 0; - virtual bool operator>(const Amount &) const = 0; - virtual bool operator<=(const Amount &) const = 0; - virtual bool operator>=(const Amount &) const = 0; - /** * Stringify the data. * @return the content of asset. diff --git a/shared_model/interfaces/common_objects/asset.hpp b/shared_model/interfaces/common_objects/asset.hpp index b08692f2f4..b344d82db2 100644 --- a/shared_model/interfaces/common_objects/asset.hpp +++ b/shared_model/interfaces/common_objects/asset.hpp @@ -19,13 +19,13 @@ #define IROHA_SHARED_MODEL_ASSET_HPP #include "interfaces/common_objects/types.hpp" -#include "interfaces/primitive.hpp" +#include "interfaces/hashable.hpp" #include "model/asset.hpp" #include "utils/string_builder.hpp" namespace shared_model { namespace interface { - class Asset : public Primitive { + class Asset : public Hashable { public: /** * @return Identity of asset diff --git a/shared_model/interfaces/common_objects/signature.hpp b/shared_model/interfaces/common_objects/signature.hpp index ca9de4da20..3ad7328aac 100644 --- a/shared_model/interfaces/common_objects/signature.hpp +++ b/shared_model/interfaces/common_objects/signature.hpp @@ -21,7 +21,7 @@ #include "cryptography/blob.hpp" #include "cryptography/public_key.hpp" #include "cryptography/signed.hpp" -#include "interfaces/primitive.hpp" +#include "interfaces/hashable.hpp" #include "model/signature.hpp" #include "utils/string_builder.hpp" @@ -31,7 +31,7 @@ namespace shared_model { /** * Class represents signature of high-level domain objects. */ - class Signature : public Primitive { + class Signature : public Hashable { public: /** * Type of public key diff --git a/shared_model/interfaces/query_responses/abstract_error_response.hpp b/shared_model/interfaces/query_responses/abstract_error_response.hpp new file mode 100644 index 0000000000..7630109671 --- /dev/null +++ b/shared_model/interfaces/query_responses/abstract_error_response.hpp @@ -0,0 +1,64 @@ + +/** + * Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved. + * http://soramitsu.co.jp + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef IROHA_ABSTRACT_ERROR_RESPONSE_HPP +#define IROHA_ABSTRACT_ERROR_RESPONSE_HPP + +#include "interfaces/primitive.hpp" +#include "model/queries/responses/error_response.hpp" +#include "utils/string_builder.hpp" + +namespace shared_model { + namespace interface { + /** + * Abstract error response + * @tparam Model - concrete model error response + */ + template + class AbstractErrorResponse + : public Primitive { + private: + /** + * @return string representation of error reason + */ + virtual std::string reason() const = 0; + + /** + * @return old model error reason + */ + virtual iroha::model::ErrorResponse::Reason oldModelReason() const = 0; + + public: + // ------------------------| Primitive override |------------------------- + + std::string toString() const override { + return detail::PrettyStringBuilder().init(reason()).finalize(); + } + + iroha::model::ErrorResponse *makeOldModel() const override { + auto error_reponse = new iroha::model::ErrorResponse(); + error_reponse->reason = oldModelReason(); + return error_reponse; + } + + bool operator==(const Model &rhs) const override { return true; } + }; + } // namespace interface +} // namespace shared_model + +#endif // IROHA_ABSTRACT_ERROR_RESPONSE_HPP diff --git a/shared_model/interfaces/query_responses/account_asset_response.hpp b/shared_model/interfaces/query_responses/account_asset_response.hpp index fefe05f97c..ff92ff7b70 100644 --- a/shared_model/interfaces/query_responses/account_asset_response.hpp +++ b/shared_model/interfaces/query_responses/account_asset_response.hpp @@ -67,6 +67,8 @@ namespace shared_model { OldModelType *makeOldModel() const override { OldModelType *oldModel = new OldModelType(); using OldAccountAssetType = decltype(oldModel->acct_asset); + /// Use shared_ptr and placement-new to copy new model field to oldModel's field and + /// to return raw pointer auto p = std::shared_ptr(accountAsset().makeOldModel()); new (&oldModel->acct_asset) OldAccountAssetType(*p); diff --git a/shared_model/interfaces/query_responses/account_response.hpp b/shared_model/interfaces/query_responses/account_response.hpp index e7f23c1b3c..2856c93834 100644 --- a/shared_model/interfaces/query_responses/account_response.hpp +++ b/shared_model/interfaces/query_responses/account_response.hpp @@ -39,6 +39,11 @@ namespace shared_model { */ virtual const Account &account() const = 0; + /** + * @return roles attached to the account + */ + virtual const types::RolesType &roles() const = 0; + /** * Stringify the data. * @return string representation of data. @@ -47,6 +52,8 @@ namespace shared_model { return detail::PrettyStringBuilder() .init("AccountResponse") .append(account().toString()) + .append("roles") + .appendAll(roles(), [](auto s) { return s; }) .finalize(); } @@ -56,7 +63,7 @@ namespace shared_model { * @return true if they have same values. */ bool operator==(const ModelType &rhs) const override { - return account() == rhs.account(); + return account() == rhs.account() and roles() == rhs.roles(); } /** @@ -66,6 +73,8 @@ namespace shared_model { OldModelType *makeOldModel() const override { OldModelType *oldModel = new OldModelType(); using OldAccountType = decltype(oldModel->account); + /// Use shared_ptr and placement-new to copy new model field to oldModel's field and + /// to return raw pointer auto p = std::shared_ptr(account().makeOldModel()); new (&oldModel->account) OldAccountType(*p); return oldModel; diff --git a/shared_model/interfaces/query_responses/asset_response.hpp b/shared_model/interfaces/query_responses/asset_response.hpp index 1709d2e1b9..153434ad1e 100644 --- a/shared_model/interfaces/query_responses/asset_response.hpp +++ b/shared_model/interfaces/query_responses/asset_response.hpp @@ -18,6 +18,7 @@ #ifndef IROHA_SHARED_MODEL_ASSET_RESPONSE_HPP #define IROHA_SHARED_MODEL_ASSET_RESPONSE_HPP +#include #include "interfaces/common_objects/asset.hpp" #include "interfaces/common_objects/types.hpp" #include "interfaces/primitive.hpp" @@ -63,6 +64,8 @@ namespace shared_model { OldModelType *makeOldModel() const override { OldModelType *oldModel = new OldModelType(); using OldAssetType = decltype(oldModel->asset); + /// Use shared_ptr and placement-new to copy new model field to oldModel's field and + /// to return raw pointer auto p = std::shared_ptr(asset().makeOldModel()); new (&oldModel->asset) OldAssetType(*p); return oldModel; diff --git a/shared_model/interfaces/query_responses/error_response.hpp b/shared_model/interfaces/query_responses/error_response.hpp deleted file mode 100644 index 5569b65732..0000000000 --- a/shared_model/interfaces/query_responses/error_response.hpp +++ /dev/null @@ -1,146 +0,0 @@ -/** - * Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved. - * http://soramitsu.co.jp - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef IROHA_SHARED_MODEL_ERROR_RESPONSE_HPP -#define IROHA_SHARED_MODEL_ERROR_RESPONSE_HPP - -#include -#include "crypto/hash.hpp" -#include "interfaces/common_objects/types.hpp" -#include "interfaces/primitive.hpp" -#include "interfaces/visitor_apply_for_all.hpp" -#include "model/queries/responses/error_response.hpp" -#include "utils/string_builder.hpp" - -namespace shared_model { - namespace interface { - /** - * Provide error answer with reason about error - */ - class ErrorResponse - : public Primitive { - public: - /** - * Reason of error - */ - struct StatelessInvalid final { - std::string toString() const { return "STATELESS_INVALID"; } - [[deprecated]] OldModelType::Reason makeOldModel() const { - return OldModelType::Reason::STATELESS_INVALID; - } - constexpr bool operator==(StatelessInvalid const&) const { return true; } - }; - struct StatefulInvalid final { - std::string toString() const { return "STATEFUL_INVALID"; } - [[deprecated]] OldModelType::Reason makeOldModel() const { - return OldModelType::Reason::STATEFUL_INVALID; - } - constexpr bool operator==(StatefulInvalid const&) const { return true; } - }; - struct NoAccount final { - std::string toString() const { return "NO_ACCOUNT"; } - [[deprecated]] OldModelType::Reason makeOldModel() const { - return OldModelType::Reason::NO_ACCOUNT; - } - constexpr bool operator==(NoAccount const&) const { return true; } - }; - struct NoAsset final { - std::string toString() const { return "NO_ASSET"; } - [[deprecated]] OldModelType::Reason makeOldModel() const { - return OldModelType::Reason::NO_ASSET; - } - constexpr bool operator==(NoAsset const&) const { return true; } - }; - struct NoRoles final { - std::string toString() const { return "NO_ROLES"; } - [[deprecated]] OldModelType::Reason makeOldModel() const { - return OldModelType::Reason::NO_ROLES; - } - constexpr bool operator==(NoRoles const&) const { return true; } - }; - struct NoAccountAssets final { - using T = NoAccountAssets; - std::string toString() const { return "NO_ACCOUNT_ASSETS"; } - [[deprecated]] OldModelType::Reason makeOldModel() const { - return OldModelType::Reason::NO_ACCOUNT_ASSETS; - } - constexpr bool operator==(NoAccountAssets const&) const { return true; } - }; - struct NoSignatories final { - std::string toString() const { return "NO_SIGNATORIES"; } - [[deprecated]] OldModelType::Reason makeOldModel() const { - return OldModelType::Reason::NO_SIGNATORIES; - } - constexpr bool operator==(NoSignatories const&) const { return true; } - }; - struct NotSupported final { - std::string toString() const { return "NOT_SUPPORTED"; } - [[deprecated]] OldModelType::Reason makeOldModel() const { - return OldModelType::Reason::NOT_SUPPORTED; - } - constexpr bool operator==(NotSupported const&) const { return true; } - }; - - using Reason = boost::variant; - /** - * Error reason for failing in fetching data. - * @return Error reason - */ - virtual Reason &reason() const = 0; - - /** - * Stringify the data. - * @return the content of error response. - */ - std::string toString() const override { - return detail::PrettyStringBuilder() - .init("ErrorResponse") - .append("reason", - boost::apply_visitor(detail::ToStringVisitor(), reason())) - .finalize(); - } - - /** - * Implementation of operator == - * @param rhs - the right hand-side of ErrorResponse object - * @return true if they have same values. - */ - bool operator==(const ModelType &rhs) const override { - return reason() == rhs.reason(); - } - - /** - * Makes old model. - * @return An allocated old model of error response. - */ - OldModelType *makeOldModel() const override { - OldModelType *oldModel = new OldModelType(); - oldModel->reason = boost::apply_visitor( - detail::OldModelCreatorVisitor(), reason()); - return oldModel; - } - }; - } // namespace interface -} // namespace shared_model -#endif // IROHA_SHARED_MODEL_ERROR_RESPONSE_HPP diff --git a/shared_model/interfaces/query_responses/query_response.hpp b/shared_model/interfaces/query_responses/query_response.hpp index ed65265e93..105da8566a 100644 --- a/shared_model/interfaces/query_responses/query_response.hpp +++ b/shared_model/interfaces/query_responses/query_response.hpp @@ -24,10 +24,10 @@ #include "interfaces/query_responses/account_asset_response.hpp" #include "interfaces/query_responses/account_response.hpp" #include "interfaces/query_responses/asset_response.hpp" -#include "interfaces/query_responses/error_response.hpp" #include "interfaces/query_responses/role_permissions.hpp" #include "interfaces/query_responses/roles_response.hpp" #include "interfaces/query_responses/signatories_response.hpp" +#include "interfaces/query_responses/stateless_failed_error_response.hpp" #include "interfaces/query_responses/transactions_response.hpp" #include "model/query_response.hpp" @@ -47,14 +47,15 @@ namespace shared_model { public: /// Type of container with all concrete query response - using QueryResponseVariantType = boost::variant, - w, - w, - w, - w, - w, - w, - w>; + using QueryResponseVariantType = + boost::variant, + w, + w, + w, + w, + w, + w, + w>; /// Type of all available query responses using QueryResponseListType = QueryResponseVariantType::types; diff --git a/shared_model/interfaces/query_responses/role_permissions.hpp b/shared_model/interfaces/query_responses/role_permissions.hpp index 975a3ffaca..eaf34e374d 100644 --- a/shared_model/interfaces/query_responses/role_permissions.hpp +++ b/shared_model/interfaces/query_responses/role_permissions.hpp @@ -45,7 +45,6 @@ namespace shared_model { std::string toString() const override { return detail::PrettyStringBuilder() .init("RolePermissionsResponse") - .append("rolePermissions") .appendAll(rolePermissions(), [](auto perm) { return perm; }) .finalize(); } diff --git a/shared_model/interfaces/query_responses/roles_response.hpp b/shared_model/interfaces/query_responses/roles_response.hpp index c92b0d6797..2c4d47006e 100644 --- a/shared_model/interfaces/query_responses/roles_response.hpp +++ b/shared_model/interfaces/query_responses/roles_response.hpp @@ -43,7 +43,6 @@ namespace shared_model { std::string toString() const override { return detail::PrettyStringBuilder() .init("RolesResponse") - .append("roles") .appendAll(roles(), [](auto s) { return s; }) .finalize(); } diff --git a/shared_model/interfaces/query_responses/signatories_response.hpp b/shared_model/interfaces/query_responses/signatories_response.hpp index 30f9edf8d9..ab37ad4946 100644 --- a/shared_model/interfaces/query_responses/signatories_response.hpp +++ b/shared_model/interfaces/query_responses/signatories_response.hpp @@ -18,8 +18,6 @@ #ifndef IROHA_SHARED_MODEL_SIGNATORIES_RESPONSE_HPP #define IROHA_SHARED_MODEL_SIGNATORIES_RESPONSE_HPP -#include -#include "crypto/hash.hpp" #include "interfaces/common_objects/types.hpp" #include "interfaces/primitive.hpp" #include "interfaces/visitor_apply_for_all.hpp" @@ -47,7 +45,6 @@ namespace shared_model { std::string toString() const override { return detail::PrettyStringBuilder() .init("SignatoriesResponse") - .append("signatories") .appendAll(keys(), [](auto &key) { return key->toString(); }) .finalize(); } @@ -67,7 +64,7 @@ namespace shared_model { OldModelType *oldModel = new OldModelType(); const auto vs = keys(); std::for_each(vs.begin(), vs.end(), [&oldModel](const auto &key) { - oldModel->keys.push_back( + oldModel->keys.emplace_back( key->template makeOldModel()); }); return oldModel; diff --git a/shared_model/interfaces/query_responses/stateless_failed_error_response.hpp b/shared_model/interfaces/query_responses/stateless_failed_error_response.hpp new file mode 100644 index 0000000000..31900c1b0c --- /dev/null +++ b/shared_model/interfaces/query_responses/stateless_failed_error_response.hpp @@ -0,0 +1,49 @@ +/** + * Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved. + * http://soramitsu.co.jp + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef IROHA_SHARED_MODEL_STATELESS_FAILED_ERROR_RESPONSE_HPP +#define IROHA_SHARED_MODEL_STATELESS_FAILED_ERROR_RESPONSE_HPP + +#include "interfaces/common_objects/types.hpp" +#include "interfaces/query_responses/abstract_error_response.hpp" +#include "utils/string_builder.hpp" + +namespace shared_model { + namespace interface { + /** + * Error response of broken query's stateless validation + */ + class StatelessFailedErrorResponse + : public AbstractErrorResponse { + private: + /** + * @return stateless failed error as error reason + */ + std::string reason() const override { + return "StatelessFailedErrorResponse"; + } + + /** + * @return Old model error reason. + */ + iroha::model::ErrorResponse::Reason oldModelReason() const override { + return iroha::model::ErrorResponse::Reason::STATELESS_INVALID; + } + }; + } // namespace interface +} // namespace shared_model +#endif // IROHA_SHARED_MODEL_STATELESS_FAILED_ERROR_RESPONSE_HPP diff --git a/shared_model/interfaces/query_responses/transactions_response.hpp b/shared_model/interfaces/query_responses/transactions_response.hpp index 6028d86805..6eec071e87 100644 --- a/shared_model/interfaces/query_responses/transactions_response.hpp +++ b/shared_model/interfaces/query_responses/transactions_response.hpp @@ -18,8 +18,6 @@ #ifndef IROHA_SHARED_MODEL_TRANSACTIONS_RESPONSE_HPP #define IROHA_SHARED_MODEL_TRANSACTIONS_RESPONSE_HPP -#include -#include #include #include "interfaces/common_objects/types.hpp" #include "interfaces/polymorphic_wrapper.hpp" @@ -56,7 +54,6 @@ namespace shared_model { std::string toString() const override { return detail::PrettyStringBuilder() .init("TransactionsResponse") - .append("transactions") .appendAll(transactions(), [](auto &tx) { return tx->toString(); }) .finalize(); } diff --git a/shared_model/interfaces/visitor_apply_for_all.hpp b/shared_model/interfaces/visitor_apply_for_all.hpp index cc9e73ca49..d4af4b17b5 100644 --- a/shared_model/interfaces/visitor_apply_for_all.hpp +++ b/shared_model/interfaces/visitor_apply_for_all.hpp @@ -24,51 +24,15 @@ namespace shared_model { namespace detail { -/** - * Macro for defining concept check of the member function - */ -#define DEF_HAS_FUNC(FUNC_NAME) \ - template \ - struct has_##FUNC_NAME { \ - private: \ - template \ - static auto check(T x) -> decltype(x.FUNC_NAME(), std::true_type{}); \ - static std::false_type check(...); \ - \ - public: \ - static bool const value = \ - decltype(check(std::declval()))::value; \ - }; - - /** - * Concept for checking to have toString() - * @tparam ClassType - target class - */ - DEF_HAS_FUNC(toString) - - /** - * Concept for checking to have makeOldModel() - * @tparam ClassType - target class - */ - DEF_HAS_FUNC(makeOldModel) - /** * Class provides generic toString visitor for objects */ class ToStringVisitor : public boost::static_visitor { public: - template ::value, - std::nullptr_t> = nullptr> + template std::string operator()(InputType &operand) const { return operand->toString(); } - template ::value, - std::nullptr_t> = nullptr> - std::string operator()(InputType &operand) const { - return operand.toString(); - } }; /** @@ -78,19 +42,10 @@ namespace shared_model { template class OldModelCreatorVisitor : public boost::static_visitor { public: - template ::value, - std::nullptr_t> = nullptr> + template T operator()(InputType &operand) const { return operand->makeOldModel(); } - - template ::value, - std::nullptr_t> = nullptr> - T operator()(InputType &operand) const { - return operand.makeOldModel(); - } }; } // namespace detail