port back to C++11 from C++14

https://github.com/moneroexamples/onion-monero-blockchain-explorer/
issues/144
This commit is contained in:
moneroexamples 2018-09-14 12:58:03 +08:00
parent 029d89b98c
commit 6a1a6c48f8
3 changed files with 9 additions and 5 deletions

View File

@ -6,7 +6,7 @@ set(PROJECT_NAME
project(${PROJECT_NAME}) project(${PROJECT_NAME})
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 11)
if (WIN32) if (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj -O3") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj -O3")

View File

@ -139,10 +139,13 @@ MempoolStatus::read_mempool()
mempool_size_kB += _tx_info.blob_size; mempool_size_kB += _tx_info.blob_size;
local_copy_of_mempool_txs.push_back(mempool_tx {tx_hash, tx}); local_copy_of_mempool_txs.push_back(mempool_tx{});
mempool_tx& last_tx = local_copy_of_mempool_txs.back(); mempool_tx& last_tx = local_copy_of_mempool_txs.back();
last_tx.tx_hash = tx_hash;
last_tx.tx = tx;
// key images of inputs // key images of inputs
vector<txin_to_key> input_key_imgs; vector<txin_to_key> input_key_imgs;

View File

@ -119,13 +119,14 @@ namespace std
* visitor to produce json representations of * visitor to produce json representations of
* values stored in mstch::node * values stored in mstch::node
*/ */
class mstch_node_to_json: public boost::static_visitor<nlohmann::json> { class mstch_node_to_json: public boost::static_visitor<nlohmann::json>
{
public: public:
// enabled for numeric types // enabled for numeric types
template<typename T> template<typename T>
std::enable_if_t<std::is_arithmetic<T>::value, nlohmann::json> typename std::enable_if<std::is_arithmetic<T>::value, nlohmann::json>::type
operator()(T const& value) const { operator()(T const& value) const {
return nlohmann::json {value}; return nlohmann::json {value};
} }
@ -157,7 +158,7 @@ public:
// catch other types that are non-numeric and not listed above // catch other types that are non-numeric and not listed above
template<typename T> template<typename T>
std::enable_if_t<!std::is_arithmetic<T>::value, nlohmann::json> typename std::enable_if<!std::is_arithmetic<T>::value, nlohmann::json>::type
operator()(const T&) const { operator()(const T&) const {
return nlohmann::json {}; return nlohmann::json {};
} }