sources/list.h

changeset 182
20ca0a6be175
parent 181
e254398fcc7c
child 185
e83ec58cc458
equal deleted inserted replaced
181:e254398fcc7c 182:20ca0a6be175
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #pragma once 31 #pragma once
32 #include <vector> 32 #include <vector>
33 #include <string>
33 #include "basics.h" 34 #include "basics.h"
34 #include "range.h" 35 #include "range.h"
35 BEGIN_ZFC_NAMESPACE 36 BEGIN_ZFC_NAMESPACE
36 37
37 template<typename T> 38 template<typename T>
42 { 43 {
43 return *(container.begin() + container.size() - 1); 44 return *(container.begin() + container.size() - 1);
44 } 45 }
45 46
46 using ByteArray = std::vector<unsigned char>; 47 using ByteArray = std::vector<unsigned char>;
47 class String quote(const ByteArray& bytes); 48 std::string quote(const ByteArray& bytes);
48 49
49 template<typename T> 50 template<typename T>
50 T splice(const T& container, int start, int end, int step = 1) 51 T splice(const T& container, int start, int end, int step = 1)
51 { 52 {
52 start = clamp(start, 0, static_cast<int>(container.size())); 53 start = clamp(start, 0, static_cast<int>(container.size()));

mercurial