File indexing completed on 2025-01-18 09:42:06
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_MULTI_INDEX_DETAIL_ANY_CONTAINER_VIEW_HPP
0010 #define BOOST_MULTI_INDEX_DETAIL_ANY_CONTAINER_VIEW_HPP
0011
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015
0016 namespace boost{
0017
0018 namespace multi_index{
0019
0020 namespace detail{
0021
0022
0023
0024 template<typename ConstIterator>
0025 class any_container_view
0026 {
0027 public:
0028 template<typename Container>
0029 any_container_view(const Container& x):px(&x),pt(vtable_for<Container>()){}
0030
0031 const void* container()const{return px;}
0032 ConstIterator begin()const{return pt->begin(px);}
0033 ConstIterator end()const{return pt->end(px);}
0034
0035 private:
0036 struct vtable
0037 {
0038 ConstIterator (*begin)(const void*);
0039 ConstIterator (*end)(const void*);
0040 };
0041
0042 template<typename Container>
0043 static ConstIterator begin_for(const void* px)
0044 {
0045 return static_cast<const Container*>(px)->begin();
0046 }
0047
0048 template<typename Container>
0049 static ConstIterator end_for(const void* px)
0050 {
0051 return static_cast<const Container*>(px)->end();
0052 }
0053
0054 template<typename Container>
0055 vtable* vtable_for()
0056 {
0057 static vtable v=
0058 {
0059 &begin_for<Container>,
0060 &end_for<Container>
0061 };
0062
0063 return &v;
0064 }
0065
0066 const void* px;
0067 vtable* pt;
0068 };
0069
0070 }
0071
0072 }
0073
0074 }
0075
0076 #endif