| 1 |
/* BaitFisher (version 1.2.7) a program for designing DNA target enrichment baits |
| 2 |
* Copyright 2013-2016 by Christoph Mayer |
| 3 |
* |
| 4 |
* This source file is part of the BaitFisher-package. |
| 5 |
* |
| 6 |
* This program is free software: you can redistribute it and/or modify |
| 7 |
* it under the terms of the GNU General Public License as published by |
| 8 |
* the Free Software Foundation, either version 3 of the License, or |
| 9 |
* (at your option) any later version. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with BaitFisher. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
* |
| 20 |
* For any enquiries send an Email to Christoph Mayer |
| 21 |
* [email protected] |
| 22 |
* |
| 23 |
* When publishing work that is based on the results please cite: |
| 24 |
* Mayer et al. 2016: BaitFisher: A software package for multi-species target DNA enrichment probe design |
| 25 |
* |
| 26 |
*/ |
| 27 |
#ifndef PRINT_CONTAINER_H |
| 28 |
#define PRINT_CONTAINER_H |
| 29 |
|
| 30 |
#include <iostream> |
| 31 |
#include <fstream> |
| 32 |
#include <vector> |
| 33 |
#include <set> |
| 34 |
#include <list> |
| 35 |
#include <map> |
| 36 |
|
| 37 |
template <typename T, typename S> |
| 38 |
std::ostream& operator<<(std::ostream &os, std::pair<T,S> p) |
| 39 |
{ |
| 40 |
os << p.first << "=>" << p.second; |
| 41 |
return os; |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
template <typename T> |
| 46 |
void print_container(std::ostream &os, T it, T it_end, |
| 47 |
const char *pre, const char *delim, const char *post) |
| 48 |
{ |
| 49 |
if (it == it_end) |
| 50 |
return; |
| 51 |
|
| 52 |
os << pre; |
| 53 |
os << *it; |
| 54 |
++it; |
| 55 |
while (it != it_end) |
| 56 |
{ |
| 57 |
os << delim << *it; |
| 58 |
++it; |
| 59 |
} |
| 60 |
os << post; |
| 61 |
} |
| 62 |
|
| 63 |
template<typename T> |
| 64 |
void print_container(std::ostream &os, T c, |
| 65 |
const char *pre, const char *delim, const char *post) |
| 66 |
{ |
| 67 |
print_container(os, c.begin(), c.end(), pre, delim, post); |
| 68 |
} |
| 69 |
|
| 70 |
#endif |