代码拉取完成,页面将自动刷新
#ifndef __COUT_H
#define __COUT_H
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
template <typename T1, typename T2> ostream& operator<<(ostream &s, pair<T1,T2> p)
{
return s << "(" << p.first << "," << p.second << ")";
}
inline ostream& operator<<(ostream &s, vector<string> v)
{
int cnt = v.size();
s << "[ ";
for (int i=0; i<cnt; i++) {
if (i > 0) s << ", ";
s << '"' << v[i] << '"';
}
return s << " ]";
}
template <typename T> ostream& operator<<(ostream &s, vector<T> v)
{
int cnt = v.size();
s << "[ ";
for (int i=0; i<cnt; i++) {
if (i > 0) s << ", ";
s << v[i];
}
return s << " ]";
}
template <typename T> ostream& operator<<(ostream &s, list<T> ls)
{
int cnt = 0;
s << "( ";
//for (typeof(ls.begin()) it=ls.begin(); it!=ls.end(); it++) {
for (auto it=ls.begin(); it!=ls.end(); it++) {
if (it != ls.begin()) s << ", ";
s << *it;
cnt++;
}
return s << " )";
}
template <typename T> ostream& operator<<(ostream &s, deque<T> st)
{
int cnt = st.size();
s << "[ ";
//for (typeof(st.begin()) it=st.begin(); it!=st.end(); it++) {
for (auto it=st.begin(); it!=st.end(); it++) {
if (it != st.begin()) s << ", ";
s << *it;
}
return s << " ]";
}
template <typename T1, typename T2> ostream& operator<<(ostream &s, map<T1,T2> m)
{
int cnt = m.size();
s << "{ ";
//for (typeof(m.begin()) it=m.begin(); it!=m.end(); it++) {
for (auto it=m.begin(); it!=m.end(); it++) {
if (it != m.begin()) s << ", ";
s << it->first << " => " << it->second;
}
return s << " }";
}
template <typename T> ostream& operator<<(ostream &s, set<T> st)
{
int cnt = st.size();
s << "[ ";
//for (typeof(st.begin()) it=st.begin(); it!=st.end(); it++) {
for (auto it=st.begin(); it!=st.end(); it++) {
if (it != st.begin()) s << ", ";
s << *it;
}
return s << " ]";
}
#endif
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。