view algs4-c++/src/Bag.cpp @ 18:a149b424b4e2

Updated all template classes to have the implementaiton in the header file.
author Eris Caffee <discordia@eldalin.com>
date Sat, 20 Jun 2015 19:36:11 -0500
parents 63df3e6590e2
children
line source
1 // g++ -std=c++11 Bag.cpp
3 #include "Bag.hpp"
5 #include <iostream>
7 int main ( int argc, char **argv ) {
9 Bag<long> bag;
11 long i;
12 while ( ! std::cin.eof() ) {
13 std::cin >> i;
14 if ( std::cin.good() )
15 bag.add(i);
16 }
18 std::cout << "Bag has " << bag.size() << " entries." << std::endl;
20 for ( auto iter = bag.begin(); iter != bag.end(); ++iter ) {
21 std::cout << *iter << std::endl;
22 }
24 }