|This article is a stub. You can help the wiki by|
A very useful refactoring, would be to remove more places that use Boost. In Flightgear it’s almost 100% foreach.hpp and case conversion (which we now have simgear::strutils).
In Simgear there are some bigger uses, but I think 90% is covered by C++11 : it’s things like enable_if, tuple and bind. There are some awkward cases (use of multi_index in the Effects code), but if we got the ‘easy stuff’ removed, we could evaluate what makes sense for the remaining pieces, eg import those particular pieces into Simgear itself.
Getting us ‘de-Boost-ified’ would be really valuable thing in terms of removing our biggest non-OSG dependency.
We can’t drop it, without some nasty work : Gaétan has removed a lot of pieces, but the remaining items are going to be more of a battle (and there’s one or two we might need to fork or find a different solution), especially the ‘bimap’ used in the Effects code)
Of course, patches always welcome, but untangling Boost from especially the Nasal-cppbind code needs some fairy dedicated meta-programming work :) The good news is if it compiles, it’s probably going to work. (Don’t ask about the bad news…)
This is a reason to move to C++14 after the LTS branches : a bunch more stuff will become available to us in the standard lib, replacing Boost-isms. The catch is we need t keep the LTS building with new Boost versions, so we can’t avoid some issues like you encountered.
At some point (likely after the LTS) we may start to move all of the boost::shared_ptr and SGShared_ptr to use std::shared_ptr. If we have these ‘using =‘, the work is considerable reduced.
let's continue to move toward minimizing our boost dependency, but understand it is here to stay for the health of LTS releases that use it.
looking at the boost for-each changes, wondering how simple the change was going to be. When I looked again there was just one left. Did you miss sgTileDetailsCallback.hxx, or did you leave it as an exercise for the student?
#include <boost> is down to 108 cases in 65 files.
||Pending|| The only BOOST_FOREACH left is because the case is a little bit special:
the 'bin' variable is declared outside of the loop. So, it can not be replace by a C++ 11 for range loop.
|tuple & tuple_comparison||Pending||14 found in 10 files|
|core/enable_if & utility/enable_if||Pending|| 7 cases in 3 files (there are additional
files that already use std::enable_if)
Boost is also the largest external dependency we have besides OSG, and we are only using one or two features of Boost, now that we moved to C++11 (and soon, C++14)
Essentially, Boost existed because C++ didn’t develop between C++98 and C++11 - as soon as you start using the modern C++ versions, the reasons to use Boost dwindle rapidly. (Becuase lots of the new standard library was inspired by, or even developed by the same people, as Boost)
The other problem with Boost is it’s hard to use one module: we do use Boost multi_index - but it’s impossible to just add one (or a few) headers containing it to Simgear : we’re forced to have all of Boost available. This was a design choice by Boost that made sense fifteen years ago, but it's a bit of pain to deal with now. So we will likely end up forking Boost::multi_index into SimGear as simgear::multi_index, if that’s the one remaining Boost piece we are using.
Of course we’re not committed to that, we *can* just keep using Boost for that one thing. What we’re doing at the moment is removing the obvious stuff that’s in the std lib in C++11, then we can evaluate what’s left case-by-case.