// Performs currency conversion calculation
double calc_result(std::string_view currencykey, std::string_view currency_from, std::string_view currency_to,
const double money_amount, const double conversion_rate)
{
using namespace std::chrono_literals;
using namespace std::string_literals;
cache_storage cache{ 1h };
const json sentry = nullptr;
std::string mapkey{ "currency_list"s };
json currency_list = cache.query_list(currencykey, mapkey, sentry);
double result{};
if (currency_list.contains(std::string(currency_from)) && currency_list.contains(std::string(currency_to)))
{
result = money_amount * conversion_rate;
}
return result;
}
-
Describe which system (OS, compiler) you are using.
I'm using Windows 10 Single Language, version 1809 Build 17763.678. VS2017 compiler.
-
Describe which version of the library you are using (release version, develop branch).
Release version 3.7.0.
Describe what you want to achieve.
I want to see if a given key exists in a JSON object.
Describe what you tried.
What I've tried is this:
Describe which system (OS, compiler) you are using.
I'm using Windows 10 Single Language, version 1809 Build 17763.678. VS2017 compiler.
Describe which version of the library you are using (release version, develop branch).
Release version 3.7.0.