MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / ptr_assign

Function ptr_assign

include/chaiscript/dispatchkit/bootstrap.hpp:177–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175 /// Similar to shared_ptr_clone. Used for Proxy_Function.
176 template<typename Type>
177 Boxed_Value ptr_assign(Boxed_Value lhs, const std::shared_ptr<Type> &rhs)
178 {
179 if (lhs.is_undef()
180 || (!lhs.get_type_info().is_const() && lhs.get_type_info().bare_equal(chaiscript::detail::Get_Type_Info<Type>::get())))
181 {
182 lhs.assign(Boxed_Value(rhs));
183 return lhs;
184 } else {
185 throw exception::bad_boxed_cast("type mismatch in pointer assignment");
186 }
187 }
188
189 /// Class consisting of only static functions. All default bootstrapping occurs
190 /// from this class.

Callers

nothing calls this directly

Calls 6

bare_equalMethod · 0.80
Boxed_ValueClass · 0.70
bad_boxed_castClass · 0.70
is_undefMethod · 0.45
is_constMethod · 0.45
assignMethod · 0.45

Tested by

no test coverage detected