Changeset 234b1cb for src/Common
- Timestamp:
- Jun 20, 2019, 2:32:55 PM (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:
- b8524ca, f5edcb4
- Parents:
- c0f9efe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
rc0f9efe r234b1cb 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" … … 145 145 return ret; 146 146 } // switch 147 } 148 149 /// Splice src onto the end of dst, clearing src 150 template< typename T > 151 void splice( std::vector< T > & dst, std::vector< T > & src ) { 152 dst.reserve( dst.size() + src.size() ); 153 for ( T & x : src ) { dst.emplace_back( std::move( x ) ); } 154 src.clear(); 155 } 156 157 /// Splice src onto the begining of dst, clearing src 158 template< typename T > 159 void spliceBegin( std::vector< T > & dst, std::vector< T > & src ) { 160 splice( src, dst ); 161 dst.swap( src ); 147 162 } 148 163
Note:
See TracChangeset
for help on using the changeset viewer.