FMI Ticket System
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 1 | Project Topic 4 |
Classes | Functions
List.hpp File Reference

Stores declaration and definition of templated class List. More...

#include <istream>
#include <ostream>

Go to the source code of this file.

Classes

class  List< T >
 Templated class that stores an array of elements in dynamic memory. More...
 

Functions

template<typename T >
std::istream & operator>> (std::istream &istr, List< T > &obj)
 Reads List from stream with >> operator. More...
 
template<typename T >
std::ostream & operator<< (std::ostream &ostr, const List< T > &obj)
 Writes List to stream with << operator. More...
 

Detailed Description

Stores declaration and definition of templated class List.

Function Documentation

◆ operator<<()

template<typename T >
std::ostream & operator<< ( std::ostream &  ostr,
const List< T > &  obj 
)

Writes List to stream with << operator.

Uses the stream's << operator to write the count and then all objects.

Warning
The function depends on the type having the operator << defined, which takes an std::ostream& and writes it's data to it. Return type doesn't matter.
Note
Best used with std::cout or text std::ofstream

◆ operator>>()

template<typename T >
std::istream & operator>> ( std::istream &  istr,
List< T > &  obj 
)

Reads List from stream with >> operator.

Uses the stream's >> operator to read and parse the elements. The first item in the stream should be the count.

Warning
The function depends on the type having the operator >> defined, which takes an std::istream& and writes it's data to it. Return type doesn't matter.
Note
Best used with std::cin or text std::ifstream