You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2006/03/28 01:24:59 UTC
svn commit: r389321 - in /incubator/stdcxx/trunk/examples/manual: merge.cpp
out/merge.out
Author: sebor
Date: Mon Mar 27 15:24:56 2006
New Revision: 389321
URL: http://svn.apache.org/viewcvs?rev=389321&view=rev
Log:
2006-03-27 Martin Sebor <se...@roguewave.com>
* merge.cpp: Used '\n' instead of endl.
* merge.out: Added terminating newline.
Modified:
incubator/stdcxx/trunk/examples/manual/merge.cpp
incubator/stdcxx/trunk/examples/manual/out/merge.out
Modified: incubator/stdcxx/trunk/examples/manual/merge.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/examples/manual/merge.cpp?rev=389321&r1=389320&r2=389321&view=diff
==============================================================================
--- incubator/stdcxx/trunk/examples/manual/merge.cpp (original)
+++ incubator/stdcxx/trunk/examples/manual/merge.cpp Mon Mar 27 15:24:56 2006
@@ -1,33 +1,30 @@
/**************************************************************************
*
- * merge.cpp - Example program of merging sequences.
+ * merge.cpp - Example program demonstrating the merge algorithms.
*
- * $Id: //stdlib/dev/examples/stdlib/manual/merge.cpp#13 $
+ * $Id$
*
***************************************************************************
*
- * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave
- * Software division. Licensed under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0. Unless required by
- * applicable law or agreed to in writing, software distributed under
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
- * CONDITIONS OF ANY KIND, either express or implied. See the License
- * for the specific language governing permissions and limitations under
- * the License.
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Copyright 1994-2006 Rogue Wave Software.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
**************************************************************************/
-#include <rw/_config.h>
-
-#if defined (__IBMCPP__) && !defined (_RWSTD_NO_IMPLICIT_INCLUSION)
-// Disable implicit inclusion to work around
-// a limitation in IBM's VisualAge 5.0.2.0 (see PR#26959)
-
-# define _RWSTD_NO_IMPLICIT_INCLUSION
-#endif
-
#include <algorithm> // advance, copy, inplace_merge, merge
#include <functional> // less
#include <iostream> // cout
@@ -65,7 +62,7 @@
std::merge (v1.begin (), v1.end (),
v2.begin (), v2.end (), v4.begin (), std::less<int>());
- // In place merge v5.
+ // Merge v5 in place.
Vector::iterator mid = v5.begin ();
std::advance (mid, 4); // equivalent to mid += 4 but more generic
std::inplace_merge (v5.begin (), mid, v5.end ());
@@ -81,25 +78,26 @@
// Copy all to cout.
std::ostream_iterator<int, char, std::char_traits<char> >
- out (std::cout," ");
+ out (std::cout, " ");
std::copy (v1.begin (), v1.end (), out);
- std::cout << std::endl;
- std::copy (v2.begin(), v2.end (), out);
- std::cout << std::endl;
+ std::cout << '\n';
+ std::copy (v2.begin (), v2.end (), out);
+ std::cout << '\n';
std::copy (v3.begin (), v3.end (), out);
- std::cout << std::endl;
+ std::cout << '\n';
std::copy (v4.begin (), v4.end (), out);
- std::cout << std::endl;
+ std::cout << '\n';
std::copy (v5.begin (), v5.end (), out);
- std::cout << std::endl;
- std::copy (v6.begin (),v6.end (), out);
- std::cout << std::endl;
+ std::cout << '\n';
+ std::copy (v6.begin (), v6.end (), out);
+ std::cout << '\n';
std::copy (v7.begin (), v7.end (), out);
- std::cout << std::endl;
+ std::cout << '\n';
// Merge v1 and v2 to cout.
std::merge (v1.begin (), v1.end (), v2.begin (), v2.end (), out);
+ std::cout << '\n';
return 0;
}
Modified: incubator/stdcxx/trunk/examples/manual/out/merge.out
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/examples/manual/out/merge.out?rev=389321&r1=389320&r2=389321&view=diff
==============================================================================
--- incubator/stdcxx/trunk/examples/manual/out/merge.out (original)
+++ incubator/stdcxx/trunk/examples/manual/out/merge.out Mon Mar 27 15:24:56 2006
@@ -5,3 +5,4 @@
11 12 13 14 15 16 17 18
11 12 13 14 15 16 17 18
1 1 2 2 3 3 4 4
+1 1 2 2 3 3 4 4