__nat class in clang standard libarry

喜欢而已 提交于 2019-12-08 02:03:51

问题


I was looking through clang's c++ standard library, and found this class in the shared_ptr class.

class shared_ptr
...
private:
        struct __nat {int __for_bool_;};
...
};

and I understand that this class is used to detect whether type conversion is possible at compile time, but its member __for_bool_ is never used anywhere in the class or the weak_ptr counterpart. So my question is, what is the point of __for_bool_? Why not simply use an empty class for the same purpose?

I'm sure the standard library authors definitely knows better than me.

来源:https://stackoverflow.com/questions/50695153/nat-class-in-clang-standard-libarry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!