Changeset fc1a3e2 for src/Common


Ignore:
Timestamp:
Apr 19, 2024, 2:36:52 PM (5 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
ba97ebf
Parents:
b9b6efb
Message:

Style update. Focused on indentation and trailing whitespace.

Location:
src/Common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PersistentMap.h

    rb9b6efb rfc1a3e2  
    2323#include <utility>        // for forward, move
    2424
    25 /// Wraps a hash table in a persistent data structure, using a technique based 
    26 /// on the persistent array in Conchon & Filliatre "A Persistent Union-Find 
     25/// Wraps a hash table in a persistent data structure, using a technique based
     26/// on the persistent array in Conchon & Filliatre "A Persistent Union-Find
    2727/// Data Structure"
    2828
    2929template<typename Key, typename Val,
    30          typename Hash = std::hash<Key>, typename Eq = std::equal_to<Key>>
    31 class PersistentMap 
     30                typename Hash = std::hash<Key>, typename Eq = std::equal_to<Key>>
     31class PersistentMap
    3232        : public std::enable_shared_from_this<PersistentMap<Key, Val, Hash, Eq>> {
    3333public:
     
    3838
    3939        /// Types of version nodes
    40         enum Mode { 
     40        enum Mode {
    4141                BASE,  ///< Root node of version tree
    4242                REM,   ///< Key removal node
     
    6363                Ptr base;  ///< Modified map
    6464                Key key;   ///< Key removed
    65                
     65
    6666                template<typename P, typename K>
    6767                Rem(P&& p, K&& k) : base(std::forward<P>(p)), key(std::forward<K>(k)) {}
     
    155155                                auto it = base_map.find( self.key );
    156156
    157                                 base->template init<Ins>( 
     157                                base->template init<Ins>(
    158158                                                mut_this->shared_from_this(), std::move(self.key), std::move(it->second) );
    159159                                base->mode = INS;
     
    175175                                auto it = base_map.find( self.key );
    176176
    177                                 base->template init<Ins>( 
     177                                base->template init<Ins>(
    178178                                                mut_this->shared_from_this(), std::move(self.key), std::move(it->second) );
    179179                                base->mode = UPD;
     
    267267        Ptr erase(const Key& k) {
    268268                reroot();
    269                
     269
    270270                // exit early if key does not exist in map
    271271                if ( ! as<Base>().count( k ) ) return this->shared_from_this();
  • src/Common/VectorMap.h

    rb9b6efb rfc1a3e2  
    3636        typedef const value_type* pointer;
    3737        typedef const const_value_type* const_pointer;
    38        
    39         class iterator : public std::iterator< std::random_access_iterator_tag,
    40                                                value_type,
    41                                                                                    difference_type,
    42                                                                                    pointer,
    43                                                                                    reference > {
    44         friend class VectorMap;
    45         friend class const_iterator;
    46        
     38
     39        class iterator : public std::iterator<
     40                        std::random_access_iterator_tag,
     41                        value_type, difference_type, pointer, reference > {
     42                friend class VectorMap;
     43                friend class const_iterator;
     44
    4745                value_type data;
    4846
     
    9997                        return data.first == o.data.first && &data.second == &o.data.second;
    10098                }
    101                
     99
    102100                bool operator!= (const iterator& that) const { return !(*this == that); }
    103101
     
    111109        };
    112110
    113         class const_iterator : public std::iterator< std::bidirectional_iterator_tag,
    114                                                      const_value_type,
    115                                                                                                   difference_type,
    116                                                                                                   const_pointer,
    117                                                                                                   const_reference  > {
    118         friend class VectorMap;
     111        class const_iterator : public std::iterator<
     112                        std::bidirectional_iterator_tag,
     113                        const_value_type, difference_type, const_pointer, const_reference > {
     114                friend class VectorMap;
    119115                const_value_type data;
    120116
     
    181177                        return data.first == o.data.first && &data.second == &o.data.second;
    182178                }
    183                
     179
    184180                bool operator!= (const const_iterator& that) const { return !(*this == that); }
    185181
     
    233229
    234230template<typename T>
    235 typename VectorMap<T>::iterator operator+ (typename VectorMap<T>::difference_type i,
    236                                            const typename VectorMap<T>::iterator& it) {
     231typename VectorMap<T>::iterator operator+(
     232                typename VectorMap<T>::difference_type i,
     233                const typename VectorMap<T>::iterator& it) {
    237234        return it + i;
    238235}
    239236
    240237template<typename T>
    241 typename VectorMap<T>::const_iterator operator+ (typename VectorMap<T>::difference_type i,
    242                                                  const typename VectorMap<T>::const_iterator& it) {
     238typename VectorMap<T>::const_iterator operator+(
     239                typename VectorMap<T>::difference_type i,
     240                const typename VectorMap<T>::const_iterator& it) {
    243241        return it + i;
    244242}
Note: See TracChangeset for help on using the changeset viewer.