+
+template<typename T>
+inline void Variant::assign(const T &value)
+{
+ if(funcs)
+ funcs->destroy(storage);
+
+ funcs = get_functions<typename std::remove_cv<T>::type>();
+ create(storage, value);
+}
+
+inline void Variant::copy_from(const Variant &v)
+{
+ if(funcs)
+ funcs->destroy(storage);
+
+ funcs = v.funcs;
+ if(funcs)
+ funcs->clone(storage, v.storage);
+}
+
+template<typename T>
+inline T &Variant::get()
+{
+ if(!has_type<T>())
+ throw type_mismatch(typeid(T), (funcs ? funcs->get_type() : typeid(void)));
+
+ if(sizeof(T)<=INTERNAL_SIZE)
+ return *reinterpret_cast<T *>(storage);
+ else
+ return **reinterpret_cast<T **>(storage);
+}
+
+template<typename T>
+inline const Variant::Functions *Variant::get_functions()
+{
+ static Functions funcs =
+ {
+ &get_type<T>,
+ &compare<T>,
+ &clone<T>,
+ &destroy<T>
+ };
+ return &funcs;
+}
+