/* Copyright (c) 1999, Gary Yihsiang Hsiao. All Rights Reserved. bugs report to: ghsiao@rbcds.com or ghsiao@netzero.net Permission to use, copy, modify, and distribute this software for NON-COMMERCIAL purposes and without fee is hereby granted provided that this copyright notice appears in all copies. This software is distributed on an 'as is' basis without warranty. */ #include "bucket.h" #include <iostream> // overload << for ostream #include <algorithm> // use copy // read in a collection of doubles for a length Bucket::Bucket(const double* pd, int length) { for (int i=0; i < length; ++i) { items.push_back(*pd); ++pd; } } // destroy any data associated with this vector of numbers Bucket::~Bucket() { /* do nothing */ } Bucket::operator const string& () { *this << items; return getData(); } void Bucket::operator=(const string& str) { putData(str); *this >> items; } ostream& operator<<(ostream& os, Bucket& b) { copy(b.items.begin(), b.items.end(), ostream_iterator<double>(os, " ")); return os; }
Hosted by www.Geocities.ws

1