5#include <boost/callable_traits/args.hpp>
6#include <boost/callable_traits/return_type.hpp>
7#include <boost/mp11/algorithm.hpp>
12namespace proto_convert_details {
17template <
typename SdkType>
23template <
typename ProtoType>
29template <
typename Callable>
30using ProtoArgType = std::remove_pointer_t<
31 boost::mp11::mp_back<boost::callable_traits::args_t<Callable, boost::mp11::mp_list>>>;
37template <
typename SdkType,
39auto to_proto(
const SdkType& t) {
40 namespace pcd = proto_convert_details;
41 using ProtoReturnType = pcd::ProtoArgType<pcd::to_proto_impl<SdkType>>;
44 pcd::to_proto_impl<SdkType>{}(t, &ret);
52template <
typename ApiType,
53 typename =
decltype(
sizeof(proto_convert_details::from_proto_impl<ApiType>))>
54auto from_proto(
const ApiType& proto) {
55 return proto_convert_details::from_proto_impl<ApiType>{}(&proto);
60template <
typename SdkType>
61using EquivalentApiType =
62 proto_convert_details::ProtoArgType<proto_convert_details::to_proto_impl<SdkType>>;
66template <
typename ApiType>
67using EquivalentSdkType =
68 boost::callable_traits::return_type_t<proto_convert_details::from_proto_impl<ApiType>>;
Definition proto_convert.hpp:24
Definition proto_convert.hpp:18