size

Syntax:

    #include <valarray>
    size_t size() const;

The size() function returns the number of elements in the valarray.

   #include <valarray>
   #include <iostream>
 
   const int vd[] = {1,2,3,4,5};
   std::valarray<int> v1(vd,5);
   std::cout << v1.size() << std::endl;

Will produce this output:

   5