From f1cccbe3e0ca5717313bb1cb6226f2cbcad1fbf1 Mon Sep 17 00:00:00 2001 From: sowle Date: Sun, 18 Feb 2024 23:35:56 +0100 Subject: [PATCH] (hopefully) a proper fix for the template hell in get_first_service_attachment_by_id --- .../bc_attachments_helpers_basic.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/currency_core/bc_attachments_helpers_basic.h b/src/currency_core/bc_attachments_helpers_basic.h index d14e543b..74039e9d 100644 --- a/src/currency_core/bc_attachments_helpers_basic.h +++ b/src/currency_core/bc_attachments_helpers_basic.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Zano Project +// Copyright (c) 2014-2024 Zano Project // Copyright (c) 2014-2018 The Louisdor Project // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -25,8 +25,8 @@ namespace bc_services { return t.type(); } - template - static const t_return_type& get(const t_type& t, const t_return_type& dummy) + template + static const t_return_type& get(const t_type& t) { return boost::get(t); } @@ -40,8 +40,8 @@ namespace bc_services { return typeid(t); } - template - static const t_return_type& get(const t_type& t, const t_return_type& dummy) + template + static const t_return_type& get(const t_type& t) { return t; } @@ -52,10 +52,10 @@ namespace bc_services { for (const auto& item : tx_items) { - if (/*item.type()*/ type_selector::value>::get_type(item) == typeid(currency::tx_service_attachment)) + typedef type_selector::value> TS; + if (TS::get_type(item) == typeid(currency::tx_service_attachment)) { - const currency::tx_service_attachment& tsa = type_selector::value>::get(item, currency::tx_service_attachment()); - //const currency::tx_service_attachment& tsa = boost::get(item); + const currency::tx_service_attachment& tsa = TS::template get(item); if (tsa.service_id == id && tsa.instruction == instruction) { res = tsa; @@ -65,4 +65,5 @@ namespace bc_services } return false; } -} \ No newline at end of file + +}