コード例 #1
0
int main()
{
//[circular_buffer_bound_example_3]
    //`Construct a bounded_buffer to hold the chosen type, here int.
    bounded_buffer<int> bb_int(queue_size);
    std::cout << "Testing bounded_buffer<int> ";

    //`Start the fifo test.
    fifo_test(&bb_int);
   //` destructor of boost::timer::auto_cpu_timer will output the time to std::cout

//] [/circular_buffer_bound_example_3]

return 0;
} // int main()
コード例 #2
0
int main(int /*argc*/, char* /*argv*/[]) {

    bounded_buffer<int> bb_int(QUEUE_SIZE);
    std::cout << "bounded_buffer<int> ";
    fifo_test(&bb_int);

    bounded_buffer_space_optimized<int> bb_space_optimized_int(QUEUE_SIZE);
    std::cout << "bounded_buffer_space_optimized<int> ";
    fifo_test(&bb_space_optimized_int);

    bounded_buffer_deque_based<int> bb_deque_based_int(QUEUE_SIZE);
    std::cout << "bounded_buffer_deque_based<int> ";
    fifo_test(&bb_deque_based_int);

    bounded_buffer_list_based<int> bb_list_based_int(QUEUE_SIZE);
    std::cout << "bounded_buffer_list_based<int> ";
    fifo_test(&bb_list_based_int);

    bounded_buffer<std::string> bb_string(QUEUE_SIZE);
    std::cout << "bounded_buffer<std::string> ";
    fifo_test(&bb_string);

    bounded_buffer_space_optimized<std::string> bb_space_optimized_string(QUEUE_SIZE);
    std::cout << "bounded_buffer_space_optimized<std::string> ";
    fifo_test(&bb_space_optimized_string);

    bounded_buffer_deque_based<std::string> bb_deque_based_string(QUEUE_SIZE);
    std::cout << "bounded_buffer_deque_based<std::string> ";
    fifo_test(&bb_deque_based_string);

    bounded_buffer_list_based<std::string> bb_list_based_string(QUEUE_SIZE);
    std::cout << "bounded_buffer_list_based<std::string> ";
    fifo_test(&bb_list_based_string);

    return 0;
}