|
From: Jeffrey W. <nol...@gm...> - 2015-08-13 07:43:26
|
On Thu, Aug 13, 2015 at 1:38 AM, Bart Van Assche <bva...@ac...> wrote: > On 08/12/15 22:18, Jeffrey Walton wrote: >> >> Its *really* pathetic the C++ language lacks a mechanism for me to say >> "Object 1 depends upon String 1, 2, 3", and "Object 2 depends upon >> Object 1 and String 1, 2, 3". > > > What's wrong with the singleton pattern ? When using the singleton pattern > non-circular dependencies are resolved at runtime without having to specify > the dependencies explicitly to the compiler. > I could be wrong, but I think its the wrong tool for the job. I don't have an issue with a mutithreaded program racing to create a single object at runtime. Rather, its startup code executed at load time, which I believe is guaranteed to be single threaded (or thread safe). So the only problem that needs to be solved is the order in which they are initialized. Jeff |