C++ singleton vs. global static object

前端 未结 8 1418
孤街浪徒
孤街浪徒 2020-11-28 20:06

A friend of mine today asked me why should he prefer use of singleton over global static object? The way I started it to explain was that the singleton can have state vs. s

8条回答
  •  -上瘾入骨i
    2020-11-28 20:43

    Using Singleton("construct on first use") idiom, you can avoid static initialization order fiasco

提交回复
热议问题