• <bdo id='n6ib3'></bdo><ul id='n6ib3'></ul>

  • <legend id='n6ib3'><style id='n6ib3'><dir id='n6ib3'><q id='n6ib3'></q></dir></style></legend>

    1. <small id='n6ib3'></small><noframes id='n6ib3'>

      <i id='n6ib3'><tr id='n6ib3'><dt id='n6ib3'><q id='n6ib3'><span id='n6ib3'><b id='n6ib3'><form id='n6ib3'><ins id='n6ib3'></ins><ul id='n6ib3'></ul><sub id='n6ib3'></sub></form><legend id='n6ib3'></legend><bdo id='n6ib3'><pre id='n6ib3'><center id='n6ib3'></center></pre></bdo></b><th id='n6ib3'></th></span></q></dt></tr></i><div id='n6ib3'><tfoot id='n6ib3'></tfoot><dl id='n6ib3'><fieldset id='n6ib3'></fieldset></dl></div>
      <tfoot id='n6ib3'></tfoot>

        使 std::vector 分配对齐的内存

        Making std::vector allocate aligned memory(使 std::vector 分配对齐的内存)

        1. <small id='yvXGN'></small><noframes id='yvXGN'>

          <legend id='yvXGN'><style id='yvXGN'><dir id='yvXGN'><q id='yvXGN'></q></dir></style></legend>
            <bdo id='yvXGN'></bdo><ul id='yvXGN'></ul>

            1. <tfoot id='yvXGN'></tfoot>

                <i id='yvXGN'><tr id='yvXGN'><dt id='yvXGN'><q id='yvXGN'><span id='yvXGN'><b id='yvXGN'><form id='yvXGN'><ins id='yvXGN'></ins><ul id='yvXGN'></ul><sub id='yvXGN'></sub></form><legend id='yvXGN'></legend><bdo id='yvXGN'><pre id='yvXGN'><center id='yvXGN'></center></pre></bdo></b><th id='yvXGN'></th></span></q></dt></tr></i><div id='yvXGN'><tfoot id='yvXGN'></tfoot><dl id='yvXGN'><fieldset id='yvXGN'></fieldset></dl></div>
                  <tbody id='yvXGN'></tbody>
                  本文介绍了使 std::vector 分配对齐的内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  是否可以使自定义结构的 std::vector 分配对齐的内存以使用 SIMD 指令进行进一步处理?如果可以使用 Allocator,有没有人碰巧有这样一个他可以共享的分配器?

                  Is it possible to make std::vector of custom structs allocate aligned memory for further processing with SIMD instructions? If it is possible to do with Allocator, does anyone happen to have such an allocator he could share?

                  推荐答案

                  从 C++17 开始,只需使用 std::vector<__m256i> 或任何其他对齐类型.operator new 有对齐版本,它被 std::allocator 用于对齐类型(以及普通的 new 表达式,所以new __m256i[N] 从 C++17 开始也是安全的.

                  Starting in C++17, just use std::vector<__m256i> or with any other aligned type. There's aligned version of operator new, it is used by std::allocator for aligned types (as well as by plain new-expression, so new __m256i[N] is also safe starting in C++17).

                  @MarcGlisse 发表了这样的评论,这是一个使其更显眼的答案.

                  There's a comment by @MarcGlisse saying this, making this an answer to make it more visible.

                  这篇关于使 std::vector 分配对齐的内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to limit the number of running instances in C++(C++中如何限制运行实例的数量)
                  Using boost::asio::async_read with stdin?(将 boost::asio::async_read 与 stdin 一起使用?)
                  How to find out what dependencies (i.e other Boost libraries) a particular Boost library requires?(如何找出特定 Boost 库需要哪些依赖项(即其他 Boost 库)?)
                  What#39;s the purpose of a leading quot;::quot; in a C++ method call(引导“::的目的是什么?在 C++ 方法调用中)
                  Boost Spirit x3: parse into structs(Boost Spirit x3:解析为结构体)
                  How boost auto-linking makes choice?(boost自动链接如何做出选择?)
                  <legend id='WxIgH'><style id='WxIgH'><dir id='WxIgH'><q id='WxIgH'></q></dir></style></legend>
                    <tbody id='WxIgH'></tbody>

                          <i id='WxIgH'><tr id='WxIgH'><dt id='WxIgH'><q id='WxIgH'><span id='WxIgH'><b id='WxIgH'><form id='WxIgH'><ins id='WxIgH'></ins><ul id='WxIgH'></ul><sub id='WxIgH'></sub></form><legend id='WxIgH'></legend><bdo id='WxIgH'><pre id='WxIgH'><center id='WxIgH'></center></pre></bdo></b><th id='WxIgH'></th></span></q></dt></tr></i><div id='WxIgH'><tfoot id='WxIgH'></tfoot><dl id='WxIgH'><fieldset id='WxIgH'></fieldset></dl></div>
                          <tfoot id='WxIgH'></tfoot>
                        1. <small id='WxIgH'></small><noframes id='WxIgH'>

                          • <bdo id='WxIgH'></bdo><ul id='WxIgH'></ul>