[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] Replacing boost with C++ standard library [Was: Replacing boost wi
From: |
Greg Chicares |
Subject: |
[lmi] Replacing boost with C++ standard library [Was: Replacing boost with std C++11] |
Date: |
Sat, 24 Feb 2018 22:32:25 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 2017-04-25 14:27, Greg Chicares wrote:
[...remaining boost dependencies...]
>
> (I) Standard replacements available with C++17:
>
> #include <boost/filesystem/*>
[...]
> Requires gcc-5.3 and '-lstdc++fs':
>
> http://stackoverflow.com/questions/33149878/experimentalfilesystem-linker-error/33159746#33159746
IIRC, the API changed; I haven't tackled this one yet.
> #include <boost/optional.hpp>
> Used by auxiliary rate-table program only. Apparently in gcc-4.9 with
> '-std=c++1y':
>
> http://stackoverflow.com/questions/17013708/implementation-status-of-stdoptional-in-g-libstdc/17013985#17013985
Replaced with std::experimental::optional.
> #include <boost/any.hpp>
> Used by the product editor only, which is really just an auxiliary program
> that
> happens to be built into lmi. Apparently in C++17.
Replaced with std::experimental::any.
> (II) Available in C++11, but gcc's implementation is slow:
>
> #include <boost/regex.hpp>
[...]
> wx_test_about_version.cpp
> where presumably it could be replaced with <regex>
Done.
>, and by one auxiliary program:
> test_coding_rules.cpp
> for performance reasons (because gcc's implementation is slow).
But that's a standalone program, so any special warning flags it
requires don't affect lmi.
> (III) Convenient, but not strictly necessary:
>
> #include <boost/operators.hpp>
> Used by lmi's datum*, mc*, and tn* classes as a convenience; the operators
> could
> instead be written by hand.
Still used in three headers; eliminated in eight others today.
> (IV) Not really needed at all:
[...]
> Used only by unit tests, and only to compare boost to a preferred alternative
> that is actually used in lmi.
>
> Upgrading to C++17 apparently takes care of category (I). We could throw away
> all of (IV) anytime. Category (II) could be dispensed with by writing the
> operators ourselves. That leaves only category (III), where we could either
> retain boost for 'test_coding_rules' only, or just put up with gcc's slowness.
Ignoring 'filesystem' (in namespace 'fs'), and filtering out comments,
the unit tests (category IV), and 'test_coding_rules':
$grep 'boost::' *.?pp |sed -e'/^[^:]*: *\/\//d' -e'/^[^:]*_test.cpp:/d'
-e'/^test_coding/d'
calendar_date.hpp: :boost::additive<calendar_date,int>
calendar_date.hpp: ,boost::totally_ordered<calendar_date>
calendar_date.hpp: ,boost::unit_steppable<calendar_date>
config.hpp:namespace fs = boost::filesystem;
mc_enum.hpp: ,private boost::equality_comparable<mc_enum<T>,mc_enum<T>>
mc_enum.hpp: ,private boost::equality_comparable<mc_enum<T>,T>
mc_enum.hpp: ,private boost::equality_comparable<mc_enum<T>,std::string>
tn_range.hpp: ,private boost::totally_ordered <tn_range<Number,Trammel>>
tn_range.hpp: ,private
boost::equality_comparable<tn_range<Number,Trammel>,Number>
tn_range.hpp: ,private
boost::equality_comparable<tn_range<Number,Trammel>,std::string>
> Anyway, if we upgrade the C++ dialect and write comparison operators
> ourselves,
> we can remove boost utterly from lmi, with all the problems it brings...and
> enable all the warnings it has forced us to turn off.
The only remaining obstacles are 'filesystem' and a few sets of operators.
- [lmi] Replacing boost with C++ standard library [Was: Replacing boost with std C++11],
Greg Chicares <=