Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::valarray<T>::size

      From cppreference.com
      <cpp‎ |numeric‎ |valarray
       
       
       
      std::valarray
      Member functions
      Non-member functions
      Helper classes
      Deduction guides(C++17)
       
      std::size_t size()const;

      Returns the number of elements in the valarray.

      Contents

      [edit]Parameters

      (none)

      [edit]Return value

      Number of elements in the valarray.

      [edit]Example

      Run this code
      #include <iostream>#include <valarray> int main(){std::valarray<double> a={1,2,3,4,5,6,7,8,9,10};std::cout<<"Average: "<< a.sum()/a.size()<<'\n';}

      Output:

      Average: 5.5

      [edit]See also

      changes the size of valarray
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/numeric/valarray/size&oldid=124258"

      [8]ページ先頭

      ©2009-2025 Movatter.jp