xref: /netbsd-src/external/gpl3/gdb/dist/gdbsupport/def-vector.h (revision 5ba1f45f2a09259cc846f20c7c5501604d633c90)
1*5ba1f45fSchristos /* Copyright (C) 2017-2024 Free Software Foundation, Inc.
28dffb485Schristos 
38dffb485Schristos    This file is part of GDB.
48dffb485Schristos 
58dffb485Schristos    This program is free software; you can redistribute it and/or modify
68dffb485Schristos    it under the terms of the GNU General Public License as published by
78dffb485Schristos    the Free Software Foundation; either version 3 of the License, or
88dffb485Schristos    (at your option) any later version.
98dffb485Schristos 
108dffb485Schristos    This program is distributed in the hope that it will be useful,
118dffb485Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
128dffb485Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
138dffb485Schristos    GNU General Public License for more details.
148dffb485Schristos 
158dffb485Schristos    You should have received a copy of the GNU General Public License
168dffb485Schristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
178dffb485Schristos 
188dffb485Schristos #ifndef COMMON_DEF_VECTOR_H
198dffb485Schristos #define COMMON_DEF_VECTOR_H
208dffb485Schristos 
218dffb485Schristos #include <vector>
228dffb485Schristos #include "gdbsupport/default-init-alloc.h"
238dffb485Schristos 
248dffb485Schristos namespace gdb {
258dffb485Schristos 
268dffb485Schristos /* A vector that uses an allocator that default constructs using
278dffb485Schristos    default-initialization rather than value-initialization.  The idea
288dffb485Schristos    is to use this when you don't want zero-initialization of elements
298dffb485Schristos    of vectors of trivial types.  E.g., byte buffers.  */
308dffb485Schristos 
318dffb485Schristos template<typename T> using def_vector
328dffb485Schristos   = std::vector<T, gdb::default_init_allocator<T>>;
338dffb485Schristos 
348dffb485Schristos } /* namespace gdb */
358dffb485Schristos 
368dffb485Schristos #endif /* COMMON_DEF_VECTOR_H */
37