views:

446

answers:

5

The Loki library implements some very widely used concepts (smart pointer, visitor, factory, etc.). The associated book "Modern C++ Design" is often mentioned, but the library itself is not widely used. Why is that?

Most developers seem to prefer Boost. In particular, why do people often decide to use Boost's smart pointers rather than Loki's?

+6  A: 

You want to use a library that the next programmer is going to know and that is going to be well supported in the future - so you pick a major lib. Because it's a major lib lots of people use it, so it becomes the default choice.

Martin Beckett
+1  A: 

Speaking as someone who's used quite a bit of the Boost library, and also looked at Loki more than once, the biggest problem was the sparsity of documentation. Also, Loki uses some of the hairiest bits of C++ templates. Exciting stuff, but also rather daunting.

Charles Anderson
*"Loki uses some of the hairiest bits of C++ templates"* - so does Boost, or am i misunderstanding something?
Georg Fritzsche
See the `shared_ptr` faq: *Parameterization discourages users. The shared_ptr template is carefully crafted to meet common needs without extensive parameterization. Some day a highly configurable smart pointer may be invented that is also very easy to use and very hard to misuse. Until then, shared_ptr is the smart pointer of choice for a wide range of applications. (Those interested in policy based smart pointers should read Modern C++ Design by Andrei Alexandrescu.)*
Johannes Schaub - litb
@litb: As I said on the IRC, I disagree. It just felt more natural to me to use the loki's smart pointer then boost's one. If I wanted mutex lock on loki's smart pointer I just needed to input a mutex class for it. Loki's smart pointer is the most generic solution I found to the problem. It sometimes makes the use easier.
the_drow
+8  A: 

Loki is a research/proof-of-concept sort of thing. Alexandrescu pushes new ideas, other people adopt those for real world. Also boost::shared_ptr is almost literally in TR1.

Nikolai N Fetissov
A: 

I used Loki once for a little tool (basically an interpreter) and actually liked it. My coworkers were less enthusiastic about the library, so its use remained constrained to this small sub-project.

Nemanja Trifunovic
A: 

I actually prefer Loki's way of doing things and I have contributed to Loki myself a Decorator pattern which now sits in the tracker because the project as far as I know is no longer maintained.
I use boost shared_pointer just because it will be the standard very soon, I may dislike the fact that I can't customize it to act exactly the way I want it to act but I have to live with it.
Usage of the standard library is important as it keeps the code maintainable by other programmers. If it's open source and you want to experiment go ahead and use Loki. No one is stopping you.
Actually Windows Vista which uses some of Loki's features in it.
I am guessing they are not using the redundant implementations of smart pointers and visitors.

the_drow