Tobias Schwinger wrote:
thanks for your very positive review.
Thanks for a well-designed library!
Very little is said about BOOST_SINGLETON_PLACEMENT and BOOST_SINGLETON_PLACEMENT_DECLARATION. The reference material mentions them without any explanation.
That "Singletons and dynamic libraries" section explains their purpose.
What exactly is missing?
I'm not too fond of specifying what those macros expand to and I don't really want to mention them in the introductory section either, as for me they are kind-of workarounds for the imperfect ABIs we have to deal with.
Agreed: I don't want you to document the expansions. But the entirety of the reference coverage consists of the words "Placement declaration" and "Placement definition," with examples showing how to write them. What effects can I expect? The "Singletons and dynamic libraries" section says: "There must be at most one single instance of a Singleton, even if it is exposed by a dynamic library... Keeping the former can be problematic if the management code gets inlined into the client or if symbols are not being merged automatically. As a solution, this library provides two macros, BOOST_SINGLETON_PLACEMENT and BOOST_SINGLETON_PLACEMENT_DECLARATION to compile the effective code into a specific source file." These macros are a workaround for a problem. The problem appears to be more than one instance of the same singleton class in a given process. How would I know I'm susceptible? What's an example scenario? On a lame platform, two or more dynamic libraries in the process each #include a header for a particular singleton class definition, and contain 'instance' invocations? How would I know my platform is lame? What's the solution: putting BOOST_SINGLETON_PLACEMENT_DECLARATION inside the header class definition, and BOOST_SINGLETON_PLACEMENT inside exactly one of the consumer dynamic libraries? What would happen if both libraries contained BOOST_SINGLETON_PLACEMENT? If I'm writing a dynamic library for use by others, and I use someone else's singleton class containing BOOST_SINGLETON_PLACEMENT_DECLARATION, how would I decide whether to include BOOST_SINGLETON_PLACEMENT in my library? Or should BOOST_SINGLETON_PLACEMENT be used in the main program instead? For me, the documentation doesn't yet answer these two key questions: (1) How would I know I need BOOST_SINGLETON_PLACEMENT? (2) Where should I put it?