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_VSET_MEMORY_FSB_ASPECT_AD_GET_BY_OFFSET_HPP
8 : #define VSET_VSET_MEMORY_FSB_ASPECT_AD_GET_BY_OFFSET_HPP
9 :
10 : #include <vset/buffer/tags.hpp>
11 : #include <vset/memory/fsb/tags.hpp>
12 :
13 : namespace vset { namespace memory{ namespace fsb{
14 :
15 :
16 31 : struct ad_ptr_by_offset
17 : {
18 : template<typename T>
19 : typename T::aspect::template advice_cast<_value_type_>::type*
20 2900179 : operator()(T& t, size_t offset) const
21 : {
22 : typedef ::vset::buffer::_data_ _buffer_data_;
23 : typedef typename T::aspect::template advice_cast<_value_type_>::type value_type;
24 : return
25 : static_cast< value_type*>(
26 : static_cast< void*>(
27 2900179 : t.get_aspect().template get<_buffer_data_>()(t) +
28 2900179 : t.get_aspect().template get<_pos2off_>()(t, offset)
29 : )
30 2900179 : )
31 : ;
32 : }
33 :
34 : };
35 :
36 :
37 : }}}
38 :
39 : #endif
|