⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 set1.hh

📁 MySql C++ library
💻 HH
字号:
#ifndef __set1_hh__
#define __set1_hh__

#include <set>
#include <vector>
#include <iostream>
using namespace std ;

#include "define_short.h"
#include "coldata1.hh"

template <class T, class value_type = /*typename*/ T::value_type>
class MysqlListInsert {
private:
  T *object;
public:
  MysqlListInsert(T *o) {object = o;}
  void operator () (const value_type &data) {object->push_back(data);}
};

template <class T, class key_type = /*typename*/ T::key_type> 
class MysqlSetInsert {
private:
  T *object;
public:
  MysqlSetInsert(T *o) {object = o;}
  void operator () (const key_type &data) {object->insert(data);}
};

template <class T>
inline MysqlSetInsert<set<T> > set_insert(set<T> *o) {
  return MysqlSetInsert<set<T> >(o);
}

template <class T>
inline MysqlListInsert<vector<T> > set_insert(vector<T> *o) {
  return MysqlListInsert<vector<T> >(o);
}

template <class Insert>
void set2container (const char *str, Insert insert);

//: A Special Set for holding mysql sets.
template <class Container = set<string> >
class Set : public Container {
public:
  Set(const char* str) {set2container(str,set_insert(this));}           //:
  Set(const string &str) {set2container(str.c_str(),set_insert(this));} //:
  Set(const ColData &str) 
    {set2container(str.c_str(),set_insert(this));}                      //:
  
  ostream& out_stream(ostream &s) const;
  
  operator string ();
};

//! with_class = Set

//:
template <class Container>
inline ostream& operator << (ostream &s, const Set<Container> &d) 
{ 
  return d.out_stream(s); 
}

#endif









⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -