summaryrefslogtreecommitdiff
path: root/libmysqlpp/my-opts.cpp
blob: b0a777dec806a7071eff33b17eeecdc53d5558c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "my-opts.h"

namespace MySQL {
	const char *
	operator~(const OptString & os)
	{
		if (os) {
			return os->c_str();
		}
		return NULL;
	}
}

namespace std {
	template <typename T>
	std::istream &
	operator>>(std::istream & s, std::vector<T> & o)
	{
		o.push_back(T());
		return (s >> o.back());
	}

	template <typename T>
	std::istream &
	operator>>(std::istream & s, boost::optional<T> & o)
	{
		o = T();
		return (s >> *o);
	}

	template std::istream & operator>>(std::istream & s, boost::optional<std::string> & o);
	template std::istream & operator>>(std::istream & s, std::vector<std::string> & o);
}