[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: |
Fri, 20 Jan 2017 18:07:49 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 |
On 2017-01-09 16:18, Greg Chicares wrote:
[...]
> and maybe it's also easy to replace these:
> #include <boost/algorithm/minmax_element.hpp>
> #include <boost/cstdint.hpp>
commit 4d0450d8c294e4d1776a1c77d56f25c67376faf0
replaced minmax_element. The number of unique boost headers included
by lmi has decreased to 18 today, from 37 on 2016-12-31. That isn't
as dramatic as it sounds because 13 of the 19 removed were in a
type_traits hierarchy, but it's progress. (I'm also counting the
removal of <boost/functional.hpp> from my local tree; I'll push that
change soon.)
For the record (I couldn't figure out how to assign these
commands-with-quotes-and-pipelines to env vars, so I made
them into scripts):
/home/greg[0]$cat >cmd0 <<\EOF
#!/bin/sh
grep --no-filename '# *include *<boost' /opt/lmi/src/lmi/saved_2016/*.?pp | sed
-e's/ *\/\/.*$//' -e's/# *include/#include/' |sort | uniq
EOF
/home/greg[0]$cat >cmd1 <<\EOF
#!/bin/sh
grep --no-filename '# *include *<boost' /opt/lmi/src/lmi/*.?pp | sed -e's/
*\/\/.*$//' -e's/# *include/#include/' |sort | uniq
EOF
/home/greg[0]$chmod +x cmd[01]
/home/greg[0]$./cmd0 |wc -l
37
/home/greg[0]$./cmd1 |wc -l
18
/home/greg[0]$diff -U0 <(./cmd0) <(./cmd1) |sed -e'/^@@/d'
--- /proc/self/fd/13 2017-01-20 17:21:37.152309151 +0000
+++ /proc/self/fd/14 2017-01-20 17:21:37.152309151 +0000
-#include <boost/algorithm/minmax_element.hpp>
-#include <boost/cstdint.hpp>
-#include <boost/functional.hpp>
-#include <boost/iterator.hpp>
-#include <boost/preprocessor.hpp>
-#include <boost/static_assert.hpp>
-#include <boost/type_traits.hpp>
-#include <boost/type_traits/is_arithmetic.hpp>
-#include <boost/type_traits/is_base_and_derived.hpp>
-#include <boost/type_traits/is_base_of.hpp>
-#include <boost/type_traits/is_convertible.hpp>
-#include <boost/type_traits/is_enum.hpp>
-#include <boost/type_traits/is_float.hpp>
-#include <boost/type_traits/is_function.hpp>
-#include <boost/type_traits/is_pointer.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/type_traits/is_void.hpp>
-#include <boost/type_traits/remove_pointer.hpp>
-#include <boost/type_traits/remove_reference.hpp>
Of those that remain:
/home/greg[0]$./cmd1
#include <boost/any.hpp>
#include <boost/bind.hpp>
#include <boost/cast.hpp>
#include <boost/config.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>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <boost/utility/enable_if.hpp>
<boost/config.hpp> is included only in 'pchlist.hpp', and I'll remove
it from there--it's still implicitly included by 'filesystem/config.hpp'
which we won't replace for some time. Similarly, I'll remove
<boost/utility.hpp> from 'pchlist.hpp'.
<boost/numeric/ublas/vector.hpp>: used only in a unit test that
compares its speed to valarray etc. If a day comes when the
overhead of this library bothers us, we'll just drop it.
<boost/lexical_cast.hpp>: similarly, used only in unit tests.
<boost/filesystem/*.hpp>: waiting for C++17.
<boost/regex.hpp>: cannot replace with current libstdc++ for
performance reasons previously discussed.
<boost/optional.hpp>: actually used. We can wait for C++17:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3793.html
(We could find a standalone replacement if this were the last remaining
boost library, but it's not: we rely heavily on boost::filesystem.)
<boost/any.hpp>: extensively used by product editor.
<boost/operators.hpp>: Item 10 in this 2002 document:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1361.html
suggests standardizing this, but I find no formal proposal.
That leaves these five candidates for replacement in the near term:
#include <boost/bind.hpp>
#include <boost/cast.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility/enable_if.hpp>
We've already discussed the last three, and I'm (slowly) working on
<boost/cast.hpp>. I haven't given any thought to <boost/bind.hpp>
yet, but this article:
http://stackoverflow.com/questions/10555566/difference-between-c11-stdbind-and-boostbind
seems hopeful.
- Re: [lmi] C++ modernization, (continued)
- [lmi] static_assert and :argdo [Was: Replacing boost with std C++11], Greg Chicares, 2017/01/10
- Re: [lmi] static_assert and :argdo [Was: Replacing boost with std C++11], Vadim Zeitlin, 2017/01/10
- Re: [lmi] static_assert and :argdo [Was: Replacing boost with std C++11], Greg Chicares, 2017/01/11
- Re: [lmi] static_assert and :argdo [Was: Replacing boost with std C++11], Vadim Zeitlin, 2017/01/11
- Re: [lmi] static_assert and :argdo [Was: Replacing boost with std C++11], Greg Chicares, 2017/01/11
- Re: [lmi] Replacing boost with std C++11 [Was: Fix value_cast defect shown by the unit test], Greg Chicares, 2017/01/11
- Re: [lmi] Replacing boost with std C++11 [Was: Fix value_cast defect shown by the unit test], Greg Chicares, 2017/01/11
- Re: [lmi] Replacing boost with std C++11 [Was: Fix value_cast defect shown by the unit test], Vadim Zeitlin, 2017/01/11
- Re: [lmi] Replacing boost with std C++11,
Greg Chicares <=
- Re: [lmi] Replacing boost with std C++11, Vadim Zeitlin, 2017/01/20
- Re: [lmi] Replacing boost with std C++11, Greg Chicares, 2017/01/20
- Re: [lmi] Replacing boost with std C++11, Vadim Zeitlin, 2017/01/20
- Re: [lmi] Replacing boost with std C++11, Greg Chicares, 2017/01/20
- Re: [lmi] Using auto-vectorization (was: Replacing boost with std C++11), Vadim Zeitlin, 2017/01/20
- Re: [lmi] Using auto-vectorization, Greg Chicares, 2017/01/21
- Re: [lmi] Using auto-vectorization, Vadim Zeitlin, 2017/01/23
- Re: [lmi] Using auto-vectorization, Greg Chicares, 2017/01/23
- Re: [lmi] Using auto-vectorization, Vadim Zeitlin, 2017/01/23
- Re: [lmi] Using auto-vectorization, Greg Chicares, 2017/01/23