Tag: template functiuon

  • Printing the contents of STL containers in a generic way

    A generic Print function

    A way of using STL algorithms combined with template functions as a means of printing the contents of any type of STL container (eg a std::vector), containing any generic data type (eg int, std::string etc). typename T defines the generic data type held by the container, while typename InputIterator describes the STL container iterators passed to it:
    (more…)