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 2005/12/17 01:48:54 UTC

svn commit: r357263 - /incubator/stdcxx/trunk/tests/include/alg_test.h

Author: sebor
Date: Fri Dec 16 16:48:50 2005
New Revision: 357263

URL: http://svn.apache.org/viewcvs?rev=357263&view=rev
Log:
2005-12-16  Martin Sebor  <se...@roguewave.com>

	* alg_test.h (rw/_iterbase.h>: Included implementation header instead
	of the bloated <iterator> to reduce namespace pollution.
	(Size<T>): New class template used to exercise the fill_n, generate_n,
	and search_n algorithms.
	(RW_ALG_TEST_H_INCLUDED): Renamed include guard	to conform to the naming
	convention used in the test suite.
	(<rw/defs.h>): Removed an unnecessary/inappropriate include directive
	subsumed by <testdefs.h>.

Modified:
    incubator/stdcxx/trunk/tests/include/alg_test.h

Modified: incubator/stdcxx/trunk/tests/include/alg_test.h
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/include/alg_test.h?rev=357263&r1=357262&r2=357263&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/include/alg_test.h (original)
+++ incubator/stdcxx/trunk/tests/include/alg_test.h Fri Dec 16 16:48:50 2005
@@ -19,15 +19,14 @@
  * 
  **************************************************************************/
 
-#ifndef _RWSTD_ALG_TEST_H_INCLUDED
-#define _RWSTD_ALG_TEST_H_INCLUDED
+#ifndef RW_ALG_TEST_H_INCLUDED
+#define RW_ALG_TEST_H_INCLUDED
 
-#include <iterator>
+#include <cassert>          // for assert()
 
-#include <cassert>   // for assert()
+#include <rw/_iterbase.h>   // for iterator
 
 #include <testdefs.h>
-#include <rw/_defs.h>
 
 
 // objects of class X maintain a count of their instances in existence,
@@ -491,6 +490,26 @@
 #endif   // _RWSTD_NO_CLASS_PARTIAL_SPEC
 
 
+// Size template argument to fill_n(), generate_n(), and search_n()
+template <class IntegralT>
+struct Size
+{
+    // dummy argument provided to prevent Size from being constructible
+    // by conversion from IntegralT
+    Size (IntegralT val, int /* dummy */ )
+        : val_ (val) { /* empty */ }
+
+    // Size must be convertible to an integral type
+    operator IntegralT () const { return val_; }
+
+private:
+
+    void operator= (const Size&);   // not Assignable
+
+    IntegralT val_;
+};
+
+
 // satisfies the requirements in 24.1.1 [lib.input.iterators]
 template <class T>
 struct InputIter: ITER_BASE (std::input_iterator_tag, T, int, T*, T&)
@@ -1232,4 +1251,4 @@
 
 
 
-#endif   // _RWSTD_ALG_TEST_H_INCLUDED
+#endif   // RW_ALG_TEST_H_INCLUDED