Beispiel #1
0
	std::shared_ptr<T> get_as(const database_type & db, const std::string & key, const timeval_type & current)
	{
		std::shared_ptr<type_interface> val = db.get(key, current);
		if (!val) {
			return std::shared_ptr<T>();
		}
		std::shared_ptr<T> value = std::dynamic_pointer_cast<T>(val);
		if (!value) {
			throw std::runtime_error("ERR type mismatch");
		}
		return value;
	}