sources/list.h

changeset 191
2e6cbacafdc7
parent 190
90bf9049e5eb
equal deleted inserted replaced
190:90bf9049e5eb 191:2e6cbacafdc7
33 #include <string> 33 #include <string>
34 #include "basics.h" 34 #include "basics.h"
35 BEGIN_ZFC_NAMESPACE 35 BEGIN_ZFC_NAMESPACE
36 36
37 template<typename T> 37 template<typename T>
38 using Vector = std::vector<T>;
39
40 template<typename T>
41 auto& last(T& container) 38 auto& last(T& container)
42 { 39 {
43 return *(container.begin() + container.size() - 1); 40 return *(container.begin() + container.size() - 1);
44 } 41 }
45 42
46 using ByteArray = std::vector<unsigned char>; 43 std::string quote(const std::vector<unsigned char>& bytes);
47 std::string quote(const ByteArray& bytes);
48 44
49 template<typename T> 45 template<typename T>
50 T splice(const T& container, int start, int end, int step = 1) 46 T splice(const T& container, int start, int end, int step = 1)
51 { 47 {
52 start = clamp(start, 0, static_cast<int>(container.size())); 48 start = clamp(start, 0, static_cast<int>(container.size()));

mercurial