diff --git a/include/chaiscript/dispatchkit/boxed_value.hpp b/include/chaiscript/dispatchkit/boxed_value.hpp index e003fc52..337f68a5 100644 --- a/include/chaiscript/dispatchkit/boxed_value.hpp +++ b/include/chaiscript/dispatchkit/boxed_value.hpp @@ -756,6 +756,30 @@ namespace chaiscript return Boxed_Value(t); } + template + Boxed_Value const_var(T *t) + { + return Boxed_Value( const_cast::type>(t) ); + } + + template + Boxed_Value const_var(const boost::shared_ptr &t) + { + return Boxed_Value( boost::const_pointer_cast::type>(t) ); + } + + template + Boxed_Value const_var(const boost::reference_wrapper &t) + { + return Boxed_Value( boost::cref(t.get()) ); + } + + template + Boxed_Value const_var(const T &t) + { + return Boxed_Value(boost::shared_ptr::type >(new T(t))); + } + /** * Return true if the two Boxed_Values share the same internal type */