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

    <small id='51RX7'></small><noframes id='51RX7'>

        <bdo id='51RX7'></bdo><ul id='51RX7'></ul>
    1. <legend id='51RX7'><style id='51RX7'><dir id='51RX7'><q id='51RX7'></q></dir></style></legend>

      C++ valarray 与向量

      C++ valarray vs. vector(C++ valarray 与向量)

          <bdo id='B6YgU'></bdo><ul id='B6YgU'></ul>

          <legend id='B6YgU'><style id='B6YgU'><dir id='B6YgU'><q id='B6YgU'></q></dir></style></legend>
              <tbody id='B6YgU'></tbody>

            <small id='B6YgU'></small><noframes id='B6YgU'>

                <i id='B6YgU'><tr id='B6YgU'><dt id='B6YgU'><q id='B6YgU'><span id='B6YgU'><b id='B6YgU'><form id='B6YgU'><ins id='B6YgU'></ins><ul id='B6YgU'></ul><sub id='B6YgU'></sub></form><legend id='B6YgU'></legend><bdo id='B6YgU'><pre id='B6YgU'><center id='B6YgU'></center></pre></bdo></b><th id='B6YgU'></th></span></q></dt></tr></i><div id='B6YgU'><tfoot id='B6YgU'></tfoot><dl id='B6YgU'><fieldset id='B6YgU'></fieldset></dl></div>
              • <tfoot id='B6YgU'></tfoot>
              • 本文介绍了C++ valarray 与向量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!


                我非常喜欢矢量.它们既漂亮又快速.但我知道这个叫做 valarray 的东西是存在的.为什么我要使用 valarray 而不是向量?我知道 valarrays 有一些语法糖,但除此之外,它们什么时候有用?

                I like vectors a lot. They're nifty and fast. But I know this thing called a valarray exists. Why would I use a valarray instead of a vector? I know valarrays have some syntactic sugar, but other than that, when are they useful?


                Valarrays(值数组)旨在将 Fortran 的某些速度带到 C++.您不会创建一个 valarray 指针,因此编译器可以对代码做出假设并更好地优化它.(Fortran 这么快的主要原因是没有指针类型,所以不能有指针别名.)

                Valarrays (value arrays) are intended to bring some of the speed of Fortran to C++. You wouldn't make a valarray of pointers so the compiler can make assumptions about the code and optimise it better. (The main reason that Fortran is so fast is that there is no pointer type so there can be no pointer aliasing.)

                Valarrays 也有允许你以相当简单的方式将它们切片的类,尽管标准的那部分可能需要更多的工作.调整它们的大小是破坏性的,并且它们缺少迭代器 自 C++11 以来它们就有迭代器.

                Valarrays also have classes which allow you to slice them up in a reasonably easy way although that part of the standard could use a bit more work. Resizing them is destructive and they lack iterators they have iterators since C++11.

                因此,如果您使用的是数字并且使用方便并不是那么重要,请使用 valarrays.否则,向量就方便多了.

                So, if it's numbers you are working with and convenience isn't all that important use valarrays. Otherwise, vectors are just a lot more convenient.

                这篇关于C++ valarray 与向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



                What is the past-the-end iterator in STL C++?(STL C++ 中的最后迭代器是什么?)
                vector::at vs. vector::operator[](vector::at 与 vector::operator[])
                C++ equivalent of StringBuffer/StringBuilder?(C++ 等效于 StringBuffer/StringBuilder?)
                Adding types to the std namespace(将类型添加到 std 命名空间)
                Is the C++ std::set thread-safe?(C++ std::set 线程安全吗?)
                How to use std::find/std::find_if with a vector of custom class objects?(如何将 std::find/std::find_if 与自定义类对象的向量一起使用?)
                    <tbody id='iLczs'></tbody>
                    <bdo id='iLczs'></bdo><ul id='iLczs'></ul>
                  • <small id='iLczs'></small><noframes id='iLczs'>

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

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