Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:43:03

0001 //
0002 //  Copyright (c) 2018, Cem Bassoy, cem.bassoy@gmail.com
0003 //
0004 //  Distributed under the Boost Software License, Version 1.0. (See
0005 //  accompanying file LICENSE_1_0.txt or copy at
0006 //  http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 //  The authors gratefully acknowledge the support of
0009 //  Fraunhofer IOSB, Ettlingen Germany
0010 //
0011 
0012 
0013 #ifndef _BOOST_STORAGE_TRAITS_HPP_
0014 #define _BOOST_STORAGE_TRAITS_HPP_
0015 
0016 #include <vector>
0017 #include <array>
0018 
0019 namespace boost {
0020 namespace numeric {
0021 namespace ublas {
0022 
0023 
0024 template <class A>
0025 struct storage_traits;
0026 
0027 
0028 template <class V, class A>
0029 struct storage_traits<std::vector<V,A>>
0030 {
0031     using array_type      = std::vector<V,A>;
0032 
0033     using size_type       = typename array_type::size_type;
0034     using difference_type = typename array_type::difference_type;
0035     using value_type      = typename array_type::value_type;
0036 
0037     using reference       = typename array_type::reference;
0038     using const_reference = typename array_type::const_reference;
0039 
0040     using pointer         = typename array_type::pointer;
0041     using const_pointer   = typename array_type::const_pointer;
0042 
0043     using iterator        = typename array_type::iterator;
0044     using const_iterator  = typename array_type::const_iterator;
0045 
0046     using reverse_iterator        = typename array_type::reverse_iterator;
0047     using const_reverse_iterator  = typename array_type::const_reverse_iterator;
0048 
0049     template<class U>
0050     using rebind = std::vector<U, typename std::allocator_traits<A>::template rebind_alloc<U>>;
0051 };
0052 
0053 
0054 template <class V, std::size_t N>
0055 struct storage_traits<std::array<V,N>>
0056 {
0057     using array_type      = std::array<V,N>;
0058 
0059     using size_type       = typename array_type::size_type;
0060     using difference_type = typename array_type::difference_type;
0061     using value_type      = typename array_type::value_type;
0062 
0063     using reference       = typename array_type::reference;
0064     using const_reference = typename array_type::const_reference;
0065 
0066     using pointer         = typename array_type::pointer;
0067     using const_pointer   = typename array_type::const_pointer;
0068 
0069     using iterator        = typename array_type::iterator;
0070     using const_iterator  = typename array_type::const_iterator;
0071 
0072     using reverse_iterator        = typename array_type::reverse_iterator;
0073     using const_reverse_iterator  = typename array_type::const_reverse_iterator;
0074 
0075     template<class U>
0076     using rebind = std::array<U,N>;
0077 };
0078 
0079 } // ublas
0080 } // numeric
0081 } // boost
0082 
0083 
0084 #endif // _BOOST_STORAGE_TRAITS_HPP_