Line data Source code
1 : //
2 : // Author: Vladimir Migashko <migashko@gmail.com>, (C) 2012
3 : //
4 : // Copyright: See COPYING file that comes with this distribution
5 : //
6 :
7 : #ifndef VSET_VTREE_ASPECT_AD_CLEAR_HPP
8 : #define VSET_VTREE_ASPECT_AD_CLEAR_HPP
9 :
10 : #include <vset/vtree/aspect/tags.hpp>
11 : #include <string.h>
12 : #include <stdlib.h>
13 :
14 : namespace vset{ namespace vtree{
15 :
16 29 : struct ad_clear
17 : {
18 : template<typename T>
19 3 : void operator()(T& t)
20 : {
21 : typedef typename T::container_type container_type;
22 : typedef typename container_type::iterator container_iterator;
23 :
24 3 : container_type& container = t.get_container();
25 3 : container_iterator beg = container.begin();
26 3 : container_iterator end = container.end();
27 :
28 4 : for (;beg != end; ++beg)
29 : {
30 1 : t.get_allocator().deallocate(beg->second, 1);
31 : }
32 :
33 3 : t.get_aspect().template get<_size_>() = 0;
34 3 : container.clear();
35 3 : }
36 : };
37 :
38 : }}
39 :
40 : #endif
|