Index: /trunk/nv/base/common.hh
===================================================================
--- /trunk/nv/base/common.hh	(revision 400)
+++ /trunk/nv/base/common.hh	(revision 401)
@@ -131,19 +131,15 @@
 #if NV_COMPILER == NV_MSVC
 #define NV_DEPRECATED(func) __declspec(deprecated) func
-#define NV_ALIGN(value) __declspec(align(value))
-#define NV_ALIGNED_STRUCT(value) __declspec(align(value)) struct
 #define NV_NOALIAS __declspec(noalias)
 #define NV_RESTRICT __declspec(restrict)
 #define NV_RESTRICT_VAR __restrict
+#define NV_MSVC_SUPRESS( warn_number ) __pragma( warning( suppress : warn_number ) )
 #if NV_ARCHITECTURE == NV_64BIT
 #define NV_OFFSET_OF(obj,m) (nv::size_t)( (nv::ptrdiff_t)&reinterpret_cast<const volatile char&>((((obj *)0)->m)) )
 #else // NV_32BIT
 #define NV_OFFSET_OF(obj,m) (nv::size_t)&reinterpret_cast<const volatile char&>((((obj *)0)->m))
-#define NV_MSVC_SUPRESS( warn_number ) __pragma( warning( suppress : warn_number ) )
 #endif  
 #elif NV_COMPILER == NV_GNUC || NV_COMPILER == NV_CLANG
 #define NV_DEPRECATED(func) func __attribute__ ((deprecated))
-#define NV_ALIGN(value) __attribute__((aligned(value)))
-#define NV_ALIGNED_STRUCT(value) struct __attribute__((aligned(value)))
 #define NV_RESTRICT __restrict__
 #define NV_RESTRICT_VAR __restrict__
@@ -201,5 +197,5 @@
 	using ::size_t;
 #else
-	using size_t    = decltype( 0 );
+	using size_t    = decltype( sizeof(0) );
 #endif
 	using ptrdiff_t = decltype((int*)0 - (int*)0);
@@ -271,4 +267,6 @@
 } // namespace nv
 
+static_assert( nv::size_t( -1 ) > 0,      "size_t is signed!" );
+static_assert( sizeof( nv::size_t ) >= 4, "size_t is smaller than 4 bytes!" );
 static_assert( sizeof( nv::sint8 ) == 1, "sint8 size isn't 1 bytes" );
 static_assert( sizeof( nv::sint16 ) == 2, "sint16 size isn't 2 bytes" );
Index: /trunk/nv/base/new.hh
===================================================================
--- /trunk/nv/base/new.hh	(revision 400)
+++ /trunk/nv/base/new.hh	(revision 401)
@@ -23,4 +23,6 @@
 }
 #endif
+#else
+#include <new>
 #endif
 
Index: /trunk/nv/common.hh
===================================================================
--- /trunk/nv/common.hh	(revision 400)
+++ /trunk/nv/common.hh	(revision 401)
@@ -10,3 +10,3 @@
 #include <nv/base/common.hh>
 
-#endif NV_COMMON_HH
+#endif // NV_COMMON_HH
Index: /trunk/nv/gfx/animation.hh
===================================================================
--- /trunk/nv/gfx/animation.hh	(revision 400)
+++ /trunk/nv/gfx/animation.hh	(revision 401)
@@ -60,5 +60,5 @@
 			uint32 mod        = 0;
 			if ( desc.slots[0].vslot == animation_slot::TIME ) mod = 1;
-			std::copy_n( fdata + mod, keyfsize - mod, result );
+			raw_copy_n( fdata + mod, keyfsize - mod, result );
 			return keyfsize - mod;
 		}
@@ -82,5 +82,5 @@
 				if ( count == 1 ) 
 				{
-					std::copy_n( fdata + 1, keyfresult, result );
+					raw_copy_n( fdata + 1, keyfresult, result );
 					return keyfresult;
 				}
@@ -100,5 +100,5 @@
 				if ( count == 1 ) 
 				{
-					std::copy_n( fdata, keyfresult, result );
+					raw_copy_n( fdata, keyfresult, result );
 					return keyfresult;
 				}
Index: /trunk/nv/stl/algorithm/copy.hh
===================================================================
--- /trunk/nv/stl/algorithm/copy.hh	(revision 400)
+++ /trunk/nv/stl/algorithm/copy.hh	(revision 401)
@@ -17,5 +17,5 @@
 #include <nv/stl/algorithm/raw.hh>
 #include <nv/stl/iterator.hh>
-#include <nv/stl/type_traits/common.hh>
+#include <nv/stl/type_traits/properties.hh>
 
 namespace nv
@@ -35,5 +35,5 @@
 		inline BlockAccessIterator copy_impl( BlockAccessIterator first, BlockAccessIterator last, OutputIterator out, true_type, block_access_iterator_tag, block_access_iterator_tag )
 		{
-			return raw_alias_copy( first, last, out )
+			return raw_alias_copy( first, last, out );
 		}
 
@@ -48,5 +48,5 @@
 		inline BlockAccessIterator copy_n_impl( BlockAccessIterator first, BlockAccessIterator n, OutputIterator out, true_type, block_access_iterator_tag, block_access_iterator_tag )
 		{
-			return raw_alias_copy_n( first, n, out )
+			return raw_alias_copy_n( first, n, out );
 		}
 	}
@@ -59,5 +59,5 @@
 		typedef typename iterator_traits< OutputIterator >::iterator_category output_iterator_category;
 		return detail::copy_impl( first, last, out,
-			has_trivial_copy<value_type>::value, iterator_category(), output_iterator_category() );
+			has_trivial_copy<value_type>::value, input_iterator_category(), output_iterator_category() );
 	}
 
@@ -69,5 +69,5 @@
 		typedef typename iterator_traits< OutputIterator >::iterator_category output_iterator_category;
 		return detail::copy_n_impl( first, n, out,
-			has_trivial_copy<value_type>::value, iterator_category(), output_iterator_category() );
+			has_trivial_copy<value_type>::value, input_iterator_category(), output_iterator_category() );
 	}
 
Index: /trunk/nv/stl/algorithm/fill.hh
===================================================================
--- /trunk/nv/stl/algorithm/fill.hh	(revision 400)
+++ /trunk/nv/stl/algorithm/fill.hh	(revision 401)
@@ -70,5 +70,5 @@
 		{
 			// TODO: version with T temp = T() for scalars
-			for ( ; n-- > 0; ++first ) *first = value;
+			for ( ; n-- > 0; ++first ) *first = T();
 			return first;
 		}
@@ -77,5 +77,5 @@
 		BlockAccessIterator fill_default_n_impl( BlockAccessIterator first, size_t count, true_type, block_access_iterator_tag )
 		{
-			return BlockAccessIterator( raw_zero_n( first, count, (unsigned char)value ) );
+			return BlockAccessIterator( raw_zero_n( first, count ) );
 		}
 	}
Index: /trunk/nv/stl/container/contiguous_storage.hh
===================================================================
--- /trunk/nv/stl/container/contiguous_storage.hh	(revision 400)
+++ /trunk/nv/stl/container/contiguous_storage.hh	(revision 401)
@@ -49,6 +49,5 @@
 		~static_storage() = default;
 	protected:
-		typedef aligned_array_t<T, N, alignof( T ) > storage_type;
-		storage_type m_data;
+		alignas( T ) unsigned char m_data[ N * sizeof( N ) ];
 	};
 	
Index: /trunk/nv/stl/container/contiguous_storage_policy.hh
===================================================================
--- /trunk/nv/stl/container/contiguous_storage_policy.hh	(revision 400)
+++ /trunk/nv/stl/container/contiguous_storage_policy.hh	(revision 401)
@@ -63,5 +63,5 @@
 		~resizable_storage()
 		{
-			if ( m_size > 0 ) reallocate( 0, false );
+			if ( m_size > 0 ) Storage::reallocate( 0, false );
 		}
 		static constexpr size_type max_size() { return size_type( 0x80000000 ); }
@@ -85,5 +85,5 @@
 		{
 			m_size = other.m_size;
-			Storage::operator=( nv::move( o ) );
+			Storage::operator=( nv::move( other ) );
 			other.m_size = 0;
 			return *this;
@@ -95,5 +95,5 @@
 			if ( new_size != m_size )
 			{
-				if ( reallocate( new_size, copy_needed ) )
+				if ( Storage::reallocate( new_size, copy_needed ) )
 				{
 					m_size = new_size;
@@ -132,5 +132,5 @@
 		~growable_storage()
 		{
-			if ( m_capacity > 0 ) reallocate( 0, false );
+			if ( m_capacity > 0 ) Storage::reallocate( 0, false );
 		}
 		static constexpr size_type max_size() { return size_type( 0x80000000 ); }
@@ -169,5 +169,5 @@
 			{
 				size_type new_capacity = NextCapacity::get( new_size - m_capacity, m_capacity, max_size() );
-				if ( new_capacity > 0 && reallocate( new_capacity, true ) )
+				if ( new_capacity > 0 && Storage::reallocate( new_capacity, true ) )
 				{
 					m_capacity = new_capacity;
@@ -184,5 +184,5 @@
 			if ( new_capacity > m_capacity )
 			{
-				if ( reallocate( new_capacity, copy_needed ) )
+				if ( Storage::reallocate( new_capacity, copy_needed ) )
 				{
 					m_capacity = new_capacity;
Index: /trunk/nv/stl/container/fixed_container_handler.hh
===================================================================
--- /trunk/nv/stl/container/fixed_container_handler.hh	(revision 400)
+++ /trunk/nv/stl/container/fixed_container_handler.hh	(revision 401)
@@ -32,20 +32,20 @@
 		fixed_container_handler()
 		{
-			InitializePolicy::initialize( data(), data() + Storage::capacity() );
+			InitializePolicy::initialize( Storage::data(), Storage::data() + Storage::capacity() );
 		}
 
 		explicit fixed_container_handler( default_init )
 		{
-			uninitialized_construct( data(), data() + Storage::capacity() );
+			uninitialized_construct( Storage::data(), Storage::data() + Storage::capacity() );
 		}
 
 		explicit fixed_container_handler( const value_type& v )
 		{
-			uninitialized_fill( data(), data() + Storage::capacity(), v );
+			uninitialized_fill( Storage::data(), Storage::data() + Storage::capacity(), v );
 		}
 
 		~fixed_container_handler()
 		{
-			InitializePolicy::destroy( data(), data() + Storage::capacity() );
+			InitializePolicy::destroy( Storage::data(), Storage::data() + Storage::capacity() );
 		}
 
Index: /trunk/nv/stl/container/growing_container_handler.hh
===================================================================
--- /trunk/nv/stl/container/growing_container_handler.hh	(revision 400)
+++ /trunk/nv/stl/container/growing_container_handler.hh	(revision 401)
@@ -27,5 +27,4 @@
 	class growing_container_handler : public sized_container_handler< Storage, InitializePolicy >
 	{
-		typedef sized_container_handler< Storage, InitializePolicy > inherited;
 	public:
 		typedef typename Storage::value_type value_type;
@@ -40,18 +39,18 @@
 		void push_back( const value_type& e )
 		{
-			if ( Storage::try_grow( 1 ) ) copy_construct_object( data() + size() - 1, e );
+			if ( Storage::try_grow( 1 ) ) copy_construct_object( Storage::data() + Storage::size() - 1, e );
 		}
 		void push_back( value_type&& e )
 		{
-			if ( Storage::try_grow( 1 ) ) move_construct_object( data() + size() - 1, forward<value_type>( e ) );
+			if ( Storage::try_grow( 1 ) ) move_construct_object( Storage::data() + Storage::size() - 1, forward<value_type>( e ) );
 		}
 		template < typename... Args >
 		void emplace_back( Args&&... args )
 		{
-			if ( Storage::try_grow( 1 ) ) construct_object( data() + size() - 1, forward<Args>( args )... );
+			if ( Storage::try_grow( 1 ) ) construct_object( Storage::data() + Storage::size() - 1, forward<Args>( args )... );
 		}
 		void pop_back()
 		{
-			try_resize( size() - 1, true );
+			Storage::try_resize( Storage::size() - 1, true );
 		}
 
Index: /trunk/nv/stl/container/hash_table.hh
===================================================================
--- /trunk/nv/stl/container/hash_table.hh	(revision 400)
+++ /trunk/nv/stl/container/hash_table.hh	(revision 401)
@@ -33,8 +33,8 @@
 	{
 	public:
-		typedef HashEntryPolicy base_type;
-		typedef typename base_type::value_type     value_type;
-		typedef typename base_type::entry_type     entry_type;
-		typedef typename base_type::hash_type      hash_type;
+		typedef HashEntryPolicy                base_type;
+		typedef typename base_type::value_type value_type;
+		typedef typename base_type::entry_type entry_type;
+		typedef typename base_type::hash_type  hash_type;
 
 		struct node_type : entry_type
@@ -72,10 +72,10 @@
 			typedef iterator_base< IsConst > base_type;
 
-			constexpr node_iterator() : iterator_base( nullptr ) {}
-			constexpr node_iterator( const node_iterator& it ) : iterator_base( it.m_node ) {}
+			constexpr node_iterator() : base_type( nullptr ) {}
+			constexpr node_iterator( const node_iterator& it ) : base_type( it.m_node ) {}
 
 			template < bool B, typename = enable_if_t< IsConst && !B > >
 			constexpr node_iterator( const node_iterator< B >& it )
-				: iterator_base( it.m_node )
+				: base_type( it.m_node )
 			{
 			}
@@ -87,5 +87,5 @@
 			friend constexpr bool operator!=( const node_iterator& lhs, const node_iterator& rhs ) { return lhs.m_node != rhs.m_node; }
 		protected:
-			constexpr explicit node_iterator( node_type* node ) : iterator_base( node ) {}
+			constexpr explicit node_iterator( node_type* node ) : base_type( node ) {}
 
 			template < typename T1, typename T2, typename T3 >
@@ -93,5 +93,5 @@
 			template < bool B > friend struct node_iterator;
 
-			inline void increment() { m_node = m_node->next; }
+			inline void increment() { base_type::m_node = base_type::m_node->next; }
 
 		};
@@ -103,9 +103,9 @@
 
 			constexpr table_iterator()
-				: iterator_base(), m_bucket( nullptr )
+				: base_type(), m_bucket( nullptr )
 			{
 			}
 			constexpr table_iterator( const table_iterator& other )
-				: iterator_base( other ), m_bucket( other.m_bucket )
+				: base_type( other ), m_bucket( other.m_bucket )
 			{
 			}
@@ -113,10 +113,10 @@
 			template < bool B, typename = enable_if_t< IsConst && !B > >
 			constexpr table_iterator( const table_iterator< B >& it )
-				: iterator_base( it.m_node ), m_bucket( it.m_bucket )
+				: base_type( it.m_node ), m_bucket( it.m_bucket )
 			{
 			}
 
 			table_iterator& operator++() { increment(); return *this; }
-			table_iterator operator++( int ) { bucket_iterator temp( *this ); increment(); return temp; }
+			table_iterator operator++( int ) { table_iterator temp( *this ); increment(); return temp; }
 
 			friend constexpr bool operator==( const table_iterator& lhs, const table_iterator& rhs ) { return lhs.m_node == rhs.m_node; }
@@ -128,9 +128,9 @@
 
 			constexpr table_iterator( node_type* node, node_type** bucket )
-				: iterator_base( node ), m_bucket( bucket )
+				: base_type( node ), m_bucket( bucket )
 			{
 			}
 			constexpr explicit table_iterator( node_type** bucket )
-				: iterator_base( *bucket ), m_bucket( bucket )
+				: base_type( *bucket ), m_bucket( bucket )
 			{
 			}
@@ -140,11 +140,11 @@
 				++m_bucket;
 				while ( *m_bucket == nullptr ) ++m_bucket; // Sentinel guarantees end
-				m_node = *m_bucket;
+				base_type::m_node = *m_bucket;
 			}
 
 			void increment()
 			{
-				m_node = m_node->next;
-				while ( m_node == nullptr ) m_node = *++m_bucket; // Sentinel guarantees end
+				base_type::m_node = base_type::m_node->next;
+				while ( base_type::m_node == nullptr ) base_type::m_node = *++m_bucket; // Sentinel guarantees end
 			}
 			node_type** m_bucket;
@@ -338,5 +338,5 @@
 		size_type bucket_index( hash_type hash_code, size_t b_count ) const
 		{
-			return RangeHashPolicy::get<hash_type>( hash_code, b_count );
+			return RangeHashPolicy::template get<hash_type>( hash_code, b_count );
 		}
 		node_type** allocate_buckets( size_type new_count )
@@ -408,4 +408,6 @@
 		typedef value_type&                        reference;
 		typedef const value_type&                  const_reference;
+		typedef value_type*                        pointer;
+		typedef const value_type*                  const_pointer;
 
 		typedef typename base_type::local_iterator       local_iterator;
@@ -519,5 +521,5 @@
 				++first;
 			}
-			return base_type::unconst( cend() );
+			return base_type::unconst( this->cend() );
 		}
 
Index: /trunk/nv/stl/container/hash_table_policy.hh
===================================================================
--- /trunk/nv/stl/container/hash_table_policy.hh	(revision 400)
+++ /trunk/nv/stl/container/hash_table_policy.hh	(revision 401)
@@ -193,24 +193,24 @@
 		};
 
-		constexpr bool entry_compare( const entry_type* entry, const key_type& key, hash_type )
+		constexpr bool entry_compare( const entry_type* entry, const key_type& key, hash_type ) const
 		{
 			return base_type::compare( entry->value.first, key );
 		}
 
-		constexpr bool entry_compare( const entry_type* entry, const value_type& value, hash_type )
+		constexpr bool entry_compare( const entry_type* entry, const value_type& value, hash_type ) const
 		{
 			return base_type::compare( entry->value.first, value.first );
 		}
 
-		inline void entry_construct( entry_type* entry, const value_type& value, hash_type )
+		inline void entry_construct( entry_type* entry, const value_type& value, hash_type ) const
 		{
 			copy_construct_object( &(entry->value), value );
 		}
 
-		constexpr hash_type get_entry_hash( const entry_type* entry )
+		constexpr hash_type get_entry_hash( const entry_type* entry ) const
 		{
 			return base_type::get_hash( entry->value.first );
 		}
-		constexpr hash_type get_value_hash( const value_type& value )
+		constexpr hash_type get_value_hash( const value_type& value ) const
 		{
 			return base_type::get_hash( value.first );
@@ -239,25 +239,25 @@
 		};
 
-		constexpr bool entry_compare( const entry_type* entry, const key_type& key, hash_type h )
+		constexpr bool entry_compare( const entry_type* entry, const key_type& key, hash_type h ) const
 		{
 			return entry->hash_code == h && base_type::compare( entry->value.first, key );
 		}
-		constexpr bool entry_compare( const entry_type* entry, const value_type& value, hash_type h )
+		constexpr bool entry_compare( const entry_type* entry, const value_type& value, hash_type h ) const
 		{
 			return entry->hash_code == h &&  base_type::compare( entry->value.first, value.first );
 		}
 
-		constexpr hash_type get_entry_hash( const entry_type* entry )
+		constexpr hash_type get_entry_hash( const entry_type* entry ) const
 		{
 			return entry->hash_code;
 		}
-		constexpr hash_type get_value_hash( const value_type& value )
+		constexpr hash_type get_value_hash( const value_type& value ) const
 		{
 			return base_type::get_hash( value.first );
 		}
-		inline void construct( entry_type* entry, const value_type& value, hash_type hash_code )
+		inline void construct( entry_type* entry, const value_type& value, hash_type hash_code ) const
 		{
 			copy_construct_object( &(entry->value), value );
-			entry.hash_code = hash_code;
+			entry->hash_code = hash_code;
 		}
 	};
Index: /trunk/nv/stl/container/initialize_policy.hh
===================================================================
--- /trunk/nv/stl/container/initialize_policy.hh	(revision 400)
+++ /trunk/nv/stl/container/initialize_policy.hh	(revision 401)
@@ -58,5 +58,5 @@
 		inline static ForwardIterator copy( InputIterator first, InputIterator last, ForwardIterator out )
 		{
-			return detail::uninitialized_copy( first, last, out, true_type );
+			return detail::uninitialized_copy_impl( first, last, out, true_type() );
 		}
 		template < typename ForwardIterator >
Index: /trunk/nv/stl/container/sized_container_handler.hh
===================================================================
--- /trunk/nv/stl/container/sized_container_handler.hh	(revision 400)
+++ /trunk/nv/stl/container/sized_container_handler.hh	(revision 401)
@@ -78,6 +78,8 @@
 		inline void assign( InputIterator first, InputIterator last )
 		{
+			// TODO: distance can't be called on destructive iterators - check 
+			//   and use pushback if needed?
 			size_type d = distance( first, last );
-			if ( d != Storage::size() && Storage::try_resize( sz, false ) )
+			if ( d != Storage::size() && Storage::try_resize( d, false ) )
 				InitializePolicy::copy( first, last, Storage::data() );
 		}
Index: /trunk/nv/stl/functional/hash.hh
===================================================================
--- /trunk/nv/stl/functional/hash.hh	(revision 400)
+++ /trunk/nv/stl/functional/hash.hh	(revision 401)
@@ -137,5 +137,5 @@
 	constexpr H hash_value( const T& value )
 	{
-		return hash<T, H>::get( h );
+		return hash<T, H>::get( value );
 	}
 
@@ -183,5 +183,5 @@
 
 		constexpr hashed_element( const T& v, H h ) : value(v), hash( h ) {}
-		constexpr hashed_element( T&& v, H h ) : value( std::forward<T>(v) ), hash( h ) {}
+		constexpr hashed_element( T&& v, H h ) : value( nv::forward<T>(v) ), hash( h ) {}
 
 		hashed_element( const hashed_element& ) = default;
Index: /trunk/nv/stl/iterator.hh
===================================================================
--- /trunk/nv/stl/iterator.hh	(revision 400)
+++ /trunk/nv/stl/iterator.hh	(revision 401)
@@ -15,4 +15,5 @@
 
 #include <nv/common.hh>
+#include <nv/stl/type_traits/common.hh>
 
 namespace nv
Index: /trunk/nv/stl/memory.hh
===================================================================
--- /trunk/nv/stl/memory.hh	(revision 400)
+++ /trunk/nv/stl/memory.hh	(revision 401)
@@ -19,4 +19,6 @@
 #include <nv/stl/type_traits/properties.hh>
 #include <nv/stl/type_traits/alignment.hh>
+#include <nv/stl/algorithm/fill.hh>
+#include <nv/stl/algorithm/copy.hh>
 #include <nv/stl/utility.hh>
 #include <nv/stl/iterator.hh>
@@ -277,5 +279,5 @@
 		inline ForwardIterator uninitialized_copy_impl( InputIterator first, InputIterator last, ForwardIterator out, true_type )
 		{
-			return ForwardIterator( nvmemmove( out, first, (size_t)( (uintptr_t)last - (uintptr_t)first ) ) );
+			return ForwardIterator( raw_alias_copy( first, last, out ) );
 		}
 
@@ -290,5 +292,5 @@
 				::new ( static_cast<void*>( addressof( *dest ) ) ) value_type( *src );
 			}
-			return it;
+			return dest;
 		}
 
@@ -296,6 +298,5 @@
 		inline ForwardIterator uninitialized_copy_n_impl( InputIterator first, size_t count, ForwardIterator out, true_type )
 		{
-			typedef typename iterator_traits<ForwardIterator>::value_type value_type;
-			return ForwardIterator( nvmemmove( out, first, count * sizeof( value_type ) ) );
+			return ForwardIterator( raw_alias_copy_n( out, first, count ) );
 		}
 
Index: /trunk/nv/stl/string.hh
===================================================================
--- /trunk/nv/stl/string.hh	(revision 400)
+++ /trunk/nv/stl/string.hh	(revision 401)
@@ -100,14 +100,16 @@
 		typedef string_base< detail::add_iterators< Storage > > this_type;
 	public:
-		typedef Storage                             storage_type;
-		typedef typename base_type::value_type      value_type;
-		typedef typename base_type::pointer         pointer;
-		typedef typename base_type::const_pointer   const_pointer;
-		typedef typename base_type::reference       reference;
-		typedef typename base_type::const_reference const_reference;
-		typedef typename base_type::iterator        iterator;
-		typedef typename base_type::const_iterator  const_iterator;
-		typedef typename base_type::size_type       size_type;
-		typedef typename base_type::difference_type difference_type;
+		typedef Storage                                     storage_type;
+		typedef typename base_type::value_type              value_type;
+		typedef typename base_type::pointer                 pointer;
+		typedef typename base_type::const_pointer           const_pointer;
+		typedef typename base_type::reference               reference;
+		typedef typename base_type::const_reference         const_reference;
+		typedef typename base_type::iterator                iterator;
+		typedef typename base_type::const_iterator          const_iterator;
+		typedef typename base_type::reverse_iterator        reverse_iterator;
+		typedef typename base_type::const_reverse_iterator  const_reverse_iterator;
+		typedef typename base_type::size_type               size_type;
+		typedef typename base_type::difference_type         difference_type;
 
 		static constexpr size_type npos = size_type( -1 );
@@ -116,19 +118,19 @@
  		inline std::string to_string() const
  		{
- 			return std::string( data(), size() );
+ 			return std::string( this->data(), this->size() );
  		}
 
-		inline size_type length()   const { return size(); }
+		inline size_type length()   const { return this->size(); }
 
 		// access
-		inline value_type operator[]( size_type i ) const { return data()[i]; }
+		inline value_type operator[]( size_type i ) const { return this->data()[i]; }
 		inline value_type at( size_type i ) const
 		{
 			//	if ( i >= m_data ) NV_THROW( out_of_range( "string_ref::at" ) );
-			return data()[i];
-		}
-
-		inline value_type front()        const { return data()[0]; }
-		inline value_type back()         const { return data()[size() - 1]; }
+			return this->data()[i];
+		}
+
+		inline value_type front()        const { return this->data()[0]; }
+		inline value_type back()         const { return this->data()[this->size() - 1]; }
 
 		// string operations
@@ -155,5 +157,5 @@
 
 		template < typename H = size_type >
-		inline H hash() const
+		inline H get_hash() const
 		{
 			return hash_string< size_type >( this->data(), this->size() );
@@ -175,5 +177,5 @@
 		static H get( const T& value )
 		{
-			return value.hash< H >();
+			return value.template get_hash< H >();
 		}
 		inline H operator()( const T& value ) const { return get( value ); }
@@ -277,5 +279,5 @@
 
 	template < typename Storage >
-	inline auto string_base< Storage >::find( value_type c, size_type pos = 0 ) const -> size_type
+	inline auto string_base< Storage >::find( value_type c, size_type pos /*= 0*/ ) const -> size_type
 	{
 		if ( pos >= this->size() ) return npos;
@@ -284,5 +286,5 @@
 	}
 	template < typename Storage >
-	inline auto string_base< Storage >::find( const string_view& s, size_type pos = 0 ) const -> size_type
+	inline auto string_base< Storage >::find( const string_view& s, size_type pos /*= 0*/ ) const -> size_type
 	{
 		if ( pos >= this->size() ) return npos;
@@ -292,5 +294,5 @@
 
 	template < typename Storage >
-	inline auto string_base< Storage >::rfind( value_type c, size_type pos = 0 ) const -> size_type
+	inline auto string_base< Storage >::rfind( value_type c, size_type pos /*= 0*/ ) const -> size_type
 	{
 		if ( pos >= this->size() ) return npos;
@@ -299,5 +301,5 @@
 	}
 	template < typename Storage >
-	inline auto string_base< Storage >::rfind( const string_view& s, size_type pos = 0 ) const -> size_type
+	inline auto string_base< Storage >::rfind( const string_view& s, size_type pos /*= 0*/ ) const -> size_type
 	{
 		if ( pos >= this->size() ) return npos;
Index: /trunk/nv/stl/type_traits/alignment.hh
===================================================================
--- /trunk/nv/stl/type_traits/alignment.hh	(revision 400)
+++ /trunk/nv/stl/type_traits/alignment.hh	(revision 401)
@@ -15,4 +15,5 @@
 
 #include <nv/stl/type_traits/common.hh>
+#include <nv/stl/type_traits/properties.hh>
 
 namespace nv
@@ -45,45 +46,4 @@
 #endif		
 
-#if NV_COMPILER == NV_CLANG
-	template< typename T, size_t Size, size_t Align >
-	struct aligned_array
-	{
-		typedef T alignas( Align ) type[Size];
-	};
-#elif NV_COMPILER == NV_GNUC
-	template< typename T, size_t Size, size_t Align >
-	struct aligned_array
-	{
-		typedef T __attribute__( ( aligned( Align ) ) ) type[Size];
-	};
-#else
-	// TODO: remove this shit after moving to MSVC 2015
-	template< typename T, size_t Size, size_t Align >
-	struct aligned_array;
-
-	// According to LLVM ( https://llvm.org/svn/llvm-project/llvm/trunk/include/llvm/Support/AlignOf.h )
-	// MSVC has problems with align below 16...
-#define NV_ALIGNED_ARRAY(N) \
-	template< typename T, size_t Size > \
-	struct aligned_array< T, Size, N >  \
-			{ \
-		typedef __declspec( align(N) ) T type[Size]; \
-			}; 
-
-	NV_ALIGNED_ARRAY( 1 )
-		NV_ALIGNED_ARRAY( 2 )
-		NV_ALIGNED_ARRAY( 4 )
-		NV_ALIGNED_ARRAY( 8 )
-		NV_ALIGNED_ARRAY( 16 )
-		NV_ALIGNED_ARRAY( 32 )
-		NV_ALIGNED_ARRAY( 64 )
-		NV_ALIGNED_ARRAY( 128 )
-
-#undef NV_ALIGNED_ARRAY
-#endif
-	
-	template< typename T, size_t Size, size_t Align >
-	using aligned_array_t = typename aligned_array< T, Size, Align >::type;
-
 	template< size_t Size, size_t Align = alignof( max_align_t ) >
 	struct aligned_storage
@@ -91,5 +51,5 @@
 		struct type
 		{
-			typename aligned_array< unsigned char, Size, Align >::type data;
+			alignas( Align ) unsigned char data[ Size ];
 		};
 	};
@@ -124,8 +84,5 @@
 		static constexpr size_t max_length = detail::size_max < Size, sizeof( Types )... >::value;
 		static constexpr size_t alignment_value = detail::size_max < alignment_of< Types >::value... >::value;
-		struct type
-		{
-			typename aligned_array< unsigned char, max_length, alignment_value >::type data;
-		};
+		using type = aligned_storage_t< max_length, alignment_value >;
 	};
 
Index: /trunk/nv/stl/type_traits/common.hh
===================================================================
--- /trunk/nv/stl/type_traits/common.hh	(revision 400)
+++ /trunk/nv/stl/type_traits/common.hh	(revision 401)
@@ -96,5 +96,5 @@
 	template< typename T > struct add_reference             
 	{
-		typedef typename conditional< is_reference<T>::value, T, T&& > type;
+		typedef conditional< is_reference<T>::value, T, T&& > type;
 	};
 	template<> struct add_reference < void >                { typedef void type; };
Index: /trunk/nv/stl/type_traits/transforms.hh
===================================================================
--- /trunk/nv/stl/type_traits/transforms.hh	(revision 400)
+++ /trunk/nv/stl/type_traits/transforms.hh	(revision 401)
@@ -259,5 +259,5 @@
 #else
 	template < typename F, typename... Args >
-	struct result_of < F( Args... ) > { typedef decltype( invoke( declval<T>(), declval<Args>()... ) ) type; };
+	struct result_of < F( Args... ) > { typedef decltype( invoke( declval<F>(), declval<Args>()... ) ) type; };
 #endif
 
Index: /trunk/nv/stl/unordered_map.hh
===================================================================
--- /trunk/nv/stl/unordered_map.hh	(revision 400)
+++ /trunk/nv/stl/unordered_map.hh	(revision 401)
@@ -45,11 +45,17 @@
 		typedef hash_table< hash_table_entry_stl_map< Key, T, size_t, KeyEqual, Hash > > base_type;
 		typedef unordered_map< Key, T, Hash, KeyEqual >                                  this_type;
+		typedef typename base_type::value_type                                           value_type;
+		typedef typename base_type::pointer                                              pointer;
+		typedef typename base_type::const_pointer                                        const_pointer;
+		typedef typename base_type::reference                                            reference;
+		typedef typename base_type::const_reference                                      const_reference;
+		typedef typename base_type::iterator                                             iterator;
+		typedef typename base_type::const_iterator                                       const_iterator;
 		typedef typename base_type::size_type                                            size_type;
+		typedef typename base_type::difference_type                                      difference_type;
 		typedef typename base_type::key_type                                             key_type;
 		typedef typename base_type::mapped_type                                          mapped_type;
-		typedef typename base_type::value_type                                           value_type;
 		typedef typename base_type::node_type                                            node_type;
 		typedef typename base_type::insert_return_type                                   insert_return_type;
-		typedef typename base_type::iterator                                             iterator;
 		typedef Hash                                                                     hasher;
 		typedef KeyEqual                                                                 key_equal;
Index: /trunk/src/core/time.cc
===================================================================
--- /trunk/src/core/time.cc	(revision 400)
+++ /trunk/src/core/time.cc	(revision 401)
@@ -17,5 +17,5 @@
 #pragma intrinsic(__rdtsc)
 #else
-#if NV_COMPILER == NV_GNUC && NV_PLATFORM == NV_WINDOWS
+#if NV_PLATFORM == NV_WINDOWS
 // mingw doesn't have usleep nor nanosleep...
 #include <windows.h>
@@ -71,5 +71,5 @@
 	Sleep( ms );
 #else
-#if NV_COMPILER == NV_GNUC && NV_PLATFORM == NV_WINDOWS
+#if NV_PLATFORM == NV_WINDOWS
 	Sleep( ms );
 #else
Index: /trunk/src/formats/md5_loader.cc
===================================================================
--- /trunk/src/formats/md5_loader.cc	(revision 400)
+++ /trunk/src/formats/md5_loader.cc	(revision 401)
@@ -10,4 +10,7 @@
 #include "nv/stl/vector.hh"
 #include "nv/io/std_stream.hh"
+
+#include <stdio.h>  // sscanf
+#include <stdlib.h> // atof
 
 using namespace nv;
Index: /trunk/src/gui/gui_environment.cc
===================================================================
--- /trunk/src/gui/gui_environment.cc	(revision 400)
+++ /trunk/src/gui/gui_environment.cc	(revision 401)
@@ -9,4 +9,5 @@
 #include "nv/gui/gui_renderer.hh"
 
+#include <algorithm> // std::find on std::list
 
 	/*
