History

reverse feature and unit test + example

Andrew Aday committed 3 years ago

Commit e7ef3c81 parent 7686e906 files · +122 −0Browse files

Showing the changes to src/core/chuck_oo.cpp (1 of 6 files). Show all

Unified · Split

src/core/chuck_oo.cpp+60−0
@@ -38,6 +38,7 @@ · 37 unmodified lines
3838 #include "chuck_errmsg.h"
3939 #include "chuck_dl.h"
4040
41+#include <algorithm>
4142 #include <iostream>
4243 #include <sstream>
4344 #include <iomanip>
@@ -699,6 +700,18 @@ void Chuck_Array4::get_keys( std::vector<std::string> & keys ) · 655 unmodified lines
699700
700701
701702
703+//-----------------------------------------------------------------------------
704+// name: reverse()
705+// desc: reverses array in-place
706+//-----------------------------------------------------------------------------
707+void Chuck_Array4::reverse( )
708+{
709+ std::reverse(m_vector.begin(), m_vector.end());
710+}
711+
712+
713+
714+
702715 //-----------------------------------------------------------------------------
703716 // name: back()
704717 // desc: ...
@@ -1087,6 +1100,18 @@ void Chuck_Array8::get_keys( std::vector<std::string> & keys ) · 382 unmodified lines
10871100
10881101
10891102
1103+//-----------------------------------------------------------------------------
1104+// name: reverse()
1105+// desc: reverses array in-place
1106+//-----------------------------------------------------------------------------
1107+void Chuck_Array8::reverse( )
1108+{
1109+ std::reverse(m_vector.begin(), m_vector.end());
1110+}
1111+
1112+
1113+
1114+
10901115 //-----------------------------------------------------------------------------
10911116 // name: back()
10921117 // desc: ...
@@ -1436,6 +1461,18 @@ void Chuck_Array16::get_keys( std::vector<std::string> & keys ) · 343 unmodified lines
14361461
14371462
14381463
1464+//-----------------------------------------------------------------------------
1465+// name: reverse()
1466+// desc: reverses array in-place
1467+//-----------------------------------------------------------------------------
1468+void Chuck_Array16::reverse( )
1469+{
1470+ std::reverse(m_vector.begin(), m_vector.end());
1471+}
1472+
1473+
1474+
1475+
14391476 //-----------------------------------------------------------------------------
14401477 // name: back()
14411478 // desc: ...
@@ -1875,6 +1912,18 @@ void Chuck_Array24::get_keys( std::vector<std::string> & keys ) · 433 unmodified lines
18751912
18761913
18771914
1915+//-----------------------------------------------------------------------------
1916+// name: reverse()
1917+// desc: reverses array in-place
1918+//-----------------------------------------------------------------------------
1919+void Chuck_Array24::reverse( )
1920+{
1921+ std::reverse(m_vector.begin(), m_vector.end());
1922+}
1923+
1924+
1925+
1926+
18781927 //-----------------------------------------------------------------------------
18791928 // name: Chuck_Array32()
18801929 // desc: constructor
@@ -2211,6 +2260,17 @@ void Chuck_Array32::get_keys( std::vector<std::string> & keys ) · 330 unmodified lines
22112260
22122261
22132262
2263+//-----------------------------------------------------------------------------
2264+// name: reverse()
2265+// desc: reverses array in-place
2266+//-----------------------------------------------------------------------------
2267+void Chuck_Array32::reverse( )
2268+{
2269+ std::reverse(m_vector.begin(), m_vector.end());
2270+}
2271+
2272+
2273+
22142274
22152275 // static
22162276 t_CKUINT Chuck_Event::our_can_wait = 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t