Sha256: 5634d8ffcba0b7d37bec60d1adf25b1bcac25e861a7a05d361d7b7f7eb31b44f
Contents?: true
Size: 1.28 KB
Versions: 5
Compression:
Stored size: 1.28 KB
Contents
#ifndef Rice__detail__to_ruby_defn__hpp_ #define Rice__detail__to_ruby_defn__hpp_ #include "rice_traits.hpp" namespace Rice { namespace detail { //! Convert a C++ object to Ruby. /*! If x is a pointer, wraps the pointee as a Ruby object. If x is an * Object, returns x. * * If no conversion exists a compile-time error is generated. * * \param x the object to convert. * \return a Ruby representation of the C++ object. * * Example: * \code * rb_p(to_ruby(42)); * * Foo * p_foo = new Foo(); * rb_p(to_ruby(p_foo)); * \endcode */ template <typename T> class To_Ruby; // Helper template function that let's users avoid having to specify the template type - its deduced template <typename T> VALUE to_ruby(T&& x) { using Unqualified_T = remove_cv_recursive_t<T>; return To_Ruby<Unqualified_T>().convert(std::forward<T>(x)); } // Helper template function that let's users avoid having to specify the template type - its deduced template <typename T> VALUE to_ruby(T* x) { using Unqualified_T = remove_cv_recursive_t<T>; return To_Ruby<Unqualified_T*>().convert(x); } } // detail } // Rice #endif // Rice__detail__to_ruby_defn__hpp_
Version data entries
5 entries across 5 versions & 1 rubygems