Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53770 - in sandbox/bloom_filter/trunk: boost/bloom_filter libs/bloom_filter/test
From: mikhailberis_at_[hidden]
Date: 2009-06-09 03:42:19


Author: mikhailberis
Date: 2009-06-09 03:42:17 EDT (Tue, 09 Jun 2009)
New Revision: 53770
URL: http://svn.boost.org/trac/boost/changeset/53770

Log:
Adding free swap function.
Added:
   sandbox/bloom_filter/trunk/libs/bloom_filter/test/bloom_filter_swap_adl_test.cpp (contents, props changed)
Text files modified:
   sandbox/bloom_filter/trunk/boost/bloom_filter/bloom_filter.hpp | 7 +++++++
   sandbox/bloom_filter/trunk/libs/bloom_filter/test/Jamfile.v2 | 1 +
   2 files changed, 8 insertions(+), 0 deletions(-)

Modified: sandbox/bloom_filter/trunk/boost/bloom_filter/bloom_filter.hpp
==============================================================================
--- sandbox/bloom_filter/trunk/boost/bloom_filter/bloom_filter.hpp (original)
+++ sandbox/bloom_filter/trunk/boost/bloom_filter/bloom_filter.hpp 2009-06-09 03:42:17 EDT (Tue, 09 Jun 2009)
@@ -80,6 +80,13 @@
                 return bit_set;
             }
     };
+
+ template <class Input, size_t M, size_t K>
+ inline void swap(
+ bloom_filter<Input, M, K> & left,
+ bloom_filter<Input, M, K> & right) {
+ left.swap(right);
+ }
 }
 
 #endif

Modified: sandbox/bloom_filter/trunk/libs/bloom_filter/test/Jamfile.v2
==============================================================================
--- sandbox/bloom_filter/trunk/libs/bloom_filter/test/Jamfile.v2 (original)
+++ sandbox/bloom_filter/trunk/libs/bloom_filter/test/Jamfile.v2 2009-06-09 03:42:17 EDT (Tue, 09 Jun 2009)
@@ -6,6 +6,7 @@
     :
     [ run bloom_filter_test.cpp ]
     [ run default_constructed_filter_test.cpp ]
+ [ run bloom_filter_swap_adl_test.cpp ]
     ;
 }
 

Added: sandbox/bloom_filter/trunk/libs/bloom_filter/test/bloom_filter_swap_adl_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/bloom_filter/trunk/libs/bloom_filter/test/bloom_filter_swap_adl_test.cpp 2009-06-09 03:42:17 EDT (Tue, 09 Jun 2009)
@@ -0,0 +1,26 @@
+// Copyright 2009 (c) Dean Michael Berris <mikhailberis_at_[hidden]>
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/bloom_filter.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+using boost::bloom_filter;
+
+int main(int argc, char * argv[]) {
+ typedef bloom_filter<uint32_t, 32, 3> filter_type;
+ filter_type filter1, filter2;
+ filter1.insert(1u);
+ filter2.insert(2u);
+ assert(!filter1.contains(2u));
+ assert(filter1.contains(1u));
+ assert(!filter2.contains(1u));
+ assert(filter2.contains(2u));
+ swap(filter1, filter2);
+ assert(filter1.contains(2u));
+ assert(!filter1.contains(1u));
+ assert(filter2.contains(1u));
+ assert(!filter2.contains(2u));
+ return EXIT_SUCCESS;
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk