Skip to content

Commit fa48536

Browse files
authored
Update entity_cache.hpp
need to handle Heap memory type
1 parent 4c4f19b commit fa48536

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rtb/datacache/entity_cache.hpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define __DATACACHE_ENTITY_CACHE_HPP__
2222

2323
#include <algorithm>
24+
#include <type_traits>
2425
#include <boost/interprocess/exceptions.hpp>
2526
#include <boost/interprocess/allocators/allocator.hpp>
2627
#include <boost/interprocess/containers/string.hpp>
@@ -276,7 +277,9 @@ class entity_cache
276277
}
277278
private:
278279
void attach() const {
279-
_segment_ptr.reset(new segment_t(bip::open_only,_store_name.c_str()) ) ;
280+
if constexpr ( !std::is_same_v<segment_t, boost::interprocess::managed_heap_memory> ) {
281+
_segment_ptr.reset(new segment_t(bip::open_only,_store_name.c_str()) ) ;
282+
}
280283
_container_ptr = _segment_ptr->template find_or_construct<Container_t>(_cache_name.c_str())
281284
(typename Container_t::ctor_args_list(), typename Container_t::allocator_type(_segment_ptr->get_segment_manager()));
282285
}

0 commit comments

Comments
 (0)