//: C07:assocGen.h // From "Thinking in C++, Volume 2", by Bruce Eckel & Chuck Allison. // (c) 1995-2004 MindView, Inc. All Rights Reserved. // See source code use permissions stated in the file 'License.txt', // distributed with the code package available at www.MindView.net. // The fill_n() and generate_n() equivalents // for associative containers. #ifndef ASSOCGEN_H #define ASSOCGEN_H template void assocFill_n(Assoc& a, Count n, const T& val) { while(n-- > 0) a.insert(val); } template void assocGen_n(Assoc& a, Count n, Gen g) { while(n-- > 0) a.insert(g()); } #endif // ASSOCGEN_H ///:~