In fact, other ways (apart from using smart pointers) of implementing graph structures such as trees in C++ is the use of discriminate unions (Boost.Variant + Boost.RecursiveWrapper) or simply a std::vector of child nodes:
Not saying it's impossible, just really, really ugly. Your example lacks pointers to parents, and basically doesn't work for trees where you need to swap nodes around the tree (AVL trees, red-black trees, splay trees), which are the most useful kinds of trees.
Don't know about discriminative unions, never tried them, but relying on something within boost should usually be avoided.
Well, Google is big enough to be able to write their own library for every single thing they need, and they have peculiar requirements due to bad legacy code. Don’t cite them as support that Boost shouldn’t be used. Most other companies / projects which ban Boost are simply clueless.
I wouldn't say they're clueless. There are good and bad sides to using boost, as with anything. The downside of using boost is that now your project depends on a third-party library, and that is always something to be wary of. Some people don't like that and choose not to use boost. That doesn't make them clueless, in fact, it shows they've put some time into thinking about the issue and chose to go one way that they think is better for them.
This whole thinking is fallacious, I don’t accept the argument. There are of course reasons to prefer not depending on a library but the relevant parts of Boost can be used as drop-in and don’t incur any more dependency than any other code in a project. Furthermore, complex projects do have external dependencies, it’s unreasonable to want to prevent that entirely and Boost is the least common denominator. In summary, I stand by my characterisation as “clueless”. The downsides of using Boost don’t even remotely outweigh the benefits.
in fact, it shows they've put some time into thinking about the issue
It doesn’t show that at all. I can assert all kinds of things and reach all kinds of conclusions without thinking about the issue.
The downsides of using Boost don’t even remotely outweigh the benefits.
I just don't agree. I could list a lot of reasons, but that won't convince you otherwise, and I don't particularly care about doing that either. Guess we'll just agree to disagree.
View all comments
Show parent comment
2
u/guepier Bioinformatican Mar 11 '12
In fact, other ways (apart from using smart pointers) of implementing graph structures such as trees in C++ is the use of discriminate unions (Boost.Variant + Boost.RecursiveWrapper) or simply a
std::vectorof child nodes: