Copy std::stack into an std::vector

后端 未结 6 865
不思量自难忘°
不思量自难忘° 2021-02-07 09:02

Is the following code guaranteed by the standard to work(assuming st is not empty)?

#include 
#include 
int main()
{
   extern std::st         


        
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-07 09:46

    Only std::vector is guaranteed by C++03 to have contiguous elements (23.4.1). In C++1x this will be extended to std::string as well (defect #530).

提交回复
热议问题