LCOV - code coverage report
Current view: top level - vset/vtree/aspect - ad_create_node.hpp (source / functions) Hit Total Coverage
Test: v-set-coverage.info Lines: 6 6 100.0 %
Date: 2019-09-12 Functions: 13 14 92.9 %

          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_VTREE_ASPECT_AD_CREATE_NODE_HPP
       8             : #define VSET_VTREE_ASPECT_AD_CREATE_NODE_HPP
       9             : 
      10             : #include <fas/system/nullptr.hpp>
      11             : #include <vset/vtree/aspect/tags.hpp>
      12             : #include <string.h>
      13             : #include <stdlib.h>
      14             : 
      15             : namespace vset{ namespace vtree{
      16             : 
      17          29 : struct ad_create_node
      18             : {
      19             :   template<typename T>
      20             :   typename T::container_type::iterator
      21          28 :   operator()(T& t, const typename T::value_type& value)
      22             :   {
      23             :     typedef typename T::allocator_type allocator_type;
      24             :     typedef typename allocator_type::value_type array_type;
      25             :     typedef typename allocator_type::pointer pointer;
      26             : 
      27          28 :     pointer parr = t.get_allocator().allocate(1, fas_nullptr);
      28          28 :     t.get_allocator().construct(parr, array_type() );
      29          28 :     const typename T::key_type& key = t.get_aspect().template get<_get_key_>()(t, value);
      30          28 :     return t.get_aspect().template get<_insert_to_container_>()(t, std::make_pair(key, key), parr);
      31             :   }
      32             : };
      33             : 
      34             : }}
      35             : 
      36             : #endif

Generated by: LCOV version 1.10