Changeset 54dd994 for src/Common/utility.h
- Timestamp:
- Jun 24, 2019, 10:30:47 AM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 84917e2
- Parents:
- 3c6e417 (diff), 9e0a360 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
r3c6e417 r54dd994 16 16 #pragma once 17 17 18 #include <cassert> 18 19 #include <cctype> 19 20 #include <algorithm> … … 27 28 #include <type_traits> 28 29 #include <utility> 29 30 #include <cassert> 30 #include <vector> 31 31 32 32 #include "Common/Indenter.h" 33 33 34 34 class Expression; 35 36 /// bring std::move into global scope 37 using std::move; 38 39 /// partner to move that copies any copyable type 40 template<typename T> 41 T copy( const T & x ) { return x; } 35 42 36 43 template< typename T > … … 145 152 return ret; 146 153 } // switch 154 } 155 156 /// Splice src onto the end of dst, clearing src 157 template< typename T > 158 void splice( std::vector< T > & dst, std::vector< T > & src ) { 159 dst.reserve( dst.size() + src.size() ); 160 for ( T & x : src ) { dst.emplace_back( std::move( x ) ); } 161 src.clear(); 162 } 163 164 /// Splice src onto the begining of dst, clearing src 165 template< typename T > 166 void spliceBegin( std::vector< T > & dst, std::vector< T > & src ) { 167 splice( src, dst ); 168 dst.swap( src ); 147 169 } 148 170
Note:
See TracChangeset
for help on using the changeset viewer.