From e46bf6ae7f03fb750b1965e35ca66c31674c33f4 Mon Sep 17 00:00:00 2001 From: radj307 Date: Thu, 25 Jan 2024 16:32:16 -0500 Subject: [PATCH] clean up --- calc/calc.cpp | 16 +--------------- libcalc/include/FunctionMap.hpp | 14 ++++++-------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/calc/calc.cpp b/calc/calc.cpp index 0125318..3c6157c 100644 --- a/calc/calc.cpp +++ b/calc/calc.cpp @@ -123,7 +123,7 @@ inline const std::vector, std::function{ "debug", "dbg" }, [](std::ostream& os, print_help const& h) { { + std::make_pair(std::vector{ "debug", "dbg" }, [](std::ostream& os, print_help const& h) { { os << "USAGE:\n" << " " << h.executableName << " -d -- \"\"" << '\n' @@ -155,24 +155,10 @@ inline std::string num_to_oct(calc::Number const&); inline std::string num_to_dec(calc::Number const&); inline std::string num_to_hex(calc::Number const&); -#include - int main(const int argc, char** argv) { using namespace calc; - namespace mp = boost::multiprecision; - using cpp_float = mp::cpp_dec_float_100; - using cpp_int = mp::cpp_int; - - cpp_int i{ 2 }; - cpp_float f{ 0.5 }; - - //mp::hypot(f, f); - //mp::cbrt(i); - mp::cbrt(f); - - try { opt3::ArgManager args{ argc, argv, // capturing argument defs: diff --git a/libcalc/include/FunctionMap.hpp b/libcalc/include/FunctionMap.hpp index 8f9ea95..ae72d26 100644 --- a/libcalc/include/FunctionMap.hpp +++ b/libcalc/include/FunctionMap.hpp @@ -8,9 +8,6 @@ #include //< for concepts #include //< for term::print_table -// boost -#include - // stl #include //< for math functions #include //< for std::uint8_t (for clarity) @@ -40,11 +37,11 @@ namespace calc { /// Exponential and Logarithmic Functions std::make_pair("exp", std::make_tuple(new func(exp), "Compute exponential function")), - //std::make_pair("frexp", std::make_tuple(new func( frexpl ), "Get significand and exponent")), //< uses pointers, must be adapted + //std::make_pair("frexp", std::make_tuple(new func( frexpl ), "Get significand and exponent")), //< uses pointers std::make_pair("ldexp", std::make_tuple(new func(ldexp), "Generate value from significand and exponent")), std::make_pair("log", std::make_tuple(new func(log), "Compute natural logarithm")), std::make_pair("log10", std::make_tuple(new func(log10), "Compute common logarithm")), - //std::make_pair("modf", std::make_tuple(new func( modfl ), "Break into fractional and integral parts")), //< uses pointers, must be adapted + //std::make_pair("modf", std::make_tuple(new func( modfl ), "Break into fractional and integral parts")), //< uses pointers std::make_pair("exp2", std::make_tuple(new func(exp2), "Compute binary exponential function")), std::make_pair("expm1", std::make_tuple(new func(expm1), "Compute exponential minus one")), std::make_pair("ilogb", std::make_tuple(new func(ilogb), "Integer binary logarithm")), @@ -92,6 +89,7 @@ namespace calc { public: ~FunctionMap() { + // delete all of the raw function pointers for (auto& pr : map) { if (auto* ptr = std::get<0>(pr.second)) { delete ptr; @@ -136,9 +134,9 @@ namespace calc { { return os << term::print_table(m.map.begin(), m.map.end(), { { "Function", [](auto&& pr) { return pr.first; } }, - { "Param#", [](auto&& pr) { return std::to_string(std::get<0>(pr.second)->getParamsCount()); }, term::HorizontalAlignment::Center }, - { "Description", [](auto&& pr) { return std::get<1>(pr.second); } }, - }); + { "Param#", [](auto&& pr) { return std::to_string(std::get<0>(pr.second)->getParamsCount()); }, term::HorizontalAlignment::Center }, + { "Description", [](auto&& pr) { return std::get<1>(pr.second); } }, + }); } }; }