Equivalents to MSVC's _countof in other compilers?

后端 未结 4 1908
一向
一向 2020-12-03 04:54

Are there any builtin equivalents to _countof provided by other compilers, in particular GCC and Clang? Are there any non-macro forms?

4条回答
  •  余生分开走
    2020-12-03 05:20

    Update: C++ 17 support std::size() (defined in header )

    You can use boost::size() instead:

    #include 
    
    int my_array[10];
    boost::size(my_array);
    

提交回复
热议问题