How does sizeof work? How can I write my own?

后端 未结 10 2332
粉色の甜心
粉色の甜心 2021-02-08 07:29

I know C++ and know the function sizeof itself but I need to write my own sizeof function so please explain how it works exactly? What does it do with the parameter

10条回答
  •  别那么骄傲
    2021-02-08 08:13

    sizeof is evaluated at compile-time (Boost and Loki make use of it). So, I think, it is impossible to write sizeof - complain function for dynamically allocated buffer.

提交回复
热议问题