Index: trunk/nv/core/common.hh
===================================================================
--- trunk/nv/core/common.hh	(revision 372)
+++ trunk/nv/core/common.hh	(revision 373)
@@ -230,4 +230,14 @@
 	};
 
+	template <typename TYPE>
+	void construct_object( void* object )
+	{
+		new (object)TYPE;
+	}
+	template <typename TYPE>
+	void destroy_object( void* object )
+	{
+		( (TYPE*)object )->TYPE::~TYPE();
+	}
 
 } // namespace nv
Index: trunk/nv/core/types.hh
===================================================================
--- trunk/nv/core/types.hh	(revision 372)
+++ trunk/nv/core/types.hh	(revision 373)
@@ -10,4 +10,5 @@
 #include <nv/stl/cstring_store.hh>
 #include <nv/stl/type_traits.hh>
+#include <nv/stl/type_info.hh>
 #include <unordered_map>
 #include <vector>
@@ -85,8 +86,8 @@
 
 		template< typename TOBJECT, typename TFIELD >
-		type_creator field( const char* aname, TFIELD TOBJECT::*field, typename std::enable_if< is_container<TFIELD>::value, void* >::type = nullptr );
+		type_creator field( const char* aname, TFIELD TOBJECT::*field, typename enable_if< is_container<TFIELD>::value, void* >::type = nullptr );
 
 		template< typename TOBJECT, typename TFIELD >
-		type_creator field( const char* aname, TFIELD TOBJECT::*field, typename std::enable_if< !is_container<TFIELD>::value, void* >::type = nullptr );
+		type_creator field( const char* aname, TFIELD TOBJECT::*field, typename enable_if< !is_container<TFIELD>::value, void* >::type = nullptr );
 
 		type_creator value( const char* name, sint32 value );
@@ -161,14 +162,14 @@
 
 	template< typename TOBJECT, typename TFIELD >
-	type_creator type_creator::field( const char* aname, TFIELD TOBJECT::*field, typename std::enable_if< is_container<TFIELD>::value, void* >::type )
+	type_creator type_creator::field( const char* aname, TFIELD TOBJECT::*field, typename enable_if< is_container<TFIELD>::value, void* >::type )
 	{
 		NV_ASSERT( m_entry->enum_list.empty(), "Type cannot have both enums and fields!" );
 		type_field f;
 		f.name = m_entry->names.insert( name );
-		f.raw_type = &typeid( typename std::remove_pointer<typename TFIELD::value_type>::type );
+		f.raw_type = &typeid( typename remove_pointer<typename TFIELD::value_type>::type );
 		f.type = type_db->get_type( *( f.raw_type ) );
 		f.flags = TF_CONTAINER |
-			( std::is_pointer<typename TFIELD::value_type>::value ? TF_POINTER : 0 ) |
-			( std::is_pod<typename TFIELD::value_type>::value ? TF_SIMPLETYPE : 0 );
+			( is_pointer<typename TFIELD::value_type>::value ? TF_POINTER : 0 ) |
+			( is_pod<typename TFIELD::value_type>::value ? TF_SIMPLETYPE : 0 );
 		f.offset = offset_of( field );
 		m_entry->field_list.push_back( f );
@@ -177,14 +178,14 @@
 
 	template< typename TOBJECT, typename TFIELD >
-	type_creator type_creator::field( const char* aname, TFIELD TOBJECT::*field, typename std::enable_if< !is_container<TFIELD>::value, void* >::type )
+	type_creator type_creator::field( const char* aname, TFIELD TOBJECT::*field, typename enable_if< !is_container<TFIELD>::value, void* >::type )
 	{
 		NV_ASSERT( m_entry->enum_list.empty(), "Type cannot have both enums and fields!" );
 		type_field f;
 		f.name = m_entry->names.insert( name );
-		f.raw_type = &typeid( typename std::remove_pointer<TFIELD>::type );
+		f.raw_type = &typeid( typename remove_pointer<TFIELD>::type );
 		f.type = type_db->get_type( *( f.raw_type ) );
 		f.flags =
-			( std::is_pointer<TFIELD>::value ? TF_POINTER : 0 ) |
-			( std::is_pod<TFIELD>::value ? TF_SIMPLETYPE : 0 );
+			( is_pointer<TFIELD>::value ? TF_POINTER : 0 ) |
+			( is_pod<TFIELD>::value ? TF_SIMPLETYPE : 0 );
 		f.offset = offset_of( field );
 		m_entry->field_list.push_back( f );
Index: trunk/nv/lua/lua_values.hh
===================================================================
--- trunk/nv/lua/lua_values.hh	(revision 372)
+++ trunk/nv/lua/lua_values.hh	(revision 373)
@@ -178,9 +178,9 @@
 			struct type_degrade
 			{
-				typedef typename std::remove_cv< typename std::remove_reference<T>::type >::type type;
-			};
-
-			template <typename T>
-			struct type_degrade< T, typename std::enable_if< std::is_floating_point< T >::value >::type >
+				typedef typename remove_cv< typename remove_reference<T>::type >::type type;
+			};
+
+			template <typename T>
+			struct type_degrade< T, typename enable_if< is_floating_point< T >::value >::type >
 			{
 				typedef lnumber type;
@@ -188,5 +188,5 @@
 
 			template <typename T>
-			struct type_degrade< T, typename std::enable_if< std::is_integral< T >::value && std::is_signed< T >::value >::type >
+			struct type_degrade< T, typename enable_if< is_integral< T >::value && is_signed< T >::value >::type >
 			{
 				typedef linteger type;
@@ -194,5 +194,5 @@
 
 			template <typename T>
-			struct type_degrade< T, typename std::enable_if< std::is_integral< T >::value && std::is_unsigned< T >::value >::type >
+			struct type_degrade< T, typename enable_if< is_integral< T >::value && is_unsigned< T >::value >::type >
 			{
 				typedef lunsigned type;
@@ -200,5 +200,5 @@
 
 			template <typename T>
-			struct type_degrade< T, typename std::enable_if< is_cstring< T >::value >::type >
+			struct type_degrade< T, typename enable_if< is_cstring< T >::value >::type >
 			{
 				typedef const char* type;
@@ -206,5 +206,5 @@
 
 			template <typename T>
-			struct type_degrade< T, typename std::enable_if< is_stdstring< T >::value >::type >
+			struct type_degrade< T, typename enable_if< is_stdstring< T >::value >::type >
 			{
 				typedef std::string type;
Index: trunk/nv/stl/string.hh
===================================================================
--- trunk/nv/stl/string.hh	(revision 372)
+++ trunk/nv/stl/string.hh	(revision 373)
@@ -27,4 +27,5 @@
 #include <fstream>
 #include <nv/core/common.hh>
+#include <nv/stl/type_traits.hh>
 #include <nv/stl/memory.hh>
 #include <nv/stl/exception.hh>
@@ -285,5 +286,5 @@
 	template< typename T >
 	struct string_length : public detail::string_length_impl <
-		typename std::remove_cv < typename std::remove_reference< T >::type >::type >
+		typename remove_cv < typename remove_reference< T >::type >::type >
 	{
 	};
@@ -291,5 +292,5 @@
 	template< typename T >
 	using string_length = detail::string_length_impl <
-		typename std::remove_cv < typename std::remove_reference< T >::type >::type >;
+		typename remove_cv < typename remove_reference< T >::type >::type >;
 #endif
 
@@ -298,6 +299,6 @@
 	struct is_cstring
 		: public integral_constant < bool,
-		is_same<       char *, typename std::decay< T >::type >::value ||
-		is_same< const char *, typename std::decay< T >::type >::value >
+		is_same<       char *, typename decay< T >::type >::value ||
+		is_same< const char *, typename decay< T >::type >::value >
 	{
 	};
@@ -306,5 +307,5 @@
 	struct is_stdstring
 		: public integral_constant < bool,
-		is_same< std::string, typename std::decay< T >::type >::value
+		is_same< std::string, typename remove_cvr< T >::type >::value
 		>
 	{
@@ -505,9 +506,9 @@
 		// Non-literal constructors
 		template< typename U >
-		inline string_ref( U str, typename std::enable_if<std::is_same<U, const char*>::value>::type* = nullptr ) : string_base( str, std::strlen( str ) ) {}
+		inline string_ref( U str, typename enable_if<is_same<U, const char*>::value>::type* = nullptr ) : string_base( str, std::strlen( str ) ) {}
 
 		// Non-literal constructors
 		template< typename U >
-		inline string_ref( U str, typename std::enable_if<std::is_same<U, char*>::value>::type* = nullptr ) : string_base( str, std::strlen( str ) ) {}
+		inline string_ref( U str, typename enable_if<is_same<U, char*>::value>::type* = nullptr ) : string_base( str, std::strlen( str ) ) {}
 
 		inline string_ref& operator=( const string_ref &rhs )
Index: trunk/nv/stl/type_traits.hh
===================================================================
--- trunk/nv/stl/type_traits.hh	(revision 372)
+++ trunk/nv/stl/type_traits.hh	(revision 373)
@@ -1,3 +1,3 @@
-// Copyright (C) 2012-2014 ChaosForge Ltd
+// Copyright (C) 2012-2015 ChaosForge Ltd
 // http://chaosforge.org/
 //
@@ -9,14 +9,12 @@
  * @brief type traits
  */
-// TODO: function_traits support only up to 4 parameters because:
-//    -- if you have more than 4 params, you're doing something wrong
-//    -- once the Variadic Templates cometh, for great justice we will win!
-
-#ifndef NV_CORE_TYPE_TRAITS_HH
-#define NV_CORE_TYPE_TRAITS_HH
+// TODO: "......" function match version?
+// TODO: remove type_traits
+// TODO: remove typeinfo?
+
+#ifndef NV_STL_TYPE_TRAITS_HH
+#define NV_STL_TYPE_TRAITS_HH
 
 #include <nv/core/common.hh>
-#include <type_traits>
-#include <typeinfo>
 
 namespace nv
@@ -29,5 +27,5 @@
 		typedef T value_type;
 		typedef integral_constant<T, VALUE> type;
-		operator value_type() const { return ( value ); }
+		NV_CONSTEXPR operator value_type() const { return ( value ); }
 	};
 
@@ -60,5 +58,14 @@
 
 	template< typename T >
-	struct is_same < T, T > : true_type{};
+	struct is_same < T, T > : true_type {};
+
+	template< typename T >
+	struct is_array : false_type {};
+
+	template< typename T, size_t N >
+	struct is_array < T[N] > : true_type {};
+
+	template< typename T >
+	struct is_array < T[] > : true_type {};
 
 	template< typename T >
@@ -76,4 +83,7 @@
 	template < typename T >
 	struct is_enum : integral_constant < bool, __is_enum( T ) > {};
+
+	template < typename T >
+	struct is_pod : integral_constant < bool, __is_pod( T ) > {};
 
 	template< typename T >
@@ -150,4 +160,64 @@
 	};
 
+	template< typename T >
+	struct remove_cvr
+	{
+		typedef typename remove_cv< typename remove_reference<T>::type >::type
+			type;
+	};
+
+	template< typename T >
+	struct remove_pointer
+	{
+		typedef T type;
+	};
+
+	template< typename T > struct remove_pointer < T* >                { typedef T type; };
+	template< typename T > struct remove_pointer < T* const >          { typedef T type; };
+	template< typename T > struct remove_pointer < T* volatile >       { typedef T type; };
+	template< typename T > struct remove_pointer < T* const volatile > { typedef T type; };
+
+	template< typename T >
+	struct remove_extent
+	{	
+		typedef T type;
+	};
+
+	template< typename T, unsigned int N >
+	struct remove_extent < T[N] >
+	{
+		typedef T type;
+	};
+
+	template< typename T >
+	struct remove_extent < T[] >
+	{
+		typedef T type;
+	};
+
+	template< typename T >
+	struct remove_all_extents
+	{
+		typedef T type;
+	};
+
+	template< typename T, unsigned int N >
+	struct remove_all_extents < T[N] >
+	{
+		typedef typename remove_all_extents<T>::type type;
+	};
+
+	template< typename T >
+	struct remove_all_extents < T[] >
+	{
+		typedef typename remove_all_extents<T>::type type;
+	};
+
+	template< typename T >
+	struct add_pointer
+	{
+		typedef typename remove_reference<T>::type *type;
+	};
+
 	namespace detail
 	{
@@ -155,11 +225,11 @@
 		// detail - research why it is so.
 		template < typename T >
-		struct is_const : public false_type {};
-		template < typename T >
-		struct is_const < T const > : public true_type {};
+		struct is_const : false_type {};
+		template < typename T >
+		struct is_const < T const > : true_type {};
 		template < typename T > 
-		struct is_volatile : public false_type {};
-		template < typename T >
-		struct is_volatile < T volatile > : public true_type {};
+		struct is_volatile : false_type {};
+		template < typename T >
+		struct is_volatile < T volatile > : true_type {};
 		// TODO END
 
@@ -186,4 +256,10 @@
 			typedef typename cv_selector< TARGET, CONST, VOLATILE >::type type;
 		};
+
+		template < typename T > 
+		struct is_void_impl : false_type{};
+
+		template <>
+		struct is_void_impl< void > : true_type {};
 
 		template< typename T > 
@@ -287,4 +363,34 @@
 	}
 
+	template <typename T> struct is_signed : false_type {};
+
+	template <> struct is_signed<signed char> : true_type {};
+	template <> struct is_signed<const signed char> : true_type {};
+	template <> struct is_signed<signed short> : true_type {};
+	template <> struct is_signed<const signed short> : true_type {};
+	template <> struct is_signed<signed int> : true_type {};
+	template <> struct is_signed<const signed int> : true_type {};
+	template <> struct is_signed<signed long> : true_type {};
+	template <> struct is_signed<const signed long> : true_type {};
+	template <> struct is_signed<sint64> : true_type {};
+	template <> struct is_signed<const sint64> : true_type{};
+
+	template <typename T> struct is_unsigned : false_type {};
+
+	template <> struct is_unsigned<unsigned char> : true_type{};
+	template <> struct is_unsigned<const unsigned char> : true_type{};
+	template <> struct is_unsigned<unsigned short> : true_type{};
+	template <> struct is_unsigned<const unsigned short> : true_type{};
+	template <> struct is_unsigned<unsigned int> : true_type{};
+	template <> struct is_unsigned<const unsigned int> : true_type{};
+	template <> struct is_unsigned<unsigned long> : true_type{};
+	template <> struct is_unsigned<const unsigned long> : true_type{};
+	template <> struct is_unsigned<uint64> : true_type{};
+	template <> struct is_unsigned<const uint64> : true_type{};
+
+	template <> struct is_signed<char> : integral_constant<bool, ( char( 0 ) > char( -1 ) ) >{};
+	template <> struct is_unsigned<char> : integral_constant<bool, ( char( 0 ) < char( -1 ) ) > {};
+
+
 	template < typename T >
 	struct make_signed
@@ -303,4 +409,8 @@
 	template <> struct make_unsigned < bool > ;
 
+	template< typename T >
+	struct is_void : detail::is_void_impl < typename remove_cv<T>::type >
+	{
+	};
 
 	template< typename T > 
@@ -311,4 +421,16 @@
 	template< typename T > 
 	struct is_floating_point : detail::is_floating_point_impl< typename remove_cv<T>::type >
+	{
+	};
+
+	template < typename T >
+	struct is_arithmetic : integral_constant < bool,
+		is_integral<T>::value || is_floating_point<T>::value >
+	{
+	};
+
+	template <typename T>
+	struct is_fundamental : integral_constant < bool,
+		is_void<T>::value || is_integral<T>::value || is_floating_point<T>::value >
 	{
 	};
@@ -377,8 +499,27 @@
 		};
 
+		template< typename T, typename IS_ENUM >
+		struct base_underlying_type_impl
+		{
+			typedef T type;
+		};
+
+		template< typename T >
+		struct base_underlying_type_impl < T, true_type >
+		{
+			typedef typename underlying_type<T>::type type;
+		};
+
+		template < typename T > struct is_pointer_impl : false_type {};
+
+		template < typename T > struct is_pointer_impl< T* > : true_type{};
+		template < typename T > struct is_pointer_impl< T* const > : true_type{};
+		template < typename T > struct is_pointer_impl< T* volatile > : true_type{};
+		template < typename T > struct is_pointer_impl< T* const volatile > : true_type{};
+
 	}
 
 	template < typename F >
-	struct function_traits : public detail::function_traits_impl< F >
+	struct function_traits : detail::function_traits_impl< F >
 	{
 
@@ -397,76 +538,73 @@
 	};
 
-	template <typename TYPE> 
-	void construct_object(void* object)
-	{
-		new (object) TYPE;
-	}
-	template <typename TYPE> 
-	void destroy_object(void* object)
-	{
-		((TYPE*)object)->TYPE::~TYPE();
-	}
-
-	template< typename T, typename IS_ENUM >
-	struct base_underlying_type_helper
-	{
-		typedef T type;
-	};
-
-	template< typename T >
-	struct base_underlying_type_helper< T, true_type >
-	{
-		typedef typename underlying_type<T>::type type;
-	};
-
-
-	template< typename T >
+	template < typename T >
 	struct base_underlying_type
 	{
-		typedef typename base_underlying_type_helper< T, typename is_enum<T>::type >::type type;
-	};
-
-	class type_index
-	{
-	public:
-		inline type_index( const std::type_info& info ) : m_type_info( &info ) {}
-		inline size_t hash_code() const { return m_type_info->hash_code(); }
-		inline const char *name() const { return m_type_info->name(); }
-
-		inline bool operator==( const type_index& rhs ) const
-		{
-			return ( *m_type_info == *rhs.m_type_info );
-		}
-
-		inline bool operator!=( const type_index& rhs ) const
-		{
-			return ( !( *this == rhs ) );
-		}
-
-		inline bool operator<( const type_index& rhs ) const
-		{
-			return ( m_type_info->before( *rhs.m_type_info ) );
-		}
-
-		inline bool operator>=( const type_index& rhs ) const
-		{
-			return ( !( *this < rhs ) );
-		}
-
-		inline bool operator>( const type_index& rhs ) const
-		{
-			return ( rhs < *this );
-		}
-
-		inline bool operator<=( const type_index& rhs ) const
-		{
-			return ( !( rhs < *this ) );
-		}
-
-	private:
-		const std::type_info* m_type_info;
+		typedef typename detail::base_underlying_type_impl< T, typename is_enum<T>::type >::type type;
+	};
+
+	template < typename F > struct is_function_pointer : false_type {};
+#if NV_COMPILER == NV_MSVC
+	template < typename R, typename... Args > struct is_function_pointer< R( __cdecl * )( Args... ) > : true_type{};
+	template < typename R, typename... Args > struct is_function_pointer< R( __stdcall * )( Args... ) > : true_type{};
+	template < typename R, typename... Args > struct is_function_pointer< R( __fastcall * )( Args... ) > : true_type{};
+	template < typename R, typename... Args > struct is_function_pointer< R( __vectorcall * )( Args... ) > : true_type{};
+#else
+	template < typename R, typename... Args > struct is_function_pointer< R( *)( Args... ) > : true_type{};
+#endif
+
+	template < typename C > struct is_member_function_pointer : false_type {};
+#if NV_COMPILER == NV_MSVC
+#define NV_IS_MEMFNPTR( call_conv ) \
+	template < typename R, typename C, typename... Args > struct is_member_function_pointer< R( call_conv C::* )( Args... ) > : true_type{}; \
+	template < typename R, typename C, typename... Args > struct is_member_function_pointer< R( call_conv C::* )( Args... ) const > : true_type{}; \
+	template < typename R, typename C, typename... Args > struct is_member_function_pointer< R( call_conv C::* )( Args... ) volatile > : true_type{}; \
+	template < typename R, typename C, typename... Args > struct is_member_function_pointer< R( call_conv C::* )( Args... ) const volatile > : true_type{};
+
+NV_IS_MEMFNPTR( __thiscall )
+NV_IS_MEMFNPTR( __cdecl )
+NV_IS_MEMFNPTR( __stdcall )
+NV_IS_MEMFNPTR( __fastcall )
+NV_IS_MEMFNPTR( __vectorcall )
+
+#undef NV_IS_MEMFNPTR
+#else
+	template < typename R, typename C, typename... Args > struct is_member_function_pointer< R( C::* )( Args... ) > : true_type{};
+	template < typename R, typename C, typename... Args > struct is_member_function_pointer< R( C::* )( Args... ) const > : true_type{};
+	template < typename R, typename C, typename... Args > struct is_member_function_pointer< R( C::* )( Args... ) volatile > : true_type{};
+	template < typename R, typename C, typename... Args > struct is_member_function_pointer< R( C::* )( Args... ) const volatile > : true_type{};
+#endif
+
+	template < typename F >	struct is_member_pointer : integral_constant < bool, is_member_function_pointer<F>::value > {};
+	template < typename C, typename R > struct is_member_pointer<R C::*> : true_type {};
+
+	template < typename T >
+	struct is_pointer : integral_constant< bool, (detail::is_pointer_impl<T>::value) && !(is_member_pointer<T>::value) > {};
+
+	template< typename T >
+	struct is_function : integral_constant< bool, is_function_pointer< typename remove_cv<T>::type *>::value > {};
+
+	template< typename T >
+	struct is_function < T& > : false_type {};
+
+	template< typename T >
+	struct is_function < T&& > : false_type {};
+
+	template< typename T >
+	struct decay
+	{
+		typedef typename remove_reference<T>::type U;
+		typedef typename conditional <
+			is_array<U>::value,
+			typename remove_extent<U>::type*,
+			typename conditional <
+				is_function<U>::value,
+				typename add_pointer<U>::type,
+				typename remove_cv<U>::type
+			> ::type
+		> ::type type;
 	};
 
 }
 
-#endif // NV_CORE_TYPE_TRAITS_HH
+#endif // NV_STL_TYPE_TRAITS_HH
Index: trunk/nv/stl/utility.hh
===================================================================
--- trunk/nv/stl/utility.hh	(revision 372)
+++ trunk/nv/stl/utility.hh	(revision 373)
@@ -15,4 +15,5 @@
 
 #include <nv/core/common.hh>
+#include <nv/stl/type_traits.hh>
 
 namespace nv
