11 *\brief Output a vector of strings to out_fd.
12 *\arg strings A vector containing text.
13 *\retval 0 The vector was empty.
14 *\retval 1 The vector contained text.
16 int dump_vector(vector
<string
> strings
){
18 for (vector
<string
>::iterator iter
=strings
.begin();iter
<strings
.end();iter
++){
20 snprintf(buffer
,50000,"%s\n",(*iter
).c_str());
21 write (out_fd
,buffer
,strlen(buffer
));
28 *\brief Output a vector of strings.
29 *\arg strings A vector containing text.
30 *\arg fp A FILE pointer where to write to.
31 *\retval 0 The vector was empty.
32 *\retval 1 The vector contained text.
34 int dump_vector_fp(vector
<string
> strings
, FILE * fp
){
36 for (vector
<string
>::iterator iter
=strings
.begin();iter
<strings
.end();iter
++){
37 fprintf(fp
,"%s\n",(*iter
).c_str());
44 *\brief add contents of one vector to another vector uniquely.
45 *\param target Reference to the target vector.
46 *\param source Reference to the vector whose contents are to be added
50 void merge_vector_unique(vector
<T
> &target
, const vector
<T
> & source
){
51 for (unsigned int isource
=0; isource
<source
.size();isource
++){
52 bool already_present
=false;
53 for (int itarget
=0;itarget
<target
.size();itarget
++)
54 if (target
[itarget
]==source
[isource
]){
58 if (!already_present
) target
.insert(target
.end().source
[isource
]);