Deboosting FlightGear

From FlightGear wiki
Revision as of 02:10, 1 June 2020 by Hooray (Talk | contribs) (placeholder ...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
This article is a stub. You can help the wiki by expanding it.


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.[1]

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.[2]


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.[3]

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.[4]


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.[5]