stl_helpers.hh (7454:3a3e8e8cce1b) | stl_helpers.hh (7455:586f99bf0dc4) |
---|---|
1/* 2 * Copyright (c) 2010 The Hewlett-Packard Development Company 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 46 unchanged lines hidden (view full) --- 55 public: 56 ContainerPrint(std::ostream &out) 57 : out(out), first(true) 58 {} 59 60 void 61 operator()(const T &elem) 62 { | 1/* 2 * Copyright (c) 2010 The Hewlett-Packard Development Company 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 46 unchanged lines hidden (view full) --- 55 public: 56 ContainerPrint(std::ostream &out) 57 : out(out), first(true) 58 {} 59 60 void 61 operator()(const T &elem) 62 { |
63 out << elem; | |
64 // First one doesn't get a space before it. The rest do. 65 if (first) 66 first = false; 67 else 68 out << " "; | 63 // First one doesn't get a space before it. The rest do. 64 if (first) 65 first = false; 66 else 67 out << " "; |
68 69 out << elem; |
|
69 } 70}; 71 72// Treat all objects in an stl container as pointers to heap objects, 73// calling delete on each one and zeroing the pointers along the way 74template <typename T, template <typename T, typename A> class C, typename A> 75void 76deletePointers(C<T,A> &container) --- 21 unchanged lines hidden --- | 70 } 71}; 72 73// Treat all objects in an stl container as pointers to heap objects, 74// calling delete on each one and zeroing the pointers along the way 75template <typename T, template <typename T, typename A> class C, typename A> 76void 77deletePointers(C<T,A> &container) --- 21 unchanged lines hidden --- |