Skip to content

vector_pro::print

C++
void print() const;
void print(void(print)(const value_type&)) const;

Print the vector_pro.

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

Otherwise, you should pass a function void(value_type&) as a param to tell us how to print the value_type

Parameters

  1. print
    A function can be call to print the value_type.

Return value

none

Example

C++
// vector_pro::print
#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 };

  // print
  std::cout << "myvector contains: ";
  myvector.print();
  std::cout << std::endl;
  return 0;
}

Complexity

Linear in size.