lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Replacing boost with std C++11


From: Greg Chicares
Subject: Re: [lmi] Replacing boost with std C++11
Date: Tue, 25 Apr 2017 14:27:46 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0

On 2017-01-20 18:07, Greg Chicares wrote:
[...]
> grep --no-filename '# *include *<boost' /opt/lmi/src/lmi/*.?pp | sed -e's/ 
> *\/\/.*$//' -e's/# *include/#include/' |sort | uniq

Today that command returns:

#include <boost/any.hpp>
#include <boost/cast.hpp>
#include <boost/filesystem/convenience.hpp>
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/operators.hpp>
#include <boost/optional.hpp>
#include <boost/regex.hpp>

Categorized:

(I) Standard replacements available with C++17:

  #include <boost/filesystem/convenience.hpp>
  #include <boost/filesystem/exception.hpp>
  #include <boost/filesystem/fstream.hpp>
  #include <boost/filesystem/operations.hpp>
  #include <boost/filesystem/path.hpp>
Requires gcc-5.3 and '-lstdc++fs':
  
http://stackoverflow.com/questions/33149878/experimentalfilesystem-linker-error/33159746#33159746

  #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

  #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.

(II) Available in C++11, but gcc's implementation is slow:

  #include <boost/regex.hpp>
Not used by lmi itself; used only by these test programs:
  regex_test.cpp
  wx_test_about_version.cpp
where presumably it could be replaced with <regex>, and by one auxiliary 
program:
  test_coding_rules.cpp
for performance reasons (because gcc's implementation is slow).

(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.

(IV) Not really needed at all:

  #include <boost/cast.hpp>
  #include <boost/lexical_cast.hpp>
  #include <boost/numeric/ublas/vector.hpp>
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.
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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]