Skip to content

vector_pro::operator<<

C++
friend std::ostream& operator<<(std::ostream &output, const vector_pro<value_type>& target);

Stream vector_pro and insert into std::ostream

Stream vector_pro and insert into std::ostream .

Please note that you must ensure your value_type implements the << stream insertion operator.

Parameters

  1. output
    The std::ostream.
  2. target
    The container.

Return value

The reference of output itself.

Example

C++
// vector_pro::operator<<
#include <iostream>
#include "vector_pro.h"

/**
 * Output:
 * myvector contains:[ 32, 72, 55, 46, 32, 12, 61, 84, 39, 97 ]
 */

int main ()
{
  vector_pro<int> myvector = { 32, 72, 55, 46, 32, 12, 61, 84, 39, 97 };

  std::cout << "myvector contains:" << myvector << '\n';
  return 0;
}

Complexity

Linear in size.