1 Star 0 Fork 0

TF-boy/solitaire-solver

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
cout11.h 1.93 KB
一键复制 编辑 原始数据 按行查看 历史
#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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/TF-boy/solitaire-solver.git
git@gitee.com:TF-boy/solitaire-solver.git
TF-boy
solitaire-solver
solitaire-solver
master

搜索帮助