C ++中的Singleton desin模式 [英] Singleton desin pattern in C++
问题描述
任何人都知道C ++中单例设计模式示例的链接
(最好不使用全局变量?)。 />
Hi,
Anyone knows of a link to a singleton design pattern example in C++
(preferably not using a global variable?).
推荐答案
关于Singleton,我在哪里可以在没有Double Checked的
多线程环境中找到一个很好的例子锁定模式?
有这个问题的解决方案吗?
About the Singleton, where can I find a good example in a
multithreading environment without the Double Checked Locking Pattern ?
Is there a solution to this problem ?
Alfonso Morra写道:
Alfonso Morra wrote:
任何人都知道C ++中单例设计模式示例的链接
www.google.com
(最好不要使用全局变量?)。
Anyone knows of a link to a singleton design pattern example in C++
www.google.com
(preferably not using a global variable?).
我相信你能找到那里有很多不同的例子。
V
I am sure you can find plenty of different examples there.
V
Victor Bazarov写道:
Victor Bazarov wrote:
Alfonso Morra写道:
Alfonso Morra wrote:
任何人都知道C ++中单例设计模式示例的链接
www.google.com
Anyone knows of a link to a singleton design pattern example in C++
www.google.com
真的吗?,我从未想过这一点。说真的,过去我已经好好多次搜索谷歌(包括这个早上好的b $ b),Java中有很多可用的例子 - 但我不能
似乎在C ++上找到任何东西(也就是说,任何超出
定义的设计模式等等。)。
单身是一个特别简单的设计(如果不是最简单的),但是
而不是急于前进并滚动我自己,我想我会找出一个
实现已经可用,来自某人(希望)有更多的C ++经验比我更多。
Really?, I never thought of that. Seriously though, I have already
searched google on several occasions in the past (including this
morning), there are lots of examples available in Java - but I cannot
seem to locate anything on C++ (-that is, anything that goes beyond the
definition of what a design pattern is etc..).
A singleton is a particularly simple design (if not the simplest), but
rather than rush ahead and "roll my own", I thought I''d find out if an
implementation is already available, from someone who (hopefully) has a
lot more experience in C++ than I do.
(最好不要使用全局变量?)。
(preferably not using a global variable?).
我相信你可以在那里找到很多不同的例子。
V
I am sure you can find plenty of different examples there.
V
这篇关于C ++中的Singleton desin模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!