Changeset 401


Ignore:
Timestamp:
06/13/15 18:02:17 (10 years ago)
Author:
epyon
Message:
  • clang/gcc fixes
  • removed aligned array, usage of alignas should work now
Location:
trunk
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/base/common.hh

    r397 r401  
    131131#if NV_COMPILER == NV_MSVC
    132132#define NV_DEPRECATED(func) __declspec(deprecated) func
    133 #define NV_ALIGN(value) __declspec(align(value))
    134 #define NV_ALIGNED_STRUCT(value) __declspec(align(value)) struct
    135133#define NV_NOALIAS __declspec(noalias)
    136134#define NV_RESTRICT __declspec(restrict)
    137135#define NV_RESTRICT_VAR __restrict
     136#define NV_MSVC_SUPRESS( warn_number ) __pragma( warning( suppress : warn_number ) )
    138137#if NV_ARCHITECTURE == NV_64BIT
    139138#define NV_OFFSET_OF(obj,m) (nv::size_t)( (nv::ptrdiff_t)&reinterpret_cast<const volatile char&>((((obj *)0)->m)) )
    140139#else // NV_32BIT
    141140#define NV_OFFSET_OF(obj,m) (nv::size_t)&reinterpret_cast<const volatile char&>((((obj *)0)->m))
    142 #define NV_MSVC_SUPRESS( warn_number ) __pragma( warning( suppress : warn_number ) )
    143141#endif 
    144142#elif NV_COMPILER == NV_GNUC || NV_COMPILER == NV_CLANG
    145143#define NV_DEPRECATED(func) func __attribute__ ((deprecated))
    146 #define NV_ALIGN(value) __attribute__((aligned(value)))
    147 #define NV_ALIGNED_STRUCT(value) struct __attribute__((aligned(value)))
    148144#define NV_RESTRICT __restrict__
    149145#define NV_RESTRICT_VAR __restrict__
     
    201197        using ::size_t;
    202198#else
    203         using size_t    = decltype( 0 );
     199        using size_t    = decltype( sizeof(0) );
    204200#endif
    205201        using ptrdiff_t = decltype((int*)0 - (int*)0);
     
    271267} // namespace nv
    272268
     269static_assert( nv::size_t( -1 ) > 0,      "size_t is signed!" );
     270static_assert( sizeof( nv::size_t ) >= 4, "size_t is smaller than 4 bytes!" );
    273271static_assert( sizeof( nv::sint8 ) == 1, "sint8 size isn't 1 bytes" );
    274272static_assert( sizeof( nv::sint16 ) == 2, "sint16 size isn't 2 bytes" );
  • trunk/nv/base/new.hh

    r396 r401  
    2323}
    2424#endif
     25#else
     26#include <new>
    2527#endif
    2628
  • trunk/nv/common.hh

    r396 r401  
    1010#include <nv/base/common.hh>
    1111
    12 #endif NV_COMMON_HH
     12#endif // NV_COMMON_HH
  • trunk/nv/gfx/animation.hh

    r395 r401  
    6060                        uint32 mod        = 0;
    6161                        if ( desc.slots[0].vslot == animation_slot::TIME ) mod = 1;
    62                         std::copy_n( fdata + mod, keyfsize - mod, result );
     62                        raw_copy_n( fdata + mod, keyfsize - mod, result );
    6363                        return keyfsize - mod;
    6464                }
     
    8282                                if ( count == 1 )
    8383                                {
    84                                         std::copy_n( fdata + 1, keyfresult, result );
     84                                        raw_copy_n( fdata + 1, keyfresult, result );
    8585                                        return keyfresult;
    8686                                }
     
    100100                                if ( count == 1 )
    101101                                {
    102                                         std::copy_n( fdata, keyfresult, result );
     102                                        raw_copy_n( fdata, keyfresult, result );
    103103                                        return keyfresult;
    104104                                }
  • trunk/nv/stl/algorithm/copy.hh

    r395 r401  
    1717#include <nv/stl/algorithm/raw.hh>
    1818#include <nv/stl/iterator.hh>
    19 #include <nv/stl/type_traits/common.hh>
     19#include <nv/stl/type_traits/properties.hh>
    2020
    2121namespace nv
     
    3535                inline BlockAccessIterator copy_impl( BlockAccessIterator first, BlockAccessIterator last, OutputIterator out, true_type, block_access_iterator_tag, block_access_iterator_tag )
    3636                {
    37                         return raw_alias_copy( first, last, out )
     37                        return raw_alias_copy( first, last, out );
    3838                }
    3939
     
    4848                inline BlockAccessIterator copy_n_impl( BlockAccessIterator first, BlockAccessIterator n, OutputIterator out, true_type, block_access_iterator_tag, block_access_iterator_tag )
    4949                {
    50                         return raw_alias_copy_n( first, n, out )
     50                        return raw_alias_copy_n( first, n, out );
    5151                }
    5252        }
     
    5959                typedef typename iterator_traits< OutputIterator >::iterator_category output_iterator_category;
    6060                return detail::copy_impl( first, last, out,
    61                         has_trivial_copy<value_type>::value, iterator_category(), output_iterator_category() );
     61                        has_trivial_copy<value_type>::value, input_iterator_category(), output_iterator_category() );
    6262        }
    6363
     
    6969                typedef typename iterator_traits< OutputIterator >::iterator_category output_iterator_category;
    7070                return detail::copy_n_impl( first, n, out,
    71                         has_trivial_copy<value_type>::value, iterator_category(), output_iterator_category() );
     71                        has_trivial_copy<value_type>::value, input_iterator_category(), output_iterator_category() );
    7272        }
    7373
  • trunk/nv/stl/algorithm/fill.hh

    r395 r401  
    7070                {
    7171                        // TODO: version with T temp = T() for scalars
    72                         for ( ; n-- > 0; ++first ) *first = value;
     72                        for ( ; n-- > 0; ++first ) *first = T();
    7373                        return first;
    7474                }
     
    7777                BlockAccessIterator fill_default_n_impl( BlockAccessIterator first, size_t count, true_type, block_access_iterator_tag )
    7878                {
    79                         return BlockAccessIterator( raw_zero_n( first, count, (unsigned char)value ) );
     79                        return BlockAccessIterator( raw_zero_n( first, count ) );
    8080                }
    8181        }
  • trunk/nv/stl/container/contiguous_storage.hh

    r396 r401  
    4949                ~static_storage() = default;
    5050        protected:
    51                 typedef aligned_array_t<T, N, alignof( T ) > storage_type;
    52                 storage_type m_data;
     51                alignas( T ) unsigned char m_data[ N * sizeof( N ) ];
    5352        };
    5453       
  • trunk/nv/stl/container/contiguous_storage_policy.hh

    r399 r401  
    6363                ~resizable_storage()
    6464                {
    65                         if ( m_size > 0 ) reallocate( 0, false );
     65                        if ( m_size > 0 ) Storage::reallocate( 0, false );
    6666                }
    6767                static constexpr size_type max_size() { return size_type( 0x80000000 ); }
     
    8585                {
    8686                        m_size = other.m_size;
    87                         Storage::operator=( nv::move( o ) );
     87                        Storage::operator=( nv::move( other ) );
    8888                        other.m_size = 0;
    8989                        return *this;
     
    9595                        if ( new_size != m_size )
    9696                        {
    97                                 if ( reallocate( new_size, copy_needed ) )
     97                                if ( Storage::reallocate( new_size, copy_needed ) )
    9898                                {
    9999                                        m_size = new_size;
     
    132132                ~growable_storage()
    133133                {
    134                         if ( m_capacity > 0 ) reallocate( 0, false );
     134                        if ( m_capacity > 0 ) Storage::reallocate( 0, false );
    135135                }
    136136                static constexpr size_type max_size() { return size_type( 0x80000000 ); }
     
    169169                        {
    170170                                size_type new_capacity = NextCapacity::get( new_size - m_capacity, m_capacity, max_size() );
    171                                 if ( new_capacity > 0 && reallocate( new_capacity, true ) )
     171                                if ( new_capacity > 0 && Storage::reallocate( new_capacity, true ) )
    172172                                {
    173173                                        m_capacity = new_capacity;
     
    184184                        if ( new_capacity > m_capacity )
    185185                        {
    186                                 if ( reallocate( new_capacity, copy_needed ) )
     186                                if ( Storage::reallocate( new_capacity, copy_needed ) )
    187187                                {
    188188                                        m_capacity = new_capacity;
  • trunk/nv/stl/container/fixed_container_handler.hh

    r395 r401  
    3232                fixed_container_handler()
    3333                {
    34                         InitializePolicy::initialize( data(), data() + Storage::capacity() );
     34                        InitializePolicy::initialize( Storage::data(), Storage::data() + Storage::capacity() );
    3535                }
    3636
    3737                explicit fixed_container_handler( default_init )
    3838                {
    39                         uninitialized_construct( data(), data() + Storage::capacity() );
     39                        uninitialized_construct( Storage::data(), Storage::data() + Storage::capacity() );
    4040                }
    4141
    4242                explicit fixed_container_handler( const value_type& v )
    4343                {
    44                         uninitialized_fill( data(), data() + Storage::capacity(), v );
     44                        uninitialized_fill( Storage::data(), Storage::data() + Storage::capacity(), v );
    4545                }
    4646
    4747                ~fixed_container_handler()
    4848                {
    49                         InitializePolicy::destroy( data(), data() + Storage::capacity() );
     49                        InitializePolicy::destroy( Storage::data(), Storage::data() + Storage::capacity() );
    5050                }
    5151
  • trunk/nv/stl/container/growing_container_handler.hh

    r395 r401  
    2727        class growing_container_handler : public sized_container_handler< Storage, InitializePolicy >
    2828        {
    29                 typedef sized_container_handler< Storage, InitializePolicy > inherited;
    3029        public:
    3130                typedef typename Storage::value_type value_type;
     
    4039                void push_back( const value_type& e )
    4140                {
    42                         if ( Storage::try_grow( 1 ) ) copy_construct_object( data() + size() - 1, e );
     41                        if ( Storage::try_grow( 1 ) ) copy_construct_object( Storage::data() + Storage::size() - 1, e );
    4342                }
    4443                void push_back( value_type&& e )
    4544                {
    46                         if ( Storage::try_grow( 1 ) ) move_construct_object( data() + size() - 1, forward<value_type>( e ) );
     45                        if ( Storage::try_grow( 1 ) ) move_construct_object( Storage::data() + Storage::size() - 1, forward<value_type>( e ) );
    4746                }
    4847                template < typename... Args >
    4948                void emplace_back( Args&&... args )
    5049                {
    51                         if ( Storage::try_grow( 1 ) ) construct_object( data() + size() - 1, forward<Args>( args )... );
     50                        if ( Storage::try_grow( 1 ) ) construct_object( Storage::data() + Storage::size() - 1, forward<Args>( args )... );
    5251                }
    5352                void pop_back()
    5453                {
    55                         try_resize( size() - 1, true );
     54                        Storage::try_resize( Storage::size() - 1, true );
    5655                }
    5756
  • trunk/nv/stl/container/hash_table.hh

    r395 r401  
    3333        {
    3434        public:
    35                 typedef HashEntryPolicy base_type;
    36                 typedef typename base_type::value_type     value_type;
    37                 typedef typename base_type::entry_type     entry_type;
    38                 typedef typename base_type::hash_type      hash_type;
     35                typedef HashEntryPolicy                base_type;
     36                typedef typename base_type::value_type value_type;
     37                typedef typename base_type::entry_type entry_type;
     38                typedef typename base_type::hash_type  hash_type;
    3939
    4040                struct node_type : entry_type
     
    7272                        typedef iterator_base< IsConst > base_type;
    7373
    74                         constexpr node_iterator() : iterator_base( nullptr ) {}
    75                         constexpr node_iterator( const node_iterator& it ) : iterator_base( it.m_node ) {}
     74                        constexpr node_iterator() : base_type( nullptr ) {}
     75                        constexpr node_iterator( const node_iterator& it ) : base_type( it.m_node ) {}
    7676
    7777                        template < bool B, typename = enable_if_t< IsConst && !B > >
    7878                        constexpr node_iterator( const node_iterator< B >& it )
    79                                 : iterator_base( it.m_node )
     79                                : base_type( it.m_node )
    8080                        {
    8181                        }
     
    8787                        friend constexpr bool operator!=( const node_iterator& lhs, const node_iterator& rhs ) { return lhs.m_node != rhs.m_node; }
    8888                protected:
    89                         constexpr explicit node_iterator( node_type* node ) : iterator_base( node ) {}
     89                        constexpr explicit node_iterator( node_type* node ) : base_type( node ) {}
    9090
    9191                        template < typename T1, typename T2, typename T3 >
     
    9393                        template < bool B > friend struct node_iterator;
    9494
    95                         inline void increment() { m_node = m_node->next; }
     95                        inline void increment() { base_type::m_node = base_type::m_node->next; }
    9696
    9797                };
     
    103103
    104104                        constexpr table_iterator()
    105                                 : iterator_base(), m_bucket( nullptr )
     105                                : base_type(), m_bucket( nullptr )
    106106                        {
    107107                        }
    108108                        constexpr table_iterator( const table_iterator& other )
    109                                 : iterator_base( other ), m_bucket( other.m_bucket )
     109                                : base_type( other ), m_bucket( other.m_bucket )
    110110                        {
    111111                        }
     
    113113                        template < bool B, typename = enable_if_t< IsConst && !B > >
    114114                        constexpr table_iterator( const table_iterator< B >& it )
    115                                 : iterator_base( it.m_node ), m_bucket( it.m_bucket )
     115                                : base_type( it.m_node ), m_bucket( it.m_bucket )
    116116                        {
    117117                        }
    118118
    119119                        table_iterator& operator++() { increment(); return *this; }
    120                         table_iterator operator++( int ) { bucket_iterator temp( *this ); increment(); return temp; }
     120                        table_iterator operator++( int ) { table_iterator temp( *this ); increment(); return temp; }
    121121
    122122                        friend constexpr bool operator==( const table_iterator& lhs, const table_iterator& rhs ) { return lhs.m_node == rhs.m_node; }
     
    128128
    129129                        constexpr table_iterator( node_type* node, node_type** bucket )
    130                                 : iterator_base( node ), m_bucket( bucket )
     130                                : base_type( node ), m_bucket( bucket )
    131131                        {
    132132                        }
    133133                        constexpr explicit table_iterator( node_type** bucket )
    134                                 : iterator_base( *bucket ), m_bucket( bucket )
     134                                : base_type( *bucket ), m_bucket( bucket )
    135135                        {
    136136                        }
     
    140140                                ++m_bucket;
    141141                                while ( *m_bucket == nullptr ) ++m_bucket; // Sentinel guarantees end
    142                                 m_node = *m_bucket;
     142                                base_type::m_node = *m_bucket;
    143143                        }
    144144
    145145                        void increment()
    146146                        {
    147                                 m_node = m_node->next;
    148                                 while ( m_node == nullptr ) m_node = *++m_bucket; // Sentinel guarantees end
     147                                base_type::m_node = base_type::m_node->next;
     148                                while ( base_type::m_node == nullptr ) base_type::m_node = *++m_bucket; // Sentinel guarantees end
    149149                        }
    150150                        node_type** m_bucket;
     
    338338                size_type bucket_index( hash_type hash_code, size_t b_count ) const
    339339                {
    340                         return RangeHashPolicy::get<hash_type>( hash_code, b_count );
     340                        return RangeHashPolicy::template get<hash_type>( hash_code, b_count );
    341341                }
    342342                node_type** allocate_buckets( size_type new_count )
     
    408408                typedef value_type&                        reference;
    409409                typedef const value_type&                  const_reference;
     410                typedef value_type*                        pointer;
     411                typedef const value_type*                  const_pointer;
    410412
    411413                typedef typename base_type::local_iterator       local_iterator;
     
    519521                                ++first;
    520522                        }
    521                         return base_type::unconst( cend() );
     523                        return base_type::unconst( this->cend() );
    522524                }
    523525
  • trunk/nv/stl/container/hash_table_policy.hh

    r395 r401  
    193193                };
    194194
    195                 constexpr bool entry_compare( const entry_type* entry, const key_type& key, hash_type )
     195                constexpr bool entry_compare( const entry_type* entry, const key_type& key, hash_type ) const
    196196                {
    197197                        return base_type::compare( entry->value.first, key );
    198198                }
    199199
    200                 constexpr bool entry_compare( const entry_type* entry, const value_type& value, hash_type )
     200                constexpr bool entry_compare( const entry_type* entry, const value_type& value, hash_type ) const
    201201                {
    202202                        return base_type::compare( entry->value.first, value.first );
    203203                }
    204204
    205                 inline void entry_construct( entry_type* entry, const value_type& value, hash_type )
     205                inline void entry_construct( entry_type* entry, const value_type& value, hash_type ) const
    206206                {
    207207                        copy_construct_object( &(entry->value), value );
    208208                }
    209209
    210                 constexpr hash_type get_entry_hash( const entry_type* entry )
     210                constexpr hash_type get_entry_hash( const entry_type* entry ) const
    211211                {
    212212                        return base_type::get_hash( entry->value.first );
    213213                }
    214                 constexpr hash_type get_value_hash( const value_type& value )
     214                constexpr hash_type get_value_hash( const value_type& value ) const
    215215                {
    216216                        return base_type::get_hash( value.first );
     
    239239                };
    240240
    241                 constexpr bool entry_compare( const entry_type* entry, const key_type& key, hash_type h )
     241                constexpr bool entry_compare( const entry_type* entry, const key_type& key, hash_type h ) const
    242242                {
    243243                        return entry->hash_code == h && base_type::compare( entry->value.first, key );
    244244                }
    245                 constexpr bool entry_compare( const entry_type* entry, const value_type& value, hash_type h )
     245                constexpr bool entry_compare( const entry_type* entry, const value_type& value, hash_type h ) const
    246246                {
    247247                        return entry->hash_code == h &&  base_type::compare( entry->value.first, value.first );
    248248                }
    249249
    250                 constexpr hash_type get_entry_hash( const entry_type* entry )
     250                constexpr hash_type get_entry_hash( const entry_type* entry ) const
    251251                {
    252252                        return entry->hash_code;
    253253                }
    254                 constexpr hash_type get_value_hash( const value_type& value )
     254                constexpr hash_type get_value_hash( const value_type& value ) const
    255255                {
    256256                        return base_type::get_hash( value.first );
    257257                }
    258                 inline void construct( entry_type* entry, const value_type& value, hash_type hash_code )
     258                inline void construct( entry_type* entry, const value_type& value, hash_type hash_code ) const
    259259                {
    260260                        copy_construct_object( &(entry->value), value );
    261                         entry.hash_code = hash_code;
     261                        entry->hash_code = hash_code;
    262262                }
    263263        };
  • trunk/nv/stl/container/initialize_policy.hh

    r395 r401  
    5858                inline static ForwardIterator copy( InputIterator first, InputIterator last, ForwardIterator out )
    5959                {
    60                         return detail::uninitialized_copy( first, last, out, true_type );
     60                        return detail::uninitialized_copy_impl( first, last, out, true_type() );
    6161                }
    6262                template < typename ForwardIterator >
  • trunk/nv/stl/container/sized_container_handler.hh

    r395 r401  
    7878                inline void assign( InputIterator first, InputIterator last )
    7979                {
     80                        // TODO: distance can't be called on destructive iterators - check
     81                        //   and use pushback if needed?
    8082                        size_type d = distance( first, last );
    81                         if ( d != Storage::size() && Storage::try_resize( sz, false ) )
     83                        if ( d != Storage::size() && Storage::try_resize( d, false ) )
    8284                                InitializePolicy::copy( first, last, Storage::data() );
    8385                }
  • trunk/nv/stl/functional/hash.hh

    r400 r401  
    137137        constexpr H hash_value( const T& value )
    138138        {
    139                 return hash<T, H>::get( h );
     139                return hash<T, H>::get( value );
    140140        }
    141141
     
    183183
    184184                constexpr hashed_element( const T& v, H h ) : value(v), hash( h ) {}
    185                 constexpr hashed_element( T&& v, H h ) : value( std::forward<T>(v) ), hash( h ) {}
     185                constexpr hashed_element( T&& v, H h ) : value( nv::forward<T>(v) ), hash( h ) {}
    186186
    187187                hashed_element( const hashed_element& ) = default;
  • trunk/nv/stl/iterator.hh

    r395 r401  
    1515
    1616#include <nv/common.hh>
     17#include <nv/stl/type_traits/common.hh>
    1718
    1819namespace nv
  • trunk/nv/stl/memory.hh

    r400 r401  
    1919#include <nv/stl/type_traits/properties.hh>
    2020#include <nv/stl/type_traits/alignment.hh>
     21#include <nv/stl/algorithm/fill.hh>
     22#include <nv/stl/algorithm/copy.hh>
    2123#include <nv/stl/utility.hh>
    2224#include <nv/stl/iterator.hh>
     
    277279                inline ForwardIterator uninitialized_copy_impl( InputIterator first, InputIterator last, ForwardIterator out, true_type )
    278280                {
    279                         return ForwardIterator( nvmemmove( out, first, (size_t)( (uintptr_t)last - (uintptr_t)first ) ) );
     281                        return ForwardIterator( raw_alias_copy( first, last, out ) );
    280282                }
    281283
     
    290292                                ::new ( static_cast<void*>( addressof( *dest ) ) ) value_type( *src );
    291293                        }
    292                         return it;
     294                        return dest;
    293295                }
    294296
     
    296298                inline ForwardIterator uninitialized_copy_n_impl( InputIterator first, size_t count, ForwardIterator out, true_type )
    297299                {
    298                         typedef typename iterator_traits<ForwardIterator>::value_type value_type;
    299                         return ForwardIterator( nvmemmove( out, first, count * sizeof( value_type ) ) );
     300                        return ForwardIterator( raw_alias_copy_n( out, first, count ) );
    300301                }
    301302
  • trunk/nv/stl/string.hh

    r400 r401  
    100100                typedef string_base< detail::add_iterators< Storage > > this_type;
    101101        public:
    102                 typedef Storage                             storage_type;
    103                 typedef typename base_type::value_type      value_type;
    104                 typedef typename base_type::pointer         pointer;
    105                 typedef typename base_type::const_pointer   const_pointer;
    106                 typedef typename base_type::reference       reference;
    107                 typedef typename base_type::const_reference const_reference;
    108                 typedef typename base_type::iterator        iterator;
    109                 typedef typename base_type::const_iterator  const_iterator;
    110                 typedef typename base_type::size_type       size_type;
    111                 typedef typename base_type::difference_type difference_type;
     102                typedef Storage                                     storage_type;
     103                typedef typename base_type::value_type              value_type;
     104                typedef typename base_type::pointer                 pointer;
     105                typedef typename base_type::const_pointer           const_pointer;
     106                typedef typename base_type::reference               reference;
     107                typedef typename base_type::const_reference         const_reference;
     108                typedef typename base_type::iterator                iterator;
     109                typedef typename base_type::const_iterator          const_iterator;
     110                typedef typename base_type::reverse_iterator        reverse_iterator;
     111                typedef typename base_type::const_reverse_iterator  const_reverse_iterator;
     112                typedef typename base_type::size_type               size_type;
     113                typedef typename base_type::difference_type         difference_type;
    112114
    113115                static constexpr size_type npos = size_type( -1 );
     
    116118                inline std::string to_string() const
    117119                {
    118                         return std::string( data(), size() );
     120                        return std::string( this->data(), this->size() );
    119121                }
    120122
    121                 inline size_type length()   const { return size(); }
     123                inline size_type length()   const { return this->size(); }
    122124
    123125                // access
    124                 inline value_type operator[]( size_type i ) const { return data()[i]; }
     126                inline value_type operator[]( size_type i ) const { return this->data()[i]; }
    125127                inline value_type at( size_type i ) const
    126128                {
    127129                        //      if ( i >= m_data ) NV_THROW( out_of_range( "string_ref::at" ) );
    128                         return data()[i];
    129                 }
    130 
    131                 inline value_type front()        const { return data()[0]; }
    132                 inline value_type back()         const { return data()[size() - 1]; }
     130                        return this->data()[i];
     131                }
     132
     133                inline value_type front()        const { return this->data()[0]; }
     134                inline value_type back()         const { return this->data()[this->size() - 1]; }
    133135
    134136                // string operations
     
    155157
    156158                template < typename H = size_type >
    157                 inline H hash() const
     159                inline H get_hash() const
    158160                {
    159161                        return hash_string< size_type >( this->data(), this->size() );
     
    175177                static H get( const T& value )
    176178                {
    177                         return value.hash< H >();
     179                        return value.template get_hash< H >();
    178180                }
    179181                inline H operator()( const T& value ) const { return get( value ); }
     
    277279
    278280        template < typename Storage >
    279         inline auto string_base< Storage >::find( value_type c, size_type pos = 0 ) const -> size_type
     281        inline auto string_base< Storage >::find( value_type c, size_type pos /*= 0*/ ) const -> size_type
    280282        {
    281283                if ( pos >= this->size() ) return npos;
     
    284286        }
    285287        template < typename Storage >
    286         inline auto string_base< Storage >::find( const string_view& s, size_type pos = 0 ) const -> size_type
     288        inline auto string_base< Storage >::find( const string_view& s, size_type pos /*= 0*/ ) const -> size_type
    287289        {
    288290                if ( pos >= this->size() ) return npos;
     
    292294
    293295        template < typename Storage >
    294         inline auto string_base< Storage >::rfind( value_type c, size_type pos = 0 ) const -> size_type
     296        inline auto string_base< Storage >::rfind( value_type c, size_type pos /*= 0*/ ) const -> size_type
    295297        {
    296298                if ( pos >= this->size() ) return npos;
     
    299301        }
    300302        template < typename Storage >
    301         inline auto string_base< Storage >::rfind( const string_view& s, size_type pos = 0 ) const -> size_type
     303        inline auto string_base< Storage >::rfind( const string_view& s, size_type pos /*= 0*/ ) const -> size_type
    302304        {
    303305                if ( pos >= this->size() ) return npos;
  • trunk/nv/stl/type_traits/alignment.hh

    r395 r401  
    1515
    1616#include <nv/stl/type_traits/common.hh>
     17#include <nv/stl/type_traits/properties.hh>
    1718
    1819namespace nv
     
    4546#endif         
    4647
    47 #if NV_COMPILER == NV_CLANG
    48         template< typename T, size_t Size, size_t Align >
    49         struct aligned_array
    50         {
    51                 typedef T alignas( Align ) type[Size];
    52         };
    53 #elif NV_COMPILER == NV_GNUC
    54         template< typename T, size_t Size, size_t Align >
    55         struct aligned_array
    56         {
    57                 typedef T __attribute__( ( aligned( Align ) ) ) type[Size];
    58         };
    59 #else
    60         // TODO: remove this shit after moving to MSVC 2015
    61         template< typename T, size_t Size, size_t Align >
    62         struct aligned_array;
    63 
    64         // According to LLVM ( https://llvm.org/svn/llvm-project/llvm/trunk/include/llvm/Support/AlignOf.h )
    65         // MSVC has problems with align below 16...
    66 #define NV_ALIGNED_ARRAY(N) \
    67         template< typename T, size_t Size > \
    68         struct aligned_array< T, Size, N >  \
    69                         { \
    70                 typedef __declspec( align(N) ) T type[Size]; \
    71                         };
    72 
    73         NV_ALIGNED_ARRAY( 1 )
    74                 NV_ALIGNED_ARRAY( 2 )
    75                 NV_ALIGNED_ARRAY( 4 )
    76                 NV_ALIGNED_ARRAY( 8 )
    77                 NV_ALIGNED_ARRAY( 16 )
    78                 NV_ALIGNED_ARRAY( 32 )
    79                 NV_ALIGNED_ARRAY( 64 )
    80                 NV_ALIGNED_ARRAY( 128 )
    81 
    82 #undef NV_ALIGNED_ARRAY
    83 #endif
    84        
    85         template< typename T, size_t Size, size_t Align >
    86         using aligned_array_t = typename aligned_array< T, Size, Align >::type;
    87 
    8848        template< size_t Size, size_t Align = alignof( max_align_t ) >
    8949        struct aligned_storage
     
    9151                struct type
    9252                {
    93                         typename aligned_array< unsigned char, Size, Align >::type data;
     53                        alignas( Align ) unsigned char data[ Size ];
    9454                };
    9555        };
     
    12484                static constexpr size_t max_length = detail::size_max < Size, sizeof( Types )... >::value;
    12585                static constexpr size_t alignment_value = detail::size_max < alignment_of< Types >::value... >::value;
    126                 struct type
    127                 {
    128                         typename aligned_array< unsigned char, max_length, alignment_value >::type data;
    129                 };
     86                using type = aligned_storage_t< max_length, alignment_value >;
    13087        };
    13188
  • trunk/nv/stl/type_traits/common.hh

    r395 r401  
    9696        template< typename T > struct add_reference             
    9797        {
    98                 typedef typename conditional< is_reference<T>::value, T, T&& > type;
     98                typedef conditional< is_reference<T>::value, T, T&& > type;
    9999        };
    100100        template<> struct add_reference < void >                { typedef void type; };
  • trunk/nv/stl/type_traits/transforms.hh

    r395 r401  
    259259#else
    260260        template < typename F, typename... Args >
    261         struct result_of < F( Args... ) > { typedef decltype( invoke( declval<T>(), declval<Args>()... ) ) type; };
     261        struct result_of < F( Args... ) > { typedef decltype( invoke( declval<F>(), declval<Args>()... ) ) type; };
    262262#endif
    263263
  • trunk/nv/stl/unordered_map.hh

    r395 r401  
    4545                typedef hash_table< hash_table_entry_stl_map< Key, T, size_t, KeyEqual, Hash > > base_type;
    4646                typedef unordered_map< Key, T, Hash, KeyEqual >                                  this_type;
     47                typedef typename base_type::value_type                                           value_type;
     48                typedef typename base_type::pointer                                              pointer;
     49                typedef typename base_type::const_pointer                                        const_pointer;
     50                typedef typename base_type::reference                                            reference;
     51                typedef typename base_type::const_reference                                      const_reference;
     52                typedef typename base_type::iterator                                             iterator;
     53                typedef typename base_type::const_iterator                                       const_iterator;
    4754                typedef typename base_type::size_type                                            size_type;
     55                typedef typename base_type::difference_type                                      difference_type;
    4856                typedef typename base_type::key_type                                             key_type;
    4957                typedef typename base_type::mapped_type                                          mapped_type;
    50                 typedef typename base_type::value_type                                           value_type;
    5158                typedef typename base_type::node_type                                            node_type;
    5259                typedef typename base_type::insert_return_type                                   insert_return_type;
    53                 typedef typename base_type::iterator                                             iterator;
    5460                typedef Hash                                                                     hasher;
    5561                typedef KeyEqual                                                                 key_equal;
  • trunk/src/core/time.cc

    r395 r401  
    1717#pragma intrinsic(__rdtsc)
    1818#else
    19 #if NV_COMPILER == NV_GNUC && NV_PLATFORM == NV_WINDOWS
     19#if NV_PLATFORM == NV_WINDOWS
    2020// mingw doesn't have usleep nor nanosleep...
    2121#include <windows.h>
     
    7171        Sleep( ms );
    7272#else
    73 #if NV_COMPILER == NV_GNUC && NV_PLATFORM == NV_WINDOWS
     73#if NV_PLATFORM == NV_WINDOWS
    7474        Sleep( ms );
    7575#else
  • trunk/src/formats/md5_loader.cc

    r399 r401  
    1010#include "nv/stl/vector.hh"
    1111#include "nv/io/std_stream.hh"
     12
     13#include <stdio.h>  // sscanf
     14#include <stdlib.h> // atof
    1215
    1316using namespace nv;
  • trunk/src/gui/gui_environment.cc

    r395 r401  
    99#include "nv/gui/gui_renderer.hh"
    1010
     11#include <algorithm> // std::find on std::list
    1112
    1213        /*
Note: See TracChangeset for help on using the changeset viewer.