1 #ifndef INDEX_COLLECTION_H_ 2 #define INDEX_COLLECTION_H_ 8 #include <boost/call_traits.hpp> 9 #include <boost/type_traits.hpp> 25 template <
typename TIndex,
typename T,
typename TAlloc,
typename TPo
inter >
27 typename boost::enable_if_c<
28 boost::is_same<TIndex, std::size_t>::value &&
29 !boost::is_same<TPointer, std::size_t>::value
33 getIndex(
const std::vector<T, TAlloc> & c, TPointer pElem)
35 return std::distance(&*(c.begin()), &*pElem);
38 template <
typename TIndex,
typename TCollection >
40 typename boost::enable_if<
41 boost::is_same<TIndex, std::size_t>
50 template <
typename TIndex,
typename T,
typename TAlloc,
typename TPo
inter >
52 typename boost::enable_if_c<
53 boost::is_same<TIndex, T*>::value &&
54 !boost::is_same<TPointer, std::size_t>::value
58 getIndex(
const std::vector<T, TAlloc> & c, TPointer pElem)
63 template <
typename TIndex,
typename TContainer >
65 typename boost::enable_if<
66 boost::is_same<TIndex, typename value_type_of<TContainer>::type*>
123 template <
typename TContainer,
typename TPo
inter >
138 typename boost::call_traits<indexed_type>::const_reference
139 get(
typename boost::call_traits<TPointer>::param_type p)
const 144 typename boost::call_traits<indexed_type>::reference
145 get(
typename boost::call_traits<TPointer>::param_type p)
151 template <
typename TContainer,
typename TScalarIndex >
169 TContainer &
getContainer() { assert(m_pContainer != 0);
return *m_pContainer; }
170 const TContainer &
getContainer()
const { assert(m_pContainer != 0);
return *m_pContainer; }
174 const_reference
get(TScalarIndex i)
const 176 assert(m_pContainer != 0);
177 return (*m_pContainer)[i];
180 reference
get(TScalarIndex i)
182 assert(m_pContainer != 0);
183 return (*m_pContainer)[i];
190 TContainer * m_pContainer;
196 template <
typename TContainer,
typename TIndex >
200 template <
typename TContainer,
typename T >
215 template <
typename TContainer >
232 template <
typename TIndexCollection >
246 TIndexCollection m_indices;
void setContainer(TContainer &c)
ImageParameter param(const TImage &im)
Create an ImageParameter structure out of an Image.
TContainer & getContainer()
index_collection_scalar(TContainer &c)
index_collection_pointer(TContainer &)
index_collection_scalar()
Belongs to package Box Do not include directly, include til/Box.h instead.
TContainer::reference reference
TContainer::value_type indexed_type
TContainer::const_reference const_reference
reference operator[](std::size_t i)
TContainer::value_type indexed_type
index_collection(TContainer &c)
detail::index_collection_pointer< TContainer, T * > Base
index_collection_pointer()
TIndexCollection::reference reference
detail::index_collection_scalar< TContainer, std::size_t > Base
boost::enable_if_c< boost::is_same< TIndex, std::size_t >::value &&!boost::is_same< TPointer, std::size_t >::value, TIndex >::type getIndex(const std::vector< T, TAlloc > &c, TPointer pElem)
const TContainer & getContainer() const
virtual_collection(typename boost::call_traits< TIndexCollection >::param indices)
index_collection(TContainer &c)