0

First of all, I am sorry for asking a rather subjective question, but maybe there is a quite simple answer to my question.

In math when I have a vector, I can do operations on it, e.g. v_3 = v_1 + v_2. In c++ I can do the same with valarray. On the other side, if I just want to have an extendable array with dynamic size, I use std::vector. Do you see why I think theire names are swapped?

Is there any logical or historical explanation for this naming decision?

Arne
  • 7,921
  • 9
  • 48
  • 66
  • 1
    [Why is a C++ Vector called a Vector?](http://stackoverflow.com/q/581426/3953764) – Piotr Skotnicki Sep 21 '15 at 11:42
  • Indeed; there are pertinent answers there. In summary: it's considered a historical mistake, although arguably both names are completely subjective and "vector" as a term has many, many uses across various fields so this isn't technically "wrong" or "swapped". Computer programming and maths are two different fields; even within maths, "vector" is ambiguous. – Lightness Races in Orbit Sep 21 '15 at 11:48
  • [`std::valarray`](http://en.cppreference.com/w/cpp/numeric/valarray) is very different from `std::vector`. It's for mathematical purposes. – πάντα ῥεῖ Sep 21 '15 at 11:49

0 Answers0