std::fill does not turn into memset for POD types

后端 未结 3 1324
别那么骄傲
别那么骄傲 2021-01-02 02:31

I am expecting a std::fill on an continuous container, say std::vector, will automatically compiled to a call of memset. However, when I tried the following code

<         


        
3条回答
  •  轮回少年
    2021-01-02 03:34

    The standard doesn't force implementors to use memset(). But gcc for example does happen to use memset() for std::fill() on containers of char.

提交回复
热议问题