Index: trunk/nv/core/common.hh
===================================================================
--- trunk/nv/core/common.hh	(revision 378)
+++ trunk/nv/core/common.hh	(revision 379)
@@ -176,10 +176,14 @@
 #define NV_SAFE_ARRAY( arr, idx, def ) ( index < NV_COUNT_OF(arr) ? (arr)[idx] : (def) )
 
+#define NV_TYPE_FAIL(T) (nv::static_assert_fail<T>::value)
+#define NV_TEMPLATE_FAIL(T,message) static_assert( NV_TYPE_FAIL(T), message );
+
 namespace nv
 {
-	namespace lua
-	{
-		class state;
-	}
+	template < typename T >
+	struct static_assert_fail
+	{
+		static const bool value = false;
+	};
 
 	using size_t    = decltype( sizeof(0) );
@@ -240,21 +244,4 @@
 
 	template <typename T, typename U>
-	inline T* down_cast( U* x )
-	{
-#if NV_DEBUG
-		T* p = dynamic_cast<T*>( x );
-		if ( p == 0 )
-		{
-#ifdef NV_LOG
-			NV_THROW( std::bad_cast );
-#endif
-		}
-		return p;
-#else
-		return static_cast<T*>( x );
-#endif
-	}
-
-	template <typename T, typename U>
 	T narrow_cast( const U& a )
 	{
@@ -278,4 +265,5 @@
 
 #include <nv/stl/assert.hh>
+#include <nv/stl/rtti_support.hh>
 
 #endif // NV_CORE_COMMON_HH
Index: trunk/nv/core/library.hh
===================================================================
--- trunk/nv/core/library.hh	(revision 378)
+++ trunk/nv/core/library.hh	(revision 379)
@@ -16,4 +16,5 @@
 #include <nv/stl/exception.hh>
 #include <nv/stl/string.hh>
+#include <string>
 
 namespace nv
@@ -37,5 +38,5 @@
 		 * Throws library_error on failure
 		 */
-		void open( const string& name );
+		void open( string_ref name );
 
 		/**
@@ -44,5 +45,5 @@
 		 * returns true if succeeded, false otherwise
 		 */
-		bool try_open( const string& name );
+		bool try_open( string_ref name );
 
 		/**
@@ -54,5 +55,5 @@
 		 * Returns library name
 		 */
-		const string& get_name() const;
+		string_ref get_name() const;
 
 		/**
@@ -61,5 +62,5 @@
 		 * Throws on symbol not found
 		 */
-		void* get( const string& symbol );
+		void* get( string_ref symbol );
 
 		/**
@@ -68,5 +69,5 @@
 		 * Returns null if symbol not found
 		 */
-		void* try_get( const string& symbol );
+		void* try_get( string_ref symbol );
 
 		/**
@@ -82,5 +83,5 @@
 		 * Exact implementation depends on platform/compiler.
 		 */
-		static string get_error();
+		static std::string get_error();
 
 	protected:
@@ -107,5 +108,5 @@
 
 		/// Library name
-		string m_name;
+		std::string m_name;
 
 	};  // class Library
@@ -114,10 +115,10 @@
 	{
 		/// Library name
-		string m_name;
+		std::string m_name;
 	public:
 		/**
 		 * Constructor
 		 */
-		library_error( const string& message, const string& name )
+		library_error( const std::string& message, const std::string& name )
 			: runtime_error( "Library (" + name + ") : " + message + " [ " + library::get_error() + " ]"), m_name( name )
 		{
@@ -134,5 +135,5 @@
 		 * Returns library name
 		 */
-		const string& get_name()
+		const std::string& get_name()
 		{
 			return m_name;
Index: trunk/nv/core/logging.hh
===================================================================
--- trunk/nv/core/logging.hh	(revision 378)
+++ trunk/nv/core/logging.hh	(revision 379)
@@ -15,4 +15,5 @@
 
 #include <nv/core/common.hh>
+#include <nv/stl/capi.hh>
 #include <nv/stl/string.hh>
 #include <nv/stl/singleton.hh>
@@ -52,5 +53,5 @@
 		void log_append( string_ref ref )
 		{
-			memcpy( m_pos, ref.data(), ref.size() );
+			nvmemcpy( m_pos, ref.data(), ref.size() );
 			m_pos += ref.size();
 		}
@@ -62,4 +63,12 @@
 		{
 			m_pos += sint32_to_buffer( s, m_pos );
+		}
+		void log_append( uint64 u )
+		{
+			m_pos += uint64_to_buffer( u, m_pos );
+		}
+		void log_append( sint64 s )
+		{
+			m_pos += sint64_to_buffer( s, m_pos );
 		}
 		void log_append( f32 f )
Index: trunk/nv/core/types.hh
===================================================================
--- trunk/nv/core/types.hh	(revision 378)
+++ trunk/nv/core/types.hh	(revision 379)
@@ -11,22 +11,28 @@
 #include <nv/stl/cstring_store.hh>
 #include <nv/stl/traits/properties.hh>
-#include <nv/stl/type_info.hh>
 #include <unordered_map>
 #include <vector>
 
-namespace std
-{
-	template<>
-	struct hash < nv::type_index >
-	{
-		size_t operator()( nv::type_index key ) const
-		{
-			return ( key.hash_code() );
-		}
-	};
-}
-
 namespace nv
 {
+	typedef nv::uint64 type_hash;
+
+	template< typename T >
+	struct is_container
+	{
+	private:
+		typedef char                      yes;
+		typedef struct { char array[2]; } no;
+		template<typename C> static yes test( typename C::iterator* );
+		template<typename C> static no  test( ... );
+	public:
+		static const bool value = sizeof( test<T>( 0 ) ) == sizeof( yes );
+	};
+
+	template<>
+	struct is_container < std::string >
+	{
+		static const bool value = false;
+	};
 
 	struct type_entry;
@@ -47,9 +53,9 @@
 	struct type_field
 	{
-		uint32                name;     //!< name of the field
-		const std::type_info* raw_type; //!< typeinfo for later retrieval of type
-		type_entry*           type;     //!< pointer to field type
-		uint32                flags;    //!< flags 
-		uint32                offset;   //!< offset into parent
+		uint32      name;     //!< name of the field
+		type_hash   hash; //!< typeinfo for later retrieval of type
+		type_entry* type;     //!< pointer to field type
+		uint32      flags;    //!< flags 
+		uint32      offset;   //!< offset into parent
 	};
 
@@ -128,7 +134,7 @@
 		}
 
-		type_entry* get_type( const std::type_info& t )
-		{
-			type_info_map::iterator it = m_idx_types.find( type_index( t ) );
+		type_entry* get_type( type_hash hash )
+		{
+			type_info_map::iterator it = m_idx_types.find( hash );
 			if ( it != m_idx_types.end() )
 			{
@@ -148,6 +154,6 @@
 		}
 	private:
-		typedef std::vector<type_entry*>                         type_list;
-		typedef std::unordered_map<type_index, type_entry*> type_info_map;
+		typedef std::vector<type_entry*>                   type_list;
+		typedef std::unordered_map<type_hash, type_entry*> type_info_map;
 		cstring_store m_names;
 		type_list     m_type_list;
@@ -169,6 +175,6 @@
 		type_field f;
 		f.name = m_entry->names.insert( name );
-		f.raw_type = &typeid( remove_pointer_t<field_type> );
-		f.type = type_db->get_type( *( f.raw_type ) );
+		f.hash = rtti_type_hash< remove_pointer_t<field_type> >::hash();
+		f.type = type_db->get_type( f.hash );
 		f.flags = TF_CONTAINER |
 			( is_pointer<field_type>::value ? TF_POINTER : 0 ) |
@@ -185,6 +191,6 @@
 		type_field f;
 		f.name = m_entry->names.insert( name );
-		f.raw_type = &typeid( remove_pointer_t<TFIELD> );
-		f.type = type_db->get_type( *( f.raw_type ) );
+		f.hash = rtti_type_hash< remove_pointer_t<TFIELD> >::hash();
+		f.type = type_db->get_type( f.hash );
 		f.flags =
 			( is_pointer<TFIELD>::value ? TF_POINTER : 0 ) |
Index: trunk/nv/core/uid.hh
===================================================================
--- trunk/nv/core/uid.hh	(revision 378)
+++ trunk/nv/core/uid.hh	(revision 379)
@@ -99,4 +99,5 @@
 		U* get_as( uid auid ) const 
 		{
+			static_assert( NV_TYPE_FAIL( U ), "Currently unsupported due to lack of dynamic_cast!" );
 			return dynamic_cast< U* >( get(auid) );
 		}
Index: trunk/nv/engine/program_manager.hh
===================================================================
--- trunk/nv/engine/program_manager.hh	(revision 378)
+++ trunk/nv/engine/program_manager.hh	(revision 379)
@@ -28,10 +28,10 @@
 	protected:
 		virtual resource_id load_resource( lua::table_guard& table );
-		void load_source( lua::table_guard& table, string& out, const string& append );
+		void load_source( lua::table_guard& table, std::string& out, const std::string& append );
 		virtual void release( program p );
 	private:
 		context* m_context;
-		string   m_vertex_head;
-		string   m_fragment_head;
+		std::string   m_vertex_head;
+		std::string   m_fragment_head;
 	};
 
Index: trunk/nv/engine/resource_system.hh
===================================================================
--- trunk/nv/engine/resource_system.hh	(revision 378)
+++ trunk/nv/engine/resource_system.hh	(revision 379)
@@ -42,5 +42,5 @@
 
 		lua::state* m_lua;
-		std::unordered_map< string, resource_id > m_names;
+		std::unordered_map< std::string, resource_id > m_names;
 	};
 
@@ -54,5 +54,5 @@
 			return ( id < m_data.size() ? m_data[ id ] : T() );
 		}
-		T get_resource( const string& id )
+		T get_resource( const std::string& id )
 		{
 			auto m = m_names.find( id );
@@ -92,11 +92,11 @@
 	public:
 		explicit resource_system() : m_lua_state( nullptr ) { m_managers.push_back(nullptr); }
-		resource_type_id register_resource_type( const string& name, resource_manager_base* manager );
-		resource_type_id get_resource_type_id( const string& name ) const;
+		resource_type_id register_resource_type( const std::string& name, resource_manager_base* manager );
+		resource_type_id get_resource_type_id( const std::string& name ) const;
 		void initialize( lua::state* a_lua_state );
 		virtual ~resource_system();
 	protected:
 		std::vector< resource_manager_base* >     m_managers;
-		std::unordered_map< string, resource_id > m_manager_names;
+		std::unordered_map< std::string, resource_id > m_manager_names;
 		lua::state* m_lua_state; 
 	};
Index: trunk/nv/formats/assimp_loader.hh
===================================================================
--- trunk/nv/formats/assimp_loader.hh	(revision 378)
+++ trunk/nv/formats/assimp_loader.hh	(revision 379)
@@ -20,5 +20,5 @@
 	{
 	public:
-		explicit assimp_loader( const string& a_ext, uint32 a_assimp_flags = 0 );
+		explicit assimp_loader( const std::string& a_ext, uint32 a_assimp_flags = 0 );
 		virtual bool load( stream& source );
 		virtual mesh_data* release_mesh_data( size_t index = 0 );
@@ -38,5 +38,5 @@
 
 		string_table_creator m_strings;
-		string m_ext;
+		std::string m_ext;
 		uint32 m_assimp_flags;
 		const void* m_scene;
Index: trunk/nv/gfx/texture_font.hh
===================================================================
--- trunk/nv/gfx/texture_font.hh	(revision 378)
+++ trunk/nv/gfx/texture_font.hh	(revision 379)
@@ -45,5 +45,5 @@
 			texture_font( texture_atlas* atlas, const char * filename, float size );
 			const texture_glyph* get_glyph( uint16 charcode ) const;
-			bool load_glyphs( const string& codes );
+			bool load_glyphs( string_ref codes );
 			float get_size() const { return m_size; }
 			~texture_font();
@@ -54,5 +54,5 @@
 
 			texture_atlas* m_atlas; //!< Atlas Image object for this font.
-			string m_filename; //!< Name of the file.
+			std::string m_filename; //!< Name of the file.
 			float m_size;           //!< Font size.
 			float m_height;         //!< Height of the font. (x-height?)
Index: trunk/nv/gl/gl_device.hh
===================================================================
--- trunk/nv/gl/gl_device.hh	(revision 378)
+++ trunk/nv/gl/gl_device.hh	(revision 379)
@@ -53,10 +53,10 @@
 		virtual const buffer_info* get_buffer_info( buffer t ) const;
 
-		virtual int get_attribute_location( program p, const string& name, bool fatal = true ) const;
+		virtual int get_attribute_location( program p, const std::string& name, bool fatal = true ) const;
 		virtual void prepare_program( program p );
-		virtual const string& get_shader_header() const { return m_shader_header; }
+		virtual const std::string& get_shader_header() const { return m_shader_header; }
 		virtual ~gl_device();
 	protected:
-		uniform_base* get_uniform( program p, const string& name, bool fatal = true ) const;
+		uniform_base* get_uniform( program p, const std::string& name, bool fatal = true ) const;
 
 	
Index: trunk/nv/gl/gl_window.hh
===================================================================
--- trunk/nv/gl/gl_window.hh	(revision 378)
+++ trunk/nv/gl/gl_window.hh	(revision 379)
@@ -25,10 +25,10 @@
 	public:
 		gl_window( device* dev, window_manager* wm, input* a_input, void* handle, void* dc );
-		virtual void set_title( const string& ) {}
+		virtual void set_title( const std::string& ) {}
 		virtual context* get_context()    { return m_context; }
 		virtual device* get_device()      { return m_device; }
 		virtual uint16 get_width() const  { return m_width; }
 		virtual uint16 get_height() const { return m_height; }
-		virtual string get_title() const  { return std::string(); }
+		virtual std::string get_title() const { return std::string(); }
 		// TODO : implement?
 		virtual void set_swap_control( bool ) {}
Index: trunk/nv/gui/gui_element.hh
===================================================================
--- trunk/nv/gui/gui_element.hh	(revision 378)
+++ trunk/nv/gui/gui_element.hh	(revision 379)
@@ -32,11 +32,11 @@
 			typedef std::list<handle> list;
 
-			string    m_id;              ///< id type of the object
+			std::string    m_id;              ///< id type of the object
 			handle    m_parent;          ///< pointer to parent
 			flags     m_flags;
 			list      m_children;        ///< children objects
 			size_t    m_child_count;     ///< number of children
-			string    m_class; ///< Class name.
-			string    m_text; ///< Displayed label or text.
+			std::string    m_class; ///< Class name.
+			std::string    m_text; ///< Displayed label or text.
 			rectangle m_relative; ///< Position relative to parent.
 			rectangle m_absolute; ///< Position relative to window/screen.
Index: trunk/nv/gui/gui_environment.hh
===================================================================
--- trunk/nv/gui/gui_environment.hh	(revision 378)
+++ trunk/nv/gui/gui_environment.hh	(revision 379)
@@ -35,6 +35,6 @@
 			handle create_element( const rectangle& r );
 			handle create_element( handle parent, const rectangle& r );
-			void set_text( handle e, const string& text );
-			void set_class( handle  e, const string& text );
+			void set_text( handle e, const std::string& text );
+			void set_class( handle  e, const std::string& text );
 			void update();
 			void draw();
Index: trunk/nv/interface/device.hh
===================================================================
--- trunk/nv/interface/device.hh	(revision 378)
+++ trunk/nv/interface/device.hh	(revision 379)
@@ -67,5 +67,5 @@
 	struct attribute
 	{
-		string   name;
+		std::string   name;
 		int      location;
 		datatype type;
@@ -73,5 +73,5 @@
 	};
 
-	typedef std::unordered_map< string, attribute >    attribute_map;
+	typedef std::unordered_map< std::string, attribute >    attribute_map;
 
 	struct texture_tag {};
@@ -168,5 +168,5 @@
 		virtual const texture_info* get_texture_info( texture ) const = 0;
 		virtual const buffer_info* get_buffer_info( buffer ) const = 0;
-		virtual const string& get_shader_header() const = 0;
+		virtual const std::string& get_shader_header() const = 0;
 
 		virtual texture create_texture( image_data* data, sampler asampler ) 
@@ -175,13 +175,13 @@
 		}
 
-		int try_get_attribute_location( program p, const string& name ) const
+		int try_get_attribute_location( program p, const std::string& name ) const
 		{
 			return get_attribute_location( p, name, false );
 		}
 
-		virtual int get_attribute_location( program p, const string& name, bool fatal = true ) const = 0;
-
-		template < typename T >
-		void set_uniform_array( program p, const string& name, const T* value, uint32 count, bool fatal = true )
+		virtual int get_attribute_location( program p, const std::string& name, bool fatal = true ) const = 0;
+
+		template < typename T >
+		void set_uniform_array( program p, const std::string& name, const T* value, uint32 count, bool fatal = true )
 		{
 			uniform_base* base = get_uniform( p, name, fatal );
@@ -198,5 +198,5 @@
 
 		template < typename T >
-		void set_opt_uniform_array( program p, const string& name, const T* value, uint32 count )
+		void set_opt_uniform_array( program p, const std::string& name, const T* value, uint32 count )
 		{
 			set_uniform_array( p, name, value, count, false );
@@ -204,5 +204,5 @@
 
 		template < typename T >
-		void set_opt_uniform_array( program p, const string& name, const std::vector<T>& value )
+		void set_opt_uniform_array( program p, const std::string& name, const std::vector<T>& value )
 		{
 			set_uniform_array( p, name, (const T*)value.data(), value.size(), false );
@@ -211,5 +211,5 @@
 
 		template < typename T >
-		void set_uniform( program p, const string& name, const T& value, bool fatal = true )
+		void set_uniform( program p, const std::string& name, const T& value, bool fatal = true )
 		{
 			uniform_base* base = get_uniform( p, name, fatal );
@@ -224,5 +224,5 @@
 
 		template < typename T >
-		void set_opt_uniform( program p, const string& name, const T& value )
+		void set_opt_uniform( program p, const std::string& name, const T& value )
 		{
 			set_uniform( p, name, value, false );
@@ -251,5 +251,5 @@
 
 	protected:
-		virtual uniform_base* get_uniform( program p, const string& name, bool fatal = true ) const = 0;
+		virtual uniform_base* get_uniform( program p, const std::string& name, bool fatal = true ) const = 0;
 
 		void initialize_engine_uniforms()
Index: trunk/nv/interface/map_area.hh
===================================================================
--- trunk/nv/interface/map_area.hh	(revision 378)
+++ trunk/nv/interface/map_area.hh	(revision 379)
@@ -17,4 +17,5 @@
 #include <nv/stl/string.hh>
 #include <nv/stl/array.hh>
+#include <string>
 
 namespace nv
@@ -27,6 +28,6 @@
 		virtual uint32 get_cell( const position& p ) const = 0;
 		virtual void set_cell( const position& p, uint32 value ) = 0;
-		virtual uint32 string_to_id( const nv::string& ) const { return 0; }
-		virtual nv::string id_to_string( uint32 ) const { return nv::string(); }
+		virtual uint32 string_to_id( const std::string& ) const { return 0; }
+		virtual std::string id_to_string( uint32 ) const { return std::string(); }
 		virtual dimension get_size() const = 0;
 		virtual position get_shift() const { return position(); }
@@ -48,6 +49,6 @@
 		virtual dimension get_size() const { return m_area.get_size(); }
 		virtual position get_shift() const { return m_area.ul + m_map_area->get_shift(); }
-		virtual uint32 string_to_id( const nv::string& s ) const { return m_map_area->string_to_id( s ); }
-		virtual nv::string id_to_string( uint32 id ) const { return m_map_area->id_to_string( id ); }
+		virtual uint32 string_to_id( const std::string& s ) const { return m_map_area->string_to_id( s ); }
+		virtual std::string id_to_string( uint32 id ) const { return m_map_area->id_to_string( id ); }
 	private:
 		map_area* m_map_area;
Index: trunk/nv/interface/mesh_data.hh
===================================================================
--- trunk/nv/interface/mesh_data.hh	(revision 378)
+++ trunk/nv/interface/mesh_data.hh	(revision 379)
@@ -221,5 +221,5 @@
 	struct mesh_node_data
 	{
-		string    name;
+		std::string    name;
 		sint16    target_id;
 		sint16    parent_id;
@@ -233,10 +233,10 @@
 		friend class mesh_nodes_creator;
 	public:
-		explicit mesh_nodes_data( const string& name, uint32 count, mesh_node_data* nodes )
+		explicit mesh_nodes_data( const std::string& name, uint32 count, mesh_node_data* nodes )
 			: m_name( name ), m_count( count ), m_nodes( nodes ), m_frame_rate(0), m_duration(0.0f), m_flat( false )
 		{
 		}
 
-		explicit mesh_nodes_data( const string& name, uint32 count, mesh_node_data* nodes,
+		explicit mesh_nodes_data( const std::string& name, uint32 count, mesh_node_data* nodes,
 			uint16 a_fps, float a_frames, bool a_flat )
 			: m_name( name ), m_count( count ), m_nodes( nodes ), m_frame_rate(a_fps), m_duration(a_frames), m_flat( a_flat )
@@ -283,5 +283,5 @@
 		float get_duration() const { return m_duration; }
 		void set_name( const std::string& name ) { m_name = name; }
-		const string& get_name() const { return m_name; }
+		const std::string& get_name() const { return m_name; }
 
 		~mesh_nodes_data()
@@ -293,5 +293,5 @@
 
 	private:
-		string m_name;
+		std::string m_name;
 		uint32 m_count;
 		mesh_node_data* m_nodes;
Index: trunk/nv/interface/uniform.hh
===================================================================
--- trunk/nv/interface/uniform.hh	(revision 378)
+++ trunk/nv/interface/uniform.hh	(revision 379)
@@ -17,4 +17,5 @@
 #include <nv/stl/string.hh>
 #include <unordered_map>
+#include <string>
 
 namespace nv
@@ -25,5 +26,5 @@
 	{
 	public: 
-		uniform_base( const string& name, datatype type, int location, int length ) 
+		uniform_base( const std::string& name, datatype type, int location, int length ) 
 			: m_name( name ), m_type( type ), m_location(location), m_length( length ), m_dirty( true ) {}
 		bool try_type_check( datatype )
@@ -43,8 +44,8 @@
 		bool is_dirty() const { return m_dirty; }
 		void clean() { m_dirty = false; }
-		static uniform_base* create( datatype utype, const string& name, int location, int length );
+		static uniform_base* create( datatype utype, const std::string& name, int location, int length );
 		virtual ~uniform_base() {}
 	protected:
-		string   m_name;
+		std::string   m_name;
 		datatype m_type;
 		int      m_location;
@@ -59,5 +60,5 @@
 		typedef T value_type;
 
-		uniform( const string& name, int location, int length ) 
+		uniform( const std::string& name, int location, int length ) 
 			: uniform_base( name, type_to_enum< T >::type, location, length ), m_value( nullptr )
 		{
@@ -148,8 +149,8 @@
 	};
 
-	typedef std::unordered_map< string, uniform_base* >                uniform_map;
+	typedef std::unordered_map< std::string, uniform_base* >                uniform_map;
 	typedef std::vector< engine_uniform_base* >                        engine_uniform_list;
-	typedef std::unordered_map< string, engine_uniform_factory_base* > engine_uniform_factory_map;
-	typedef std::unordered_map< string, engine_link_uniform_base* >    engine_link_uniform_factory_map;
+	typedef std::unordered_map< std::string, engine_uniform_factory_base* > engine_uniform_factory_map;
+	typedef std::unordered_map< std::string, engine_link_uniform_base* >    engine_link_uniform_factory_map;
 
 	class engine_uniform_m_view : public engine_uniform< mat4 >
@@ -246,5 +247,5 @@
 	};
 
-	inline uniform_base* uniform_base::create( datatype utype, const string& name, int location, int length )
+	inline uniform_base* uniform_base::create( datatype utype, const std::string& name, int location, int length )
 	{
 		switch( utype )
Index: trunk/nv/interface/window.hh
===================================================================
--- trunk/nv/interface/window.hh	(revision 378)
+++ trunk/nv/interface/window.hh	(revision 379)
@@ -27,6 +27,6 @@
 		virtual uint16 get_width() const = 0;
 		virtual uint16 get_height() const = 0;
-		virtual string get_title() const = 0;
-		virtual void set_title( const string& title ) = 0;
+		virtual std::string get_title() const = 0;
+		virtual void set_title( const std::string& title ) = 0;
 		virtual context* get_context() = 0;
 		virtual bool is_event_pending() = 0;
Index: trunk/nv/lua/lua_path.hh
===================================================================
--- trunk/nv/lua/lua_path.hh	(revision 378)
+++ trunk/nv/lua/lua_path.hh	(revision 379)
@@ -55,5 +55,5 @@
 
 			void parse();
-			void push( size_t value );
+			void push( uint32 value );
 			void push( string_ref p );
 
@@ -63,12 +63,12 @@
 				union
 				{
-					size_t      value;
+					uint32      value;
 					const char* str;
 				};
-				size_t      length;
+				uint32      length;
 			};
 
 			element m_elements[8];
-			sint32  m_count;
+			uint32  m_count;
 		};
 
Index: trunk/nv/lua/lua_state.hh
===================================================================
--- trunk/nv/lua/lua_state.hh	(revision 378)
+++ trunk/nv/lua/lua_state.hh	(revision 379)
@@ -33,4 +33,5 @@
 	namespace lua
 	{
+		class state;
 
 		const int ret_multi = -1;
Index: trunk/nv/lua/lua_values.hh
===================================================================
--- trunk/nv/lua/lua_values.hh	(revision 378)
+++ trunk/nv/lua/lua_values.hh	(revision 379)
@@ -206,5 +206,5 @@
 
 			template <typename T>
-			struct type_degrade< T, enable_if_t< is_stdstring< T >::value > >
+			struct type_degrade< T, enable_if_t< is_same< std::string, remove_cvr_t< T > >::value > >
 			{
 				typedef std::string type;
Index: trunk/nv/sdl/sdl_window.hh
===================================================================
--- trunk/nv/sdl/sdl_window.hh	(revision 378)
+++ trunk/nv/sdl/sdl_window.hh	(revision 379)
@@ -26,5 +26,5 @@
 		public:
 			window( device* dev, uint16 width, uint16 height, bool fullscreen = false );
-			virtual void set_title( const string& title );
+			virtual void set_title( const std::string& title );
 			virtual void swap_buffers();
 
@@ -33,5 +33,5 @@
 			virtual uint16 get_width() const  { return m_width; }
 			virtual uint16 get_height() const { return m_height; }
-			virtual string get_title() const  { return m_title; }
+			virtual std::string get_title() const { return m_title; }
 			virtual void set_swap_control( bool enabled );
 			virtual bool is_event_pending()            { return m_input->is_event_pending(); }
@@ -44,5 +44,5 @@
 			uint16      m_width;
 			uint16      m_height;
-			string      m_title;
+			std::string      m_title;
 			void*       m_handle;
 			gl_context* m_context;
Index: trunk/nv/stl/any.hh
===================================================================
--- trunk/nv/stl/any.hh	(revision 378)
+++ trunk/nv/stl/any.hh	(revision 379)
@@ -20,4 +20,6 @@
 #include <nv/stl/type_traits.hh>
 #include <nv/stl/type_info.hh>
+
+#error "any type is currently unsupported!"
 
 namespace nv
Index: trunk/nv/stl/string.hh
===================================================================
--- trunk/nv/stl/string.hh	(revision 378)
+++ trunk/nv/stl/string.hh	(revision 379)
@@ -3,5 +3,5 @@
 // For conditions of distribution and use, see copyright notice in nv.hh
 //
-// TODO: tests for string_length
+// TODO: 
 //  * performance tests
 //  * matching tests
@@ -31,39 +31,4 @@
 namespace nv
 {
-	using std::string;
-
-
-
-	/**
-	* Utility function for converting any value to string.
-	*
-	* @param value value to be converted, needs to have << operator
-	*        to stream
-	* @throw runtime_error Throws runtime_error on conversion fail
-	* @return value converted to string
-	*/
-	template < class T >
-	string to_string( const T& value )
-	{
-		std::stringstream stream;
-		stream << value;
-
-		if ( stream.fail() )
-		{
-//			NV_THROW( runtime_error, "bad cast" );
-		}
-
-		return stream.str();
-	}
-
-	/**
-	* Override function for special treatment of strings. Returns the
-	* value passed.
-	*/
-	inline string to_string( const string& value)
-	{
-		return value;
-	}
-
 	/**
 	* Simple function for slurping a file into a string.
@@ -73,40 +38,4 @@
 	namespace detail
 	{
-		template< typename T >
-		struct string_length_impl
-		{
-			static size_t get( T ) { return 0; }
-		};
-		template< size_t S >
-		struct string_length_impl < char[S] >
-		{
-			static size_t get( const char[S] ) { return S - 1; }
-		};
-		template< size_t S >
-		struct string_length_impl < const char[S] >
-		{
-			static size_t get( const char[S] ) { return S - 1; }
-		};
-		template<>
-		struct string_length_impl < char* >
-		{
-			static size_t get( const char* s ) { return nvstrlen( s ); }
-		};
-		template<>
-		struct string_length_impl < const char* >
-		{
-			static size_t get( const char* s ) { return nvstrlen( s ); }
-		};
-		template<>
-		struct string_length_impl < std::string >
-		{
-			static size_t get( const std::string& s ) { return s.length(); }
-		};
-		template<>
-		struct string_length_impl < const std::string >
-		{
-			static size_t get( const std::string& s ) { return s.length(); }
-		};
-
 		// These could be done much better
 		template <typename T>
@@ -121,7 +50,4 @@
 	}
 
-	template< typename T >
-	using string_length = detail::string_length_impl < remove_cvr_t < T > >;
-
 	template < typename T >
 	struct is_cstring : detail::is_cstring_impl< remove_reference_t<T> >::type
@@ -129,32 +55,5 @@
 
 	};
-
-	template <typename T>
-	struct is_stdstring	: is_same< std::string, remove_cvr_t< T > >
-	{
-	};
-
-	template < typename T > struct is_string : bool_constant < is_stdstring<T>::value || is_cstring<T>::value > {};
-
-	template<typename T>
-	struct is_container
-	{
-	private:
-		typedef char                      yes;
-		typedef struct { char array[2]; } no;
-		template<typename C> static yes test( typename C::iterator* );
-		template<typename C> static no  test( ... );
-	public:
-		static const bool value = sizeof( test<T>( 0 ) ) == sizeof( yes );
-	};
-
-	template<>
-	struct is_container < std::string >
-	{
-		static const bool value = false;
-	};
-
-
-
+	
 	class string_ref;
 
@@ -249,5 +148,5 @@
 		{
 			for ( const_iterator it = this->cbegin(); it != this->cend(); ++it )
-				if ( 0 == nvmemchr( s.data(), *it, s.size() ) )
+				if ( 0 == nvmemchr( s.data(), (uchar8)*it, s.size() ) )
 					return ( size_type )distance( this->cbegin(), it );
 			return npos;
@@ -263,5 +162,5 @@
 		{
 			for ( const_reverse_iterator it = this->crbegin(); it != this->crend(); ++it )
-				if ( 0 == nvmemchr( s.data(), *it, s.size() ) )
+				if ( 0 == nvmemchr( s.data(), (uchar8)*it, s.size() ) )
 					return reverse_distance( this->crbegin(), it );
 			return npos;
@@ -307,5 +206,5 @@
 		size_type reverse_distance( ReverseIterator first, ReverseIterator last ) const
 		{
-			return size() - 1 - distance( first, last );
+			return size() - 1 - (size_t)distance( first, last );
 		}
 	};
@@ -508,8 +407,8 @@
 	size_t startpos = str.find_first_not_of( " \r\n\t" );
 
-	if ( string::npos != endpos || string::npos != startpos )
-	{
-		if ( string::npos == startpos ) startpos = 0;
-		if ( string::npos != endpos )   endpos = endpos + 1 - startpos;
+	if ( string_ref::npos != endpos || string_ref::npos != startpos )
+	{
+		if ( string_ref::npos == startpos ) startpos = 0;
+		if ( string_ref::npos != endpos )   endpos = endpos + 1 - startpos;
 		return str.substr( startpos, endpos );
 	}
@@ -520,5 +419,5 @@
 {
 	size_t endpos = str.find_last_not_of( " \r\n\t" );
-	if ( string::npos != endpos )
+	if ( string_ref::npos != endpos )
 	{
 		return str.substr( 0, endpos + 1 );
@@ -530,5 +429,5 @@
 {
 	size_t startpos = str.find_first_not_of( " \r\n\t" );
-	if ( string::npos != startpos )
+	if ( string_ref::npos != startpos )
 	{
 		return str.substr( startpos );
Index: trunk/nv/stl/type_info.hh
===================================================================
--- trunk/nv/stl/type_info.hh	(revision 378)
+++ 	(revision )
@@ -1,65 +1,0 @@
-// 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 type_info.hh
-* @author Kornel Kisielewicz epyon@chaosforge.org
-* @brief type info
-*/
-// TODO: remove typeinfo?
-
-#ifndef NV_STL_TYPE_INFO_HH
-#define NV_STL_TYPE_INFO_HH
-
-#include <nv/core/common.hh>
-#include <typeinfo>
-
-namespace nv
-{
-
-	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;
-	};
-
-}
-
-#endif // NV_STL_TYPE_INFO_HH
