1 #ifndef ACE_TESTS_STL_ALGORITHM_TEST_T_CPP
2 #define ACE_TESTS_STL_ALGORITHM_TEST_T_CPP
4 #include "test_config.h"
17 void operator () (typename
T::value_type
& item
)
20 ACE_UNUSED_ARG (item
);
23 Element_Counter
& operator = (const Element_Counter
& ec
)
25 this->count_
= ec
.count_
;
29 typename
T::difference_type
get_count () const
35 // Number of elements iterated over.
36 typename
T::difference_type count_
;
40 int test_STL_algorithm (T
& container
)
42 // We are only validating that the container's iterators
43 // compile with the <algorithm> header.
45 ACE_TEXT ("running STL algorithm test for `%s'\n"),
48 // Test the forward iterator using std::for_each.
50 "testing forward iterator\n"));
52 typename
T::difference_type count
=
53 std::for_each (container
.begin (),
55 Element_Counter
<T
> ()).get_count ();
58 "std::for_each handled %d elements\n",
61 // Test the reverse iterator using std::for_each.
63 "testing reverse iterator\n"));
66 std::for_each (container
.rbegin (),
68 Element_Counter
<T
> ()).get_count ();
71 "std::for_each handled %d elements\n",
77 #endif /* ACE_TESTS_STL_ALGORITHM_TEST_T_CPP */