std::copy/memcpy/memmove optimizations

假装没事ソ 提交于 2019-12-04 04:10:24
Matthieu M.

There has been some debate over what trivial meant.

For example, your example is not trivially constructible as far as I can tell (std::is_trivially_default_constructible would return false I think).

In your case, I think you would need the new trait std::is_trivially_copyable, which is more fine grained. So... upgrade your compiler ?

__is_trivial gives the right value for all types.

You can't rely on any paticular STL implementation to use it, although if the compiler vendor supplied it then it probably does contain various compiler-specific improvements behinds the scenes.

C++11's std::is_trivial is merely standardising this feature, there's no reason for an implementation not to use it.

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