• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Range library
2 //
3 //  Copyright Neil Groves 2009. Use, modification and
4 //  distribution is subject to the Boost Software License, Version
5 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 //  http://www.boost.org/LICENSE_1_0.txt)
7 //
8 //
9 // For more information, see http://www.boost.org/libs/range/
10 //
11 #ifndef BOOST_RANGE_TEST_FUNCTION_COUNTED_FUNCTION_HPP_INCLUDED
12 #define BOOST_RANGE_TEST_FUNCTION_COUNTED_FUNCTION_HPP_INCLUDED
13 
14 namespace boost
15 {
16     namespace range_test_function
17     {
18 
19         class counted_function
20         {
21         public:
counted_function()22             counted_function() : m_count(0u) {}
23 
invoked() const24             void invoked() const
25             {
26                 ++m_count;
27             }
28 
29             // Return the number of times that this function object
30             // has been invoked.
invocation_count() const31             unsigned int invocation_count() const { return m_count; }
32 
33         private:
34             mutable unsigned int m_count;
35         };
36 
37     }
38 }
39 
40 #endif // include guard
41