37 #ifndef FABLE_SCHEMA_MAGIC_HPP_ 38 #define FABLE_SCHEMA_MAGIC_HPP_ 58 template <
typename T,
typename P>
59 Array<T, P>::Array(std::vector<T>* ptr, std::string&& desc)
60 : Array<T, P>(ptr, make_prototype<T>(),
std::move(desc)) {}
63 Array<T, decltype(make_prototype<T>())> make_schema(std::vector<T>* ptr, std::string&& desc) {
64 return Array<T, decltype(make_prototype<T>())>(ptr, std::move(desc));
67 template <
typename T,
typename P>
68 Const<T, P>::Const(
const T& constant, std::string&& desc)
69 : Const<T, P>(constant, make_prototype<T>(),
std::move(desc)) {}
72 Const<T, decltype(make_prototype<T>())> make_const_schema(
const T& constant, std::string&& desc) {
73 return Const<T, decltype(make_prototype<T>())>(constant, std::move(desc));
76 template <
typename T,
typename P>
77 Map<T, P>::Map(std::map<std::string, T>* ptr, std::string&& desc)
78 : Map<T, P>(ptr, make_prototype<T>(),
std::move(desc)) {}
81 Map<T, decltype(make_prototype<T>())> make_schema(std::map<std::string, T>* ptr,
83 return Map<T, decltype(make_prototype<T>())>(ptr, std::move(desc));
86 template <
typename T,
typename P>
87 Optional<T, P>::Optional(boost::optional<T>* ptr, std::string&& desc)
88 : Optional<T, P>(ptr, make_prototype<T>(),
std::move(desc)) {}
91 Optional<T, decltype(make_prototype<T>())> make_schema(boost::optional<T>* ptr,
93 return Optional<T, decltype(make_prototype<T>())>(ptr, std::move(desc));
96 template <typename T, std::enable_if_t<std::is_base_of<Confable, T>::value,
int>>
97 auto make_prototype(std::string&& desc) {
98 return FromConfable<T>(std::move(desc));
101 template <typename T, std::enable_if_t<!std::is_base_of<Confable, T>::value,
int>>
102 auto make_prototype(std::string&& desc) {
103 return make_schema(static_cast<T*>(
nullptr), std::move(desc));
109 #endif // FABLE_SCHEMA_MAGIC_HPP_