Ignore:
Timestamp:
Jul 4, 2023, 2:54:31 PM (11 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
4c2e561
Parents:
b2ecd48
Message:

Combined some fixes from the variaus scoped containers. Reducing redeclarations, internal type names now use one consistent naming scheme (it is different from the public naming convention), a whitespace fix and shrinking a few functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/ScopedSet.h

    rb2ecd48 r7f1be01  
    4747        /// Starts a new scope
    4848        void beginScope() {
    49                 Scope scope;
    50                 scopes.push_back(scope);
     49                scopes.emplace_back();
    5150        }
    5251
     
    8584        iterator findNext( const_iterator &it, const Value &key ) {
    8685                if ( it.i == 0 ) return end();
    87                         for ( size_type i = it.i - 1; ; --i ) {
     86                for ( size_type i = it.i - 1; ; --i ) {
    8887                        typename Scope::iterator val = scopes[i].find( key );
    8988                        if ( val != scopes[i].end() ) return iterator( scopes, val, i );
     
    112111        friend class ScopedSet;
    113112        friend class const_iterator;
    114         typedef typename std::set< Value >::iterator wrapped_iterator;
    115         typedef typename std::vector< std::set< Value > > scope_list;
    116         typedef typename scope_list::size_type size_type;
     113        typedef typename Scope::iterator wrapped_iterator;
     114        typedef typename ScopeList::size_type size_type;
    117115
    118116        /// Checks if this iterator points to a valid item
     
    133131        }
    134132
    135         iterator(scope_list const &_scopes, const wrapped_iterator &_it, size_type _i)
     133        iterator(ScopeList const &_scopes, const wrapped_iterator &_it, size_type _i)
    136134                : scopes(&_scopes), it(_it), i(_i) {}
    137135public:
     
    176174
    177175private:
    178         scope_list const *scopes;
     176        ScopeList const *scopes;
    179177        wrapped_iterator it;
    180178        size_type i;
     
    185183                public std::iterator< std::bidirectional_iterator_tag, value_type > {
    186184        friend class ScopedSet;
    187         typedef typename std::set< Value >::iterator wrapped_iterator;
    188         typedef typename std::set< Value >::const_iterator wrapped_const_iterator;
    189         typedef typename std::vector< std::set< Value > > scope_list;
    190         typedef typename scope_list::size_type size_type;
     185        typedef typename Scope::iterator wrapped_iterator;
     186        typedef typename Scope::const_iterator wrapped_const_iterator;
     187        typedef typename ScopeList::size_type size_type;
    191188
    192189        /// Checks if this iterator points to a valid item
     
    207204        }
    208205
    209         const_iterator(scope_list const &_scopes, const wrapped_const_iterator &_it, size_type _i)
     206        const_iterator(ScopeList const &_scopes, const wrapped_const_iterator &_it, size_type _i)
    210207                : scopes(&_scopes), it(_it), i(_i) {}
    211208public:
     
    255252
    256253private:
    257         scope_list const *scopes;
     254        ScopeList const *scopes;
    258255        wrapped_const_iterator it;
    259256        size_type i;
Note: See TracChangeset for help on using the changeset viewer.