Index: /trunk/nv/stl/algorithm/common.hh
===================================================================
--- /trunk/nv/stl/algorithm/common.hh	(revision 388)
+++ /trunk/nv/stl/algorithm/common.hh	(revision 389)
@@ -18,4 +18,5 @@
 namespace nv
 {
+
 }
 
Index: /trunk/nv/stl/algorithm/copy.hh
===================================================================
--- /trunk/nv/stl/algorithm/copy.hh	(revision 388)
+++ /trunk/nv/stl/algorithm/copy.hh	(revision 389)
@@ -16,4 +16,6 @@
 #include <nv/stl/algorithm/common.hh>
 #include <nv/stl/algorithm/raw.hh>
+#include <nv/stl/iterator.hh>
+#include <nv/stl/type_traits/common.hh>
 
 namespace nv
Index: /trunk/nv/stl/algorithm/fill.hh
===================================================================
--- /trunk/nv/stl/algorithm/fill.hh	(revision 388)
+++ /trunk/nv/stl/algorithm/fill.hh	(revision 389)
@@ -16,4 +16,6 @@
 #include <nv/stl/algorithm/common.hh>
 #include <nv/stl/algorithm/raw.hh>
+#include <nv/stl/iterator.hh>
+#include <nv/stl/type_traits/common.hh>
 
 namespace nv
Index: /trunk/nv/stl/functional/comparisons.hh
===================================================================
--- /trunk/nv/stl/functional/comparisons.hh	(revision 388)
+++ /trunk/nv/stl/functional/comparisons.hh	(revision 389)
@@ -20,7 +20,33 @@
 
 	template< typename T = void >
+	struct equal_to
+	{
+		typedef bool result_type;
+		typedef T first_argument_type;
+		typedef T second_argument_type;
+
+		constexpr bool operator() ( const T& lhs, const T& rhs ) const
+		{
+			return lhs == rhs;
+		}
+	};
+
+	template<>
+	struct equal_to< void >
+	{
+		typedef is_transparent_t is_transparent;
+
+		template < typename T1, typename T2 >
+		constexpr auto operator() ( T1&& lhs, T2&& rhs ) const
+			-> decltype( static_cast<T1&&>( lhs ) == static_cast<T2&&>( rhs ) )
+		{
+			return static_cast<T1&&>( lhs ) == static_cast<T2&&>( rhs );
+		}
+	};
+
+	template< typename T = void >
 	struct not_equal_to
 	{
-		typedef T result_type;
+		typedef bool result_type;
 		typedef T first_argument_type;
 		typedef T second_argument_type;
@@ -48,5 +74,5 @@
 	struct greater
 	{
-		typedef T result_type;
+		typedef bool result_type;
 		typedef T first_argument_type;
 		typedef T second_argument_type;
@@ -74,5 +100,5 @@
 	struct less
 	{
-		typedef T result_type;
+		typedef bool result_type;
 		typedef T first_argument_type;
 		typedef T second_argument_type;
@@ -101,5 +127,5 @@
 	struct greater_equal
 	{
-		typedef T result_type;
+		typedef bool result_type;
 		typedef T first_argument_type;
 		typedef T second_argument_type;
@@ -127,5 +153,5 @@
 	struct less_equal
 	{
-		typedef T result_type;
+		typedef bool result_type;
 		typedef T first_argument_type;
 		typedef T second_argument_type;
Index: /trunk/nv/stl/functional/invoke.hh
===================================================================
--- /trunk/nv/stl/functional/invoke.hh	(revision 389)
+++ /trunk/nv/stl/functional/invoke.hh	(revision 389)
@@ -0,0 +1,70 @@
+// Copyright (C) 2015 ChaosForge Ltd
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+/**
+* @file function.hh
+* @author Kornel Kisielewicz epyon@chaosforge.org
+* @brief function class
+*/
+
+#ifndef NV_STL_FUNCTIONAL_INVOKE_HH
+#define NV_STL_FUNCTIONAL_INVOKE_HH
+
+#include <nv/stl/functional/common.hh>
+#include <nv/stl/type_traits/common.hh>
+
+namespace nv
+{
+	namespace detail
+	{
+		template < typename F, typename... Args >
+		inline auto invoke_impl( F&& f, Args&&... args ) ->
+			decltype( forward<F>( f )( forward<Args>( args )... ) )
+		{
+			return forward<F>( f )( forward<Args>( args )... );
+		}
+
+		template < typename Base, typename T, typename Derived>
+		inline auto invoke_impl( T Base::*pmd, Derived&& ref ) ->
+			decltype( forward<Derived>( ref ).*pmd )
+		{
+			return forward<Derived>( ref ).*pmd;
+		}
+
+		template < typename PMD, typename Pointer>
+		inline auto invoke_impl( PMD pmd, Pointer&& ptr ) ->
+			decltype( ( *forward<Pointer>( ptr ) ).*pmd )
+		{
+			return ( *forward<Pointer>( ptr ) ).*pmd;
+		}
+
+		template < typename Base, typename T, typename Derived, typename... Args>
+		inline auto invoke_impl( T Base::* pmf, Derived&& ref, Args&&... args ) ->
+			decltype( ( forward<Derived>( ref ).*pmf )( forward<Args>( args )... ) )
+		{
+			return ( forward<Derived>( ref ).*pmf )( forward<Args>( args )... );
+		}
+
+		template < typename PMF, typename Pointer, typename... Args>
+		inline auto invoke_impl( PMF pmf, Pointer&& ptr, Args&&... args ) ->
+			decltype( ( ( *forward<Pointer>( ptr ) ).*pmf )( forward<Args>( args )... ) )
+		{
+			return ( ( *forward<Pointer>( ptr ) ).*pmf )( forward<Args>( args )... );
+		}
+
+	}
+
+	template< typename F, typename... Args >
+	inline auto invoke( F&& f, Args&&... args ) ->
+		decltype( detail::invoke_impl( forward<F>( f ), forward<Args>( args )... ) )
+	{
+		return detail::invoke_impl( forward<F>( f ), forward<Args>( args )... );
+	}
+
+}
+
+#endif // NV_STL_FUNCTIONAL_INVOKE_HH
+
Index: /trunk/nv/stl/functional/mem_fn.hh
===================================================================
--- /trunk/nv/stl/functional/mem_fn.hh	(revision 389)
+++ /trunk/nv/stl/functional/mem_fn.hh	(revision 389)
@@ -0,0 +1,52 @@
+// Copyright (C) 2015 ChaosForge Ltd
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+/**
+* @file reference.hh
+* @author Kornel Kisielewicz epyon@chaosforge.org
+* @brief reference_wrapper class and ref/cref
+*/
+
+#ifndef NV_STL_FUNCTIONAL_MEM_FN_HH
+#define NV_STL_FUNCTIONAL_MEM_FN_HH
+
+#include <nv/stl/functional/common.hh>
+#include <nv/stl/functional/invoke.hh>
+#include <nv/stl/type_traits/primary.hh>
+
+namespace nv
+{
+
+	namespace detail
+	{
+		template< typename MFP >
+		class mem_fn_impl
+		{
+		public:
+			explicit mem_fn_impl( MFP mfp ) noexcept : m_mfp( mfp ) {}
+
+			template < typename... Args >
+			typename result_of<MFP&( Args&&... )>::type
+				operator()( Args&&... args ) const
+			{
+				return invoke( m_mfp, forward<Args>( args )... );
+			}
+
+		private:
+			MFP m_mfp;
+		};
+	}
+
+	template< typename MFP > 
+	inline enable_if_t< is_member_pointer<MFP>::value, detail::mem_fn_impl<MFP> > 
+		mem_fn( MFP mfp ) noexcept
+	{
+		return detail::mem_fn_impl<MFP>( mfp );
+	}
+
+}
+
+#endif // NV_STL_FUNCTIONAL_MEM_FN_HH
Index: /trunk/nv/stl/functional/reference.hh
===================================================================
--- /trunk/nv/stl/functional/reference.hh	(revision 388)
+++ /trunk/nv/stl/functional/reference.hh	(revision 389)
@@ -14,5 +14,6 @@
 #define NV_STL_FUNCTIONAL_REFERENCE_HH
 
-#include <nv/core/common.hh>
+#include <nv/stl/functional/common.hh>
+#include <nv/stl/functional/invoke.hh>
 
 namespace nv
@@ -25,5 +26,5 @@
 		typedef T type;
 
-		reference_wrapper( type& ref ) noexcept : m_pointer( std::addressof( ref ) ) {}
+		reference_wrapper( type& ref ) noexcept : m_pointer( addressof( ref ) ) {}
 		reference_wrapper( type&& ) = delete;
 		reference_wrapper( const reference_wrapper& ) noexcept = default;
@@ -31,4 +32,11 @@
 		operator type& ( ) const noexcept { return *m_pointer; }
 		type& get() const noexcept { return *m_pointer; }
+
+		template< typename... Args >
+		typename result_of<T&( Args&&... )>::type
+			operator()( Args&&... args ) const
+		{
+			return ( invoke( get(), forward<Args>( args )... ) );
+		}
 	private:
 		type* m_pointer;
Index: /trunk/nv/stl/iterator.hh
===================================================================
--- /trunk/nv/stl/iterator.hh	(revision 388)
+++ /trunk/nv/stl/iterator.hh	(revision 389)
@@ -200,5 +200,5 @@
 	template < typename InputIterator >
 	inline typename iterator_traits< InputIterator >::difference_type
-	distance( InputIterator first, InputIterator last )
+		distance( InputIterator first, InputIterator last )
 	{
 		typedef typename iterator_traits< InputIterator >::iterator_category category;
@@ -206,4 +206,15 @@
 	}
 
+	// Returns 0 for input iterators, distance for others
+	// this is an extension to the standard
+	template < typename InputIterator >
+	inline typename iterator_traits< InputIterator >::difference_type
+		estimate_distance( InputIterator first, InputIterator last )
+	{
+		typedef typename iterator_traits< InputIterator >::iterator_category category;
+		return !is_same< category, input_iterator_tag >::value ? detail::distance_impl( first, last, category() ) : 0;
+	}
+
+
 	template < typename InputIterator, typename Distance >
 	inline void advance( InputIterator& iter, Distance n )
Index: /trunk/nv/stl/memory.hh
===================================================================
--- /trunk/nv/stl/memory.hh	(revision 388)
+++ /trunk/nv/stl/memory.hh	(revision 389)
@@ -25,33 +25,5 @@
 namespace nv
 {
-	namespace detail
-	{
-		template< typename T >
-		struct addressof_helper
-		{
-			T & value;
-			constexpr addressof_helper( T & v ) : value( v ) {}
-			constexpr operator T& () const { return value; }
-		private:
-			addressof_helper & operator=( const addressof_helper & );
-		};
-
-		template< typename T >
-		struct addressof_impl
-		{
-			static constexpr T * f( T & v, long )
-			{
-				return reinterpret_cast<T*>(
-					&const_cast<char&>( reinterpret_cast<const volatile char &>( v ) ) );
-			}
-			static constexpr T * f( T * v, int ) { return v; }
-		};
-	}
-
-	template< typename T >
-	T * addressof( T & v )
-	{
-		return detail::addressof_impl<T>::f( detail::addressof_helper<T>( v ), 0 );
-	}
+
 
 	namespace mem_flags
Index: /trunk/nv/stl/string.hh
===================================================================
--- /trunk/nv/stl/string.hh	(revision 388)
+++ /trunk/nv/stl/string.hh	(revision 389)
@@ -31,4 +31,12 @@
 namespace nv
 {
+
+
+// 	short_string< size_t >
+// 	string32
+// 	string64
+// 	string
+
+
 	/**
 	* Simple function for slurping a file into a string.
@@ -384,12 +392,4 @@
 NV_STRING_BASE_CAST_OPERATORS( >= )
 
-	inline std::ostream& operator<<( std::ostream& os, const string_base& str )
-	{
-		if ( os.good() )
-		{
-			os.write( str.data(), static_cast<std::streamsize>( str.size() ) );
-		}
-		return os;
-	}
 
 #undef NV_STRING_REF_CAST_OPERATORS
Index: /trunk/nv/stl/type_traits/common.hh
===================================================================
--- /trunk/nv/stl/type_traits/common.hh	(revision 388)
+++ /trunk/nv/stl/type_traits/common.hh	(revision 389)
@@ -76,4 +76,15 @@
 	// TODO END
 
+	template < typename T >	struct is_lvalue_reference : false_type {};
+	template < typename T >	struct is_lvalue_reference < T& > : true_type{};
+	template < typename T >	struct is_rvalue_reference : false_type {};
+	template < typename T >	struct is_rvalue_reference < T&& > : true_type{};
+
+	template < typename T >
+	struct is_reference : bool_constant < 
+		is_lvalue_reference<T>::value || 
+		is_rvalue_reference<T>::value 
+	> {};
+
 	// add const volatile and reference mutators
 
@@ -82,5 +93,8 @@
 	template< typename T > struct add_cv             { typedef const volatile T type; };
 	
-	template< typename T > struct add_reference             { typedef T& type; };
+	template< typename T > struct add_reference             
+	{
+		typedef typename conditional< is_reference<T>::value, T, T&& > type;
+	};
 	template<> struct add_reference < void >                { typedef void type; };
 	template<> struct add_reference < const void >          { typedef void type; };
@@ -89,4 +103,5 @@
 
 	template< typename T > struct add_rvalue_reference             { typedef T&& type; };
+	template< typename T > struct add_rvalue_reference < T& >      { typedef T   type; };
 	template<> struct add_rvalue_reference < void >                { typedef void type; };
 	template<> struct add_rvalue_reference < const void >          { typedef void type; };
@@ -160,9 +175,4 @@
 	template< typename T > using remove_all_extents_t = typename remove_all_extents<T>::type;
 
-	template < typename T >	struct is_lvalue_reference : false_type {};
-	template < typename T >	struct is_lvalue_reference < T& > : true_type{};
-	template < typename T >	struct is_rvalue_reference : false_type {};
-	template < typename T >	struct is_rvalue_reference < T&& > : true_type{};
-
 	template < typename T >
 	typename add_rvalue_reference<T>::type declval();
@@ -186,5 +196,57 @@
 		return static_cast<T&&>( t );
 	}
+
+	namespace detail
+	{
+		template< typename T >
+		struct addressof_helper
+		{
+			T & value;
+			constexpr addressof_helper( T & v ) : value( v ) {}
+			constexpr operator T& ( ) const { return value; }
+		private:
+			addressof_helper & operator=( const addressof_helper & );
+		};
+
+		template< typename T >
+		struct addressof_impl
+		{
+			static constexpr T * f( T & v, long )
+			{
+				return reinterpret_cast<T*>(
+					&const_cast<char&>( reinterpret_cast<const volatile char &>( v ) ) );
+			}
+			static constexpr T * f( T * v, int ) { return v; }
+		};
+	}
+
+	template< typename T >
+	T * addressof( T & v )
+	{
+		return detail::addressof_impl<T>::f( detail::addressof_helper<T>( v ), 0 );
+	}
+
+	namespace detail
+	{
+		struct sfinae_types
+		{
+			typedef char size_one;
+			typedef struct { char unused[2]; } size_two;
+		};
+	}
 }
 
+// see unsafe (experimental) version in type_traits experimental.hh
+#define NV_GENERATE_HAS_TYPE_SAFE( TYPE ) \
+namespace macro_detail { \
+template < typename T > class has_##TYPE##_impl : nv::detail::sfinae_types {\
+  template< typename U > struct wrap_type {}; \
+  template< typename U > static size_one test( wrap_type< typename U::TYPE >* ); \
+  template< typename U > static size_two test( ... ); \
+public:\
+  static constexpr bool value = sizeof( test<T>(0) ) == 1; \
+}; } \
+template < typename T > \
+struct has_##TYPE : nv::bool_constant< macro_detail::has_##TYPE##_impl< remove_cv_t<T> >::value > {};
+
 #endif // NV_STL_TRAITS_COMMON_HH
Index: /trunk/nv/stl/type_traits/experimental.hh
===================================================================
--- /trunk/nv/stl/type_traits/experimental.hh	(revision 389)
+++ /trunk/nv/stl/type_traits/experimental.hh	(revision 389)
@@ -0,0 +1,77 @@
+// Copyright (C) 2015 ChaosForge Ltd
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+/**
+* @file alignment.hh
+* @author Kornel Kisielewicz epyon@chaosforge.org
+* @brief type traits - experimental
+* 
+* based on http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4502.pdf
+* and http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3911.pdf
+*/
+
+#ifndef NV_STL_TYPE_TRAITS_EXPERIMENTAL_HH
+#define NV_STL_TYPE_TRAITS_EXPERIMENTAL_HH
+
+#include <nv/core/common.hh>
+#include <nv/stl/type_traits/common.hh>
+
+namespace nv
+{
+
+#if NV_COMPILER == NV_MSVC
+	// preferred form
+	template< typename... > using void_t = void;
+#else
+	template< typename... > struct void_acceptor { using type = void; };
+	template< typename... T > using void_t = typename void_acceptor<T...>::type;
+#endif
+
+#if NV_COMPILER == NV_MSVC
+	template< bool B >
+	struct match_ptr { typedef int type; };
+	template< bool B >
+	using match_ptr_t = typename match_ptr<B>::type;
+#endif
+}
+
+#define NV_GENERATE_HAS_TYPE( TYPE ) \
+template< typename, typename = nv::void_t<> > struct has_##TYPE : nv::false_type {}; \
+template< typename T > struct has_##TYPE <T, nv::void_t<typename T::TYPE > > : true_type{};
+
+#if NV_COMPILER == NV_MSVC
+#define NV_GENERATE_HAS_MEMBER( MEMBER ) \
+template< typename, typename = nv::void_t<> > struct has_##MEMBER##_member : nv::false_type {}; \
+template< typename T > struct has_##MEMBER##_member <T, nv::void_t< nv::match_ptr_t< &T::MEMBER > > > : true_type{};
+#else
+#define NV_GENERATE_HAS_MEMBER( MEMBER ) \
+template< typename, typename = nv::void_t<> > struct has_##MEMBER##_member : nv::false_type {}; \
+template< typename T > struct has_##MEMBER##_member <T, nv::void_t< decltype( T::MEMBER ) > > : true_type{};
+#endif
+
+namespace nv
+{
+	namespace 
+	{
+		struct with_type
+		{
+			typedef int test;
+		};
+
+		struct with_member
+		{
+			int test;
+		};
+		NV_GENERATE_HAS_TYPE( test )
+		NV_GENERATE_HAS_MEMBER( test )
+
+		static_assert( has_test< with_type >::value          == true,  "NV_GENERATE_HAS_TYPE not working (detect fail)!" );
+		static_assert( has_test< with_member >::value        == false, "NV_GENERATE_HAS_TYPE not working (false positive)!" );
+		static_assert( has_test_member< with_type >::value   == false, "NV_GENERATE_HAS_MEMBER not working! (false positive)!" );
+		static_assert( has_test_member< with_member >::value == true,  "NV_GENERATE_HAS_MEMBER not working! (detect fail)!" );
+	}
+}
+
+#endif // NV_STL_TYPE_TRAITS_EXPERIMENTAL_HH
Index: /trunk/nv/stl/type_traits/function.hh
===================================================================
--- /trunk/nv/stl/type_traits/function.hh	(revision 388)
+++ /trunk/nv/stl/type_traits/function.hh	(revision 389)
@@ -89,4 +89,70 @@
 	using memfn_class_type_t = typename memfn_class_type<T>::type;
 
+	// Substitute with the solution in type_traits/experimental.hh once
+	// that one is confirmed safe
+	NV_GENERATE_HAS_TYPE_SAFE( result_type )
+
+	namespace detail
+	{
+		template < bool Exists, typename T > struct extract_result_type {};
+		template < typename T >
+		struct extract_result_type< true, T >
+		{
+			typedef typename T::result_type result_type;
+		};
+
+		template < typename T >
+		struct weak_result_type_impl : extract_result_type< has_result_type<T>::value, T > {};
+
+// TODO: see if const volatile are needed under MSVC - we remove them after all
+#if NV_COMPILER == NV_MSVC 
+#define NV_EMIT_WEAK_RESULT_TYPE_CALLDECL( CALLDECL ) \
+		template < typename R, typename... Args > struct weak_result_type_impl< R CALLDECL( Args... ) > { typedef R result_type; }; \
+		template < typename R, typename... Args > struct weak_result_type_impl< R( CALLDECL & )( Args... ) > { typedef R result_type; }; \
+		template < typename R, typename... Args > struct weak_result_type_impl< R( CALLDECL * )( Args... ) > { typedef R result_type; }; \
+		template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( CALLDECL C::* )( Args... ) > { typedef R result_type; }; \
+		template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( CALLDECL C::* )( Args... ) const > { typedef R result_type; }; \
+		template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( CALLDECL C::* )( Args... ) volatile > { typedef R result_type; }; \
+		template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( CALLDECL C::* )( Args... ) const volatile > { typedef R result_type; };
+
+NV_EMIT_WEAK_RESULT_TYPE_CALLDECL( __cdecl )
+NV_EMIT_WEAK_RESULT_TYPE_CALLDECL( __fastcall )
+NV_EMIT_WEAK_RESULT_TYPE_CALLDECL( __vectorcall )
+#	if NV_ARCHITECTURE == NV_32BIT
+NV_EMIT_WEAK_RESULT_TYPE_CALLDECL( __stdcall )
+template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( __thiscall C::* )( Args... ) > { typedef R result_type; };
+template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( __thiscall C::* )( Args... ) const > { typedef R result_type; }; \
+template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( __thiscall C::* )( Args... ) volatile > { typedef R result_type; }; \
+template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( __thiscall C::* )( Args... ) const volatile > { typedef R result_type; };
+#	endif
+#undef NV_EMIT_WEAK_RESULT_TYPE_CALLDECL
+#else
+		template < typename R, typename... Args > struct weak_result_type_impl< R( Args... ) > { typedef R result_type; };
+		template < typename R, typename... Args > struct weak_result_type_impl< R( Args...... ) > { typedef R result_type; };
+		template < typename R, typename... Args > struct weak_result_type_impl< R( Args... ) const > { typedef R result_type; };
+		template < typename R, typename... Args > struct weak_result_type_impl< R( Args...... ) const > { typedef R result_type; };
+		template < typename R, typename... Args > struct weak_result_type_impl< R( Args... ) volatile > { typedef R result_type; };
+		template < typename R, typename... Args > struct weak_result_type_impl< R( Args...... ) volatile > { typedef R result_type; };
+		template < typename R, typename... Args > struct weak_result_type_impl< R( Args... ) const volatile > { typedef R result_type; };
+		template < typename R, typename... Args > struct weak_result_type_impl< R( Args...... ) const volatile > { typedef R result_type; };
+		template < typename R, typename... Args > struct weak_result_type_impl< R( & )( Args... ) > { typedef R result_type; };
+		template < typename R, typename... Args > struct weak_result_type_impl< R( & )( Args...... ) > { typedef R result_type; };
+		template < typename R, typename... Args > struct weak_result_type_impl< R( * )( Args... ) > { typedef R result_type; };
+		template < typename R, typename... Args > struct weak_result_type_impl< R( * )( Args...... ) > { typedef R result_type; };
+		template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( C::* )( Args... ) > { typedef R result_type; };
+		template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( C::* )( Args...... ) > { typedef R result_type; };
+		template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( C::* )( Args... ) const > { typedef R result_type; };
+		template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( C::* )( Args...... ) const > { typedef R result_type; };
+		template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( C::* )( Args... ) volatile > { typedef R result_type; };
+		template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( C::* )( Args...... ) volatile > { typedef R result_type; };
+		template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( C::* )( Args... ) const volatile > { typedef R result_type; };
+		template < typename R, typename C, typename... Args > struct weak_result_type_impl< R( C::* )( Args...... ) const volatile > { typedef R result_type; };
+#endif
+	}
+
+	template < typename T >
+	struct weak_result_type : detail::weak_result_type_impl< remove_cv_t< T > > {};
+
+
 }
 
Index: /trunk/nv/stl/type_traits/primary.hh
===================================================================
--- /trunk/nv/stl/type_traits/primary.hh	(revision 388)
+++ /trunk/nv/stl/type_traits/primary.hh	(revision 389)
@@ -97,6 +97,6 @@
 	template < typename F >
 	struct is_member_pointer : bool_constant < is_member_function_pointer<F>::value > {};
-	template < typename C, typename R >
-	struct is_member_pointer<R C::*> : true_type{};
+	template < typename C, typename F >
+	struct is_member_pointer<F C::*> : true_type{};
 
 	// TODO: check if member functions can actually match under any compiler
Index: /trunk/nv/stl/type_traits/properties.hh
===================================================================
--- /trunk/nv/stl/type_traits/properties.hh	(revision 388)
+++ /trunk/nv/stl/type_traits/properties.hh	(revision 389)
@@ -52,11 +52,4 @@
 	template < typename T >
 	struct is_compound : bool_constant < !is_fundamental< T >::value > {};
-
-	template < typename T >
-	struct is_reference : bool_constant < 
-		is_lvalue_reference<T>::value || 
-		is_rvalue_reference<T>::value 
-	> {};
-
 
 	// TODO : confirm conformance
Index: /trunk/nv/stl/type_traits/transforms.hh
===================================================================
--- /trunk/nv/stl/type_traits/transforms.hh	(revision 388)
+++ /trunk/nv/stl/type_traits/transforms.hh	(revision 389)
@@ -14,4 +14,5 @@
 
 #include <nv/core/common.hh>
+#include <nv/stl/functional/invoke.hh>
 #include <nv/stl/type_traits/common.hh>
 #include <nv/stl/type_traits/primary.hh>
@@ -238,66 +239,32 @@
 	using common_type_t = typename common_type<Types...>::type;
 
-	namespace detail
-	{
-
-		template < typename F, typename... Args >
-		inline auto result_call( F&& f, Args&&... args )
-			-> decltype( forward<F>( f )( forward<Args>( args )... ) )
-		{
-			return forward<F>( f )( forward<Args>( args )... );
-		}
-
-		template < typename Base, typename T, typename Derived >
-		inline auto result_call( T Base::*pmd, Derived&& ref )
-			-> decltype( forward<Derived>( ref ).*pmd )
-		{
-			return forward<Derived>( ref ).*pmd;
-		}
-
-		template < typename PMD, typename Pointer >
-		inline auto result_call( PMD&& pmd, Pointer&& ptr )
-			-> decltype( ( *forward<Pointer>( ptr ) ).*forward<PMD>( pmd ) )
-		{
-			return ( *forward<Pointer>( ptr ) ).*forward<PMD>( pmd );
-		}
-
-		template < typename Base, typename T, typename Derived, typename... Args >
-		inline auto result_call( T Base::*pmf, Derived&& ref, Args&&... args )
-			-> decltype( ( forward<Derived>( ref ).*pmf )( forward<Args>( args )... ) )
-		{
-			return ( forward<Derived>( ref ).*pmf )( forward<Args>( args )... );
-		}
-
-		template < typename PMF, typename Pointer, typename... Args >
-		inline auto result_call( PMF&& pmf, Pointer&& ptr, Args&&... args )
-			-> decltype( ( ( *forward<Pointer>( ptr ) ).*forward<PMF>( pmf ) )( forward<Args>( args )... ) )
-		{
-			return ( ( *forward<Pointer>( ptr ) ).*forward<PMF>( pmf ) )( forward<Args>( args )... );
-		}
-
-		// TODO: fix this once compiler takes it
-		// 		template < typename, typename = void >
-		// 		struct result_of_impl {};
-		// 
-		// 		template < typename F, typename...Args >
-		// 		struct result_of_impl < F( Args... ),
-		// 			decltype( void( result_call( declval_i<F>(), declval_i<Args>()... ) ) ) >
-		// 		{
-		// 			using type = decltype( result_call( declval_i<F>(), declval_i<Args>()... ) );
-		// 		};
-
-		template < typename > struct result_of_impl;
-		template < typename F, typename... Args >
-		struct result_of_impl < F( Args... ) >
-		{
-			using type = decltype( result_call( declval<F>(), declval<Args>()... ) );
-		};
-	}
-
-	template < typename T >
-	struct result_of : detail::result_of_impl < T > {};
+	template < typename T >
+	struct result_of
+	{
+		static_assert( static_assert_fail<T>::value, "Failed to get result_of!" );
+	};
+
+
+#if NV_COMPILER == NV_MSVC
+	template < typename F, typename... Args >
+	struct result_of < F __cdecl ( Args... ) > { typedef decltype( invoke( declval<F>(), declval<Args>()... ) ) type; };
+	template < typename F, typename... Args >
+	struct result_of < F __fastcall ( Args... ) > { typedef decltype( invoke( declval<F>(), declval<Args>()... ) ) type; };
+	template < typename F, typename... Args >
+	struct result_of < F __vectorcall ( Args... ) > { typedef decltype( invoke( declval<F>(), declval<Args>()... ) ) type; };
+#if NV_ARCHITECTURE == NV_32BIT
+	template < typename F, typename... Args >
+	struct result_of < F __stdcall ( Args... ) > { typedef decltype( invoke( declval<F>(), declval<Args>()... ) ) type; };
+#endif
+#else
+	template < typename F, typename... Args >
+	struct result_of < F( Args... ) > { typedef decltype( invoke( declval<T>(), declval<Args>()... ) ) type; };
+#endif
+
 
 	template < typename T >
 	using result_of_t = typename result_of<T>::type;
+
+
 }
 
Index: /trunk/nv/stl/utility.hh
===================================================================
--- /trunk/nv/stl/utility.hh	(revision 388)
+++ /trunk/nv/stl/utility.hh	(revision 389)
@@ -16,4 +16,5 @@
 #include <nv/stl/utility/common.hh>
 #include <nv/stl/utility/pair.hh>
+#include <nv/stl/utility/make_pair.hh>
 
 #endif // NV_STL_UTILITY_HH
Index: /trunk/nv/stl/utility/pair.hh
===================================================================
--- /trunk/nv/stl/utility/pair.hh	(revision 388)
+++ /trunk/nv/stl/utility/pair.hh	(revision 389)
@@ -28,7 +28,11 @@
 		constexpr pair() : first(), second() {}
 		constexpr pair( const T1& f, const T2& s )
-			: first( f ), second( s )
+			: first( f ), second( s ) {}
+		// TODO: this is non-standard, and I dont like it,
+		// but is used in hash_table. Remove?
+		constexpr pair( const T1& f )
+			: first( f ), second() {}
 
-			pair( const pair& ) = default;
+		pair( const pair& ) = default;
 		pair( pair&& ) = default;
 
Index: /trunk/src/formats/md3_loader.cc
===================================================================
--- /trunk/src/formats/md3_loader.cc	(revision 388)
+++ /trunk/src/formats/md3_loader.cc	(revision 389)
@@ -8,5 +8,4 @@
 
 #include "nv/core/logging.hh"
-#include <cstring>
 
 using namespace nv;
