LCOV - code coverage report
Current view: top level - usr/include/boost/property_map - shared_array_property_map.hpp (source / functions) Hit Total Coverage
Test: ROSE Lines: 0 5 0.0 %
Date: 2022-12-08 13:48:47 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //  Copyright (C) 2009 Trustees of Indiana University
       2             : //  Authors: Jeremiah Willcock, Andrew Lumsdaine
       3             : 
       4             : // Distributed under the Boost Software License, Version 1.0. (See
       5             : // accompanying file LICENSE_1_0.txt or copy at
       6             : // http://www.boost.org/LICENSE_1_0.txt)
       7             : 
       8             : //  See http://www.boost.org/libs/property_map for documentation.
       9             : 
      10             : #ifndef BOOST_SHARED_ARRAY_PROPERTY_MAP_HPP
      11             : #define BOOST_SHARED_ARRAY_PROPERTY_MAP_HPP
      12             : 
      13             : #include <boost/smart_ptr/shared_array.hpp>
      14             : #include <boost/property_map/property_map.hpp>
      15             : 
      16             : namespace boost {
      17             : 
      18             : template <class T, class IndexMap>
      19           0 : class shared_array_property_map
      20             :   : public boost::put_get_helper<T&, shared_array_property_map<T, IndexMap> >
      21             : {
      22             :   public:
      23             :   typedef typename property_traits<IndexMap>::key_type key_type;
      24             :   typedef T value_type;
      25             :   typedef T& reference;
      26             :   typedef boost::lvalue_property_map_tag category;
      27             : 
      28             :   inline shared_array_property_map(): data(), index() {}
      29             : 
      30           0 :   explicit inline shared_array_property_map(
      31             :     size_t n,
      32             :     const IndexMap& _id = IndexMap())
      33           0 :   : data(new T[n]), index(_id) {}
      34             : 
      35           0 :   inline T& operator[](key_type v) const {
      36           0 :     return data[get(index, v)];
      37             :   }
      38             : 
      39             :   private:
      40             :   boost::shared_array<T> data;
      41             :   IndexMap index;
      42             : };
      43             : 
      44             : template <class T, class IndexMap>
      45             : shared_array_property_map<T, IndexMap>
      46             : make_shared_array_property_map(size_t n, const T&, const IndexMap& index) {
      47             :   return shared_array_property_map<T, IndexMap>(n, index);
      48             : }
      49             : 
      50             : } // end namespace boost
      51             : 
      52             : #endif // BOOST_SHARED_ARRAY_PROPERTY_MAP_HPP

Generated by: LCOV version 1.14