由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - singleton without static?
相关主题
问个c++的问题Java 面试题
write singleton w/o using static variable or function请教个Amazo的题
C++ Singleton的实现几道微软面试题
关于singleton 的面试题请教:string pattern match 题
singleton pattern problem分享一道电面题,兼下午Onsite攒人品求祝福
请问一道special singleton class的题GF面经
弱问:singleton要不要destructor啊?讨论一下FB的经典题read和readline吧
请问为何在java中要慎重使用static的filed?这个G题是DFS还是DP
相关话题的讨论汇总
话题: single话题: static话题: singleton话题: byte话题: cast
进入JobHunting版参与讨论
1 (共1页)
x***y
发帖数: 633
1
This is what I got by goole:
Single* obtain_single()
{
void* p = get_system_pool();
byte_t* i = static_cast(p);
if (*(i-1) == 0)
{
Single* s = new(p) Single;
return s;
}
return static_cast(p);
}
Basically, It's the same with using static data member except using the "
get_system_pool()" to count how many objects have been instantiated....
Anyone knows what this function is? Or how to code it? Or any better
methods to do the singleton?
1 (共1页)
进入JobHunting版参与讨论
相关主题
这个G题是DFS还是DPsingleton pattern problem
请教一道老题目请问一道special singleton class的题
一道google的面试题.弱问:singleton要不要destructor啊?
发面经攒rp —— Bloomberg请问为何在java中要慎重使用static的filed?
问个c++的问题Java 面试题
write singleton w/o using static variable or function请教个Amazo的题
C++ Singleton的实现几道微软面试题
关于singleton 的面试题请教:string pattern match 题
相关话题的讨论汇总
话题: single话题: static话题: singleton话题: byte话题: cast