1//////////////////////////////////////////////////////////////////////////////
2//
3// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost
4// Software License, Version 1.0. (See accompanying file
5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6//
7// See http://www.boost.org/libs/interprocess for documentation.
8//
9//////////////////////////////////////////////////////////////////////////////
10
11#ifndef BOOST_INTERPROCESS_TEST_PRINTCONTAINER_HPP
12#define BOOST_INTERPROCESS_TEST_PRINTCONTAINER_HPP
13
14#include <boost/interprocess/detail/config_begin.hpp>
15#include <iostream>
16
17namespace boost{
18namespace interprocess{
19namespace test{
20
21template<class Container>
22void PrintContents(const Container &cont, const char *contName)
23{
24 std::cout<< "Printing contents of " << contName << std::endl;
25 typename Container::iterator b(cont.begin()), e(cont.end());
26 for(; b != e; ++b){
27 std::cout << *b << " ";
28 }
29 std::cout<< std::endl << std::endl;
30}
31
32//Function to dump data
33template<class MyShmCont, class MyStdCont>
34void PrintContainers(MyShmCont *shmcont, MyStdCont *stdcont)
35{
36 typename MyShmCont::iterator itshm = shmcont->begin(), itshmend = shmcont->end();
37 typename MyStdCont::iterator itstd = stdcont->begin(), itstdend = stdcont->end();
38
39 std::cout << "MyShmCont" << std::endl;
40 for(; itshm != itshmend; ++itshm){
41 std::cout << *itshm << std::endl;
42 }
43 std::cout << "MyStdCont" << std::endl;
44
45 for(; itstd != itstdend; ++itstd){
46 std::cout << *itstd << std::endl;
47 }
48}
49
50} //namespace test{
51} //namespace interprocess{
52} //namespace boost{
53
54#include <boost/interprocess/detail/config_end.hpp>
55
56#endif //#ifndef BOOST_INTERPROCESS_TEST_PRINTCONTAINER_HPP
57

source code of boost/libs/interprocess/test/print_container.hpp