1 // Boost.Bimap 2 // 3 // Copyright (c) 2006-2007 Matias Capeletto 4 // 5 // Distributed under the Boost Software License, Version 1.0. 6 // (See accompanying file LICENSE_1_0.txt or copy at 7 // http://www.boost.org/LICENSE_1_0.txt) 8 9 /// \file views/unordered_set_view.hpp 10 /// \brief View of a bimap that is signature compatible with tr1::unordered_set. 11 12 #ifndef BOOST_BIMAP_VIEWS_UNORDERED_SET_VIEW_HPP 13 #define BOOST_BIMAP_VIEWS_UNORDERED_SET_VIEW_HPP 14 15 #if defined(_MSC_VER) 16 #pragma once 17 #endif 18 19 #include <boost/config.hpp> 20 21 #include <boost/bimap/container_adaptor/unordered_set_adaptor.hpp> 22 #include <boost/bimap/detail/set_view_base.hpp> 23 24 namespace boost { 25 namespace bimaps { 26 namespace views { 27 28 /// \brief View of a bimap that is signature compatible with std::unordered_set. 29 /** 30 31 This class uses container_adaptor and iterator_adaptor to wrapped a index of the 32 multi_index bimap core so it can be used as a std::unordered_set. 33 34 See also const_unordered_set_view. 35 **/ 36 37 template< class CoreIndex > 38 class unordered_set_view 39 : 40 public BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR( 41 unordered_set_adaptor, 42 CoreIndex, 43 local_iterator, 44 const_local_iterator 45 ), 46 47 public ::boost::bimaps::detail:: 48 set_view_base< unordered_set_view< CoreIndex >, CoreIndex > 49 { 50 BOOST_BIMAP_SET_VIEW_BASE_FRIEND(unordered_set_view,CoreIndex) 51 52 typedef BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR( 53 unordered_set_adaptor, 54 CoreIndex, 55 local_iterator, 56 const_local_iterator 57 58 ) base_; 59 60 public: 61 unordered_set_view(BOOST_DEDUCED_TYPENAME base_::base_type & c)62 unordered_set_view(BOOST_DEDUCED_TYPENAME base_::base_type & c) 63 : base_(c) {} 64 operator =(const unordered_set_view & v)65 unordered_set_view & operator=(const unordered_set_view & v) 66 { 67 this->base() = v.base(); 68 return *this; 69 } 70 }; 71 72 73 } // namespace views 74 } // namespace bimaps 75 } // namespace boost 76 77 #endif // BOOST_BIMAP_VIEWS_UNORDERED_SET_VIEW_HPP 78 79