/
usr
/
include
/
boost
/
regex
/
v4
/
/usr/include/boost/regex/v4
mkdir
upload
Name
Size
Mode
Actions
basic_regex.hpp
24089
0644
edit
dl
rm
basic_regex_creator.hpp
54206
0644
edit
dl
rm
basic_regex_parser.hpp
112851
0644
edit
dl
rm
char_regex_traits.hpp
1726
0644
edit
dl
rm
cpp_regex_traits.hpp
39425
0644
edit
dl
rm
cregex.hpp
10987
0644
edit
dl
rm
c_regex_traits.hpp
5497
0644
edit
dl
rm
error_type.hpp
1258
0644
edit
dl
rm
fileiter.hpp
14377
0644
edit
dl
rm
indexed_bit_flag.hpp
1316
0644
edit
dl
rm
instances.hpp
9080
0644
edit
dl
rm
iterator_category.hpp
1960
0644
edit
dl
rm
iterator_traits.hpp
3802
0644
edit
dl
rm
match_flags.hpp
6934
0644
edit
dl
rm
match_results.hpp
22773
0644
edit
dl
rm
mem_block_cache.hpp
3132
0644
edit
dl
rm
perl_matcher.hpp
18847
0644
edit
dl
rm
perl_matcher_common.hpp
30476
0644
edit
dl
rm
perl_matcher_non_recursive.hpp
63238
0644
edit
dl
rm
perl_matcher_recursive.hpp
34540
0644
edit
dl
rm
primary_transform.hpp
3347
0644
edit
dl
rm
protected_call.hpp
1688
0644
edit
dl
rm
regbase.hpp
5972
0644
edit
dl
rm
regex.hpp
4590
0644
edit
dl
rm
regex_format.hpp
34231
0644
edit
dl
rm
regex_fwd.hpp
1646
0644
edit
dl
rm
regex_grep.hpp
4879
0644
edit
dl
rm
regex_iterator.hpp
6474
0644
edit
dl
rm
regex_match.hpp
14475
0644
edit
dl
rm
regex_merge.hpp
2765
0644
edit
dl
rm
regex_raw_buffer.hpp
3686
0644
edit
dl
rm
regex_replace.hpp
2925
0644
edit
dl
rm
regex_search.hpp
7097
0644
edit
dl
rm
regex_split.hpp
4956
0644
edit
dl
rm
regex_token_iterator.hpp
12613
0644
edit
dl
rm
regex_traits.hpp
4965
0644
edit
dl
rm
regex_traits_defaults.hpp
11555
0644
edit
dl
rm
regex_workaround.hpp
6171
0644
edit
dl
rm
states.hpp
11915
0644
edit
dl
rm
sub_match.hpp
23155
0644
edit
dl
rm
syntax_type.hpp
4374
0644
edit
dl
rm
u32regex_iterator.hpp
6475
0644
edit
dl
rm
u32regex_token_iterator.hpp
15068
0644
edit
dl
rm
w32_regex_traits.hpp
24455
0644
edit
dl
rm
Edit:
/usr/include/boost/regex/v4/mem_block_cache.hpp
(3132B)
/* * Copyright (c) 2002 * John Maddock * * Use, modification and distribution are subject to the * Boost Software License, Version 1.0. (See accompanying file * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * */ /* * LOCATION: see http://www.boost.org for most recent version. * FILE mem_block_cache.hpp * VERSION see <boost/version.hpp> * DESCRIPTION: memory block cache used by the non-recursive matcher. */ #ifndef BOOST_REGEX_V4_MEM_BLOCK_CACHE_HPP #define BOOST_REGEX_V4_MEM_BLOCK_CACHE_HPP #include <new> #ifdef BOOST_HAS_THREADS #include <boost/regex/pending/static_mutex.hpp> #endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif #ifndef BOOST_NO_CXX11_HDR_ATOMIC #include <atomic> #if ATOMIC_POINTER_LOCK_FREE == 2 #define BOOST_REGEX_MEM_BLOCK_CACHE_LOCK_FREE #define BOOST_REGEX_ATOMIC_POINTER std::atomic #endif #endif namespace boost{ namespace BOOST_REGEX_DETAIL_NS{ #ifdef BOOST_REGEX_MEM_BLOCK_CACHE_LOCK_FREE /* lock free implementation */ struct mem_block_cache { std::atomic<void*> cache[BOOST_REGEX_MAX_CACHE_BLOCKS]; ~mem_block_cache() { for (size_t i = 0;i < BOOST_REGEX_MAX_CACHE_BLOCKS; ++i) { if (cache[i].load()) ::operator delete(cache[i].load()); } } void* get() { for (size_t i = 0;i < BOOST_REGEX_MAX_CACHE_BLOCKS; ++i) { void* p = cache[i].load(); if (p != NULL) { if (cache[i].compare_exchange_strong(p, NULL)) return p; } } return ::operator new(BOOST_REGEX_BLOCKSIZE); } void put(void* ptr) { for (size_t i = 0;i < BOOST_REGEX_MAX_CACHE_BLOCKS; ++i) { void* p = cache[i].load(); if (p == NULL) { if (cache[i].compare_exchange_strong(p, ptr)) return; } } ::operator delete(ptr); } }; #else /* lock-based implementation */ struct mem_block_node { mem_block_node* next; }; struct mem_block_cache { // this member has to be statically initialsed: mem_block_node* next; unsigned cached_blocks; #ifdef BOOST_HAS_THREADS boost::static_mutex mut; #endif ~mem_block_cache() { while(next) { mem_block_node* old = next; next = next->next; ::operator delete(old); } } void* get() { #ifdef BOOST_HAS_THREADS boost::static_mutex::scoped_lock g(mut); #endif if(next) { mem_block_node* result = next; next = next->next; --cached_blocks; return result; } return ::operator new(BOOST_REGEX_BLOCKSIZE); } void put(void* p) { #ifdef BOOST_HAS_THREADS boost::static_mutex::scoped_lock g(mut); #endif if(cached_blocks >= BOOST_REGEX_MAX_CACHE_BLOCKS) { ::operator delete(p); } else { mem_block_node* old = static_cast<mem_block_node*>(p); old->next = next; next = old; ++cached_blocks; } } }; #endif extern mem_block_cache block_cache; } } // namespace boost #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #endif
Save
cmd:
run