From 6b02f1dcb36194d59dcbc9b39f1bfc271ff04f35 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Sat, 27 Feb 2021 22:11:22 +0300 Subject: [PATCH] Remove boost.algorithm dependency (#561) --- include/boost/math/tools/ulps_plot.hpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/include/boost/math/tools/ulps_plot.hpp b/include/boost/math/tools/ulps_plot.hpp index 3d941f444..51f61a96f 100644 --- a/include/boost/math/tools/ulps_plot.hpp +++ b/include/boost/math/tools/ulps_plot.hpp @@ -17,7 +17,6 @@ #include #include #include -#include // Design of this function comes from: @@ -449,10 +448,22 @@ ulps_plot& ulps_plot::ul return *this; } +namespace detail{ +bool ends_with(std::string const& filename, std::string const& suffix) +{ + if(filename.size() < suffix.size()) + { + return false; + } + + return std::equal(std::begin(suffix), std::end(suffix), std::end(filename) - suffix.size()); +} +} + template void ulps_plot::write(std::string const & filename) const { - if (!boost::algorithm::ends_with(filename, ".svg")) + if(!boost::math::tools::detail::ends_with(filename, ".svg")) { throw std::logic_error("Only svg files are supported at this time."); }