forked from boostorg/array
update from Nico
[SVN r10918]
This commit is contained in:
@ -29,23 +29,25 @@ int main()<BR>
|
||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// create and initialize array</FONT></I><BR>
|
||||
array<int,10> a = { { 1, 2, 3, 4, 5 } };<BR>
|
||||
<BR>
|
||||
PRINT_ELEMENTS(a);<BR>
|
||||
print_elements(a);<BR>
|
||||
<BR>
|
||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// modify elements directly</FONT></I><BR>
|
||||
for (unsigned i=0; i<a.size(); ++i) {<BR>
|
||||
++a[i];<BR>
|
||||
}<BR>
|
||||
PRINT_ELEMENTS(a);<BR>
|
||||
print_elements(a);<BR>
|
||||
<BR>
|
||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// change order using an STL algorithm</FONT></I><BR>
|
||||
reverse(a.begin(),a.end());<BR>
|
||||
PRINT_ELEMENTS(a);<BR>
|
||||
print_elements(a);<BR>
|
||||
<BR>
|
||||
<I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// negate elements using STL framework</FONT></I><BR>
|
||||
transform(a.begin(),a.end(), <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// source</FONT></I><BR>
|
||||
a.begin(), <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// destination</FONT></I><BR>
|
||||
negate<int>()); <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// operation</FONT></I><BR>
|
||||
PRINT_ELEMENTS(a);<BR>
|
||||
print_elements(a);<BR>
|
||||
<BR>
|
||||
return 0; <I><FONT face="Arial,Helvetica,sans-serif" color="0000FF" >// makes Visual-C++ compiler happy</FONT></I><BR>
|
||||
}<BR>
|
||||
<BR>
|
||||
</SPAN>
|
||||
|
Reference in New Issue
Block a user