sources/list.h

branch
protocol5
changeset 165
718a8c4df538
parent 164
e3794f48a589
child 179
7fc34735178e
--- a/sources/list.h	Fri Jul 22 18:03:50 2016 +0300
+++ b/sources/list.h	Sat Jul 23 12:27:03 2016 +0300
@@ -270,8 +270,8 @@
 
 	Self splice(int start, int end, int step = 1) const
 	{
-		start = clamp(start, 0, size() - 1);
-		end = clamp(end, 0, size() - 1);
+		start = clamp(start, 0, size());
+		end = clamp(end, 0, size());
 
 		if (end <= start)
 		{
@@ -399,6 +399,23 @@
 	}
 };
 
-typedef Vector<unsigned char> ByteArray;
+class ByteArray : public Vector<unsigned char>
+{
+public:
+	ByteArray(std::initializer_list<unsigned char> initializerList);
+
+	template<typename ...Args>
+	ByteArray(Args&& ...args);
+
+	class String quote() const;
+};
+
+/*!
+ * \brief Constructs a byte array by passing all arguments to Vector<unsigned char>'s constructor.
+ * \param args Arguments to pass.
+ */
+template<typename ...Args>
+ByteArray::ByteArray(Args&& ...args) :
+    Vector<unsigned char>(args...) {}
 
 END_ZFC_NAMESPACE

mercurial