shared_ptr -> std::shared_ptr

This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
This commit is contained in:
void_17
2026-03-02 15:58:20 +07:00
parent d63f79325f
commit 7074f35e4b
1373 changed files with 12054 additions and 12054 deletions

View File

@@ -1,7 +1,7 @@
/*=============================================================================
Boost.Wave: A Standard compliant C++ preprocessor library
Definition of the preprocessor context
http://www.boost.org/
Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
@@ -52,10 +52,10 @@ namespace boost {
namespace wave {
///////////////////////////////////////////////////////////////////////////////
//
//
// The C/C++ preprocessor context template class
//
// The boost::wave::context template is the main interface class to
// The boost::wave::context template is the main interface class to
// control the behavior of the preprocessing engine.
//
// The following template parameters has to be supplied:
@@ -63,18 +63,18 @@ namespace wave {
// IteratorT The iterator type of the underlying input stream
// LexIteratorT The lexer iterator type to use as the token factory
// InputPolicyT The input policy type to use for loading the files
// to be included. This template parameter is optional and
// defaults to the
// to be included. This template parameter is optional and
// defaults to the
// iteration_context_policies::load_file_to_string
// type.
// HooksT The hooks policy to use for different notification
// HooksT The hooks policy to use for different notification
// callbacks. This template parameter is optional and
// defaults to the
// context_policies::default_preprocessing_hooks
// type.
// DerivedT The type of the type being derived from the context
// type (if any). This template parameter is optional and
// defaults to 'this_type', which means that the context
// defaults to 'this_type', which means that the context
// type will be used assuming no derived type exists.
//
///////////////////////////////////////////////////////////////////////////////
@@ -83,7 +83,7 @@ struct this_type {};
template <
typename IteratorT,
typename LexIteratorT,
typename LexIteratorT,
typename InputPolicyT = iteration_context_policies::load_file_to_string,
typename HooksT = context_policies::eat_whitespace<typename LexIteratorT::token_type>,
typename DerivedT = this_type
@@ -113,35 +113,35 @@ public:
typedef typename token_type::position_type position_type;
// type of a token sequence
typedef std::list<token_type, boost::fast_pool_allocator<token_type> >
typedef std::list<token_type, boost::fast_pool_allocator<token_type> >
token_sequence_type;
// type of the policies
typedef HooksT hook_policy_type;
private:
// stack of shared_ptr's to the pending iteration contexts
typedef boost::shared_ptr<base_iteration_context<context, lexer_type> >
// stack of std::shared_ptr's to the pending iteration contexts
typedef boost::std::shared_ptr<base_iteration_context<context, lexer_type> >
iteration_ptr_type;
typedef boost::wave::util::iteration_context_stack<iteration_ptr_type>
typedef boost::wave::util::iteration_context_stack<iteration_ptr_type>
iteration_context_stack_type;
typedef typename iteration_context_stack_type::size_type iter_size_type;
context *this_() { return this; } // avoid warning in constructor
public:
context(target_iterator_type const &first_, target_iterator_type const &last_,
context(target_iterator_type const &first_, target_iterator_type const &last_,
char const *fname = "<Unknown>", HooksT const &hooks_ = HooksT())
: first(first_), last(last_), filename(fname)
, has_been_initialized(false)
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
, current_filename(fname)
#endif
#endif
, current_relative_filename(fname)
, macros(*this_())
, language(language_support(
support_cpp
| support_option_convert_trigraphs
| support_option_emit_line_directives
support_cpp
| support_option_convert_trigraphs
| support_option_emit_line_directives
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
| support_option_include_guard_detection
#endif
@@ -160,29 +160,29 @@ public:
// default destructor
// iterator interface
iterator_type begin()
{
iterator_type begin()
{
std::string fname(filename);
if (filename != "<Unknown>" && filename != "<stdin>") {
using namespace boost::filesystem;
path fpath(util::complete_path(path(filename)));
fname = fpath.string();
}
return iterator_type(*this, first, last, position_type(fname.c_str()));
return iterator_type(*this, first, last, position_type(fname.c_str()));
}
iterator_type begin(
target_iterator_type const &first_,
target_iterator_type const &last_)
{
target_iterator_type const &first_,
target_iterator_type const &last_)
{
std::string fname(filename);
if (filename != "<Unknown>" && filename != "<stdin>") {
using namespace boost::filesystem;
path fpath(util::complete_path(path(filename)));
fname = fpath.string();
}
return iterator_type(*this, first_, last_, position_type(fname.c_str()));
return iterator_type(*this, first_, last_, position_type(fname.c_str()));
}
iterator_type end() const
iterator_type end() const
{ return iterator_type(); }
// maintain include paths
@@ -191,46 +191,46 @@ public:
bool add_sysinclude_path(char const *path_)
{ return includes.add_include_path(path_, true);}
void set_sysinclude_delimiter() { includes.set_sys_include_delimiter(); }
typename iteration_context_stack_type::size_type get_iteration_depth() const
typename iteration_context_stack_type::size_type get_iteration_depth() const
{ return iter_ctxs.size(); }
// maintain defined macros
#if BOOST_WAVE_ENABLE_COMMANDLINE_MACROS != 0
template <typename StringT>
bool add_macro_definition(StringT macrostring, bool is_predefined = false)
{
return boost::wave::util::add_macro_definition(*this,
util::to_string<std::string>(macrostring), is_predefined,
get_language());
{
return boost::wave::util::add_macro_definition(*this,
util::to_string<std::string>(macrostring), is_predefined,
get_language());
}
#endif
#endif
// Define and undefine macros, macro introspection
template <typename StringT>
bool add_macro_definition(StringT const &name, position_type const& pos,
bool has_params, std::vector<token_type> &parameters,
bool add_macro_definition(StringT const &name, position_type const& pos,
bool has_params, std::vector<token_type> &parameters,
token_sequence_type &definition, bool is_predefined = false)
{
{
return macros.add_macro(
token_type(T_IDENTIFIER, util::to_string<string_type>(name), pos),
has_params, parameters, definition, is_predefined);
token_type(T_IDENTIFIER, util::to_string<string_type>(name), pos),
has_params, parameters, definition, is_predefined);
}
template <typename StringT>
bool is_defined_macro(StringT const &str) const
{
return macros.is_defined(util::to_string<string_type>(str));
{
return macros.is_defined(util::to_string<string_type>(str));
}
template <typename StringT>
bool get_macro_definition(StringT const &name,
bool get_macro_definition(StringT const &name,
bool &has_params, bool &is_predefined, position_type &pos,
std::vector<token_type> &parameters,
std::vector<token_type> &parameters,
token_sequence_type &definition) const
{
return macros.get_macro(util::to_string<string_type>(name),
has_params, is_predefined, pos, parameters, definition);
{
return macros.get_macro(util::to_string<string_type>(name),
has_params, is_predefined, pos, parameters, definition);
}
template <typename StringT>
bool remove_macro_definition(StringT const& undefname, bool even_predefined = false)
{
{
// strip leading and trailing whitespace
string_type name = util::to_string<string_type>(undefname);
typename string_type::size_type pos = name.find_first_not_of(" \t");
@@ -244,9 +244,9 @@ public:
includes.remove_pragma_once_header(
util::to_string<std::string>(name));
#endif
return macros.remove_macro(name, macros.get_main_pos(), even_predefined);
return macros.remove_macro(name, macros.get_main_pos(), even_predefined);
}
void reset_macro_definitions()
void reset_macro_definitions()
{ macros.reset_macromap(); macros.init_predefined_macros(); }
// Iterate over names of defined macros
@@ -264,28 +264,28 @@ public:
bool add_macro_definition(token_type const &name, bool has_params,
std::vector<token_type> &parameters, token_sequence_type &definition,
bool is_predefined = false)
{
return macros.add_macro(name, has_params, parameters, definition,
is_predefined);
{
return macros.add_macro(name, has_params, parameters, definition,
is_predefined);
}
// get the Wave version information
static std::string get_version()
{
boost::wave::util::predefined_macros p;
return util::to_string<std::string>(p.get_fullversion());
}
static std::string get_version_string()
// get the Wave version information
static std::string get_version()
{
boost::wave::util::predefined_macros p;
return util::to_string<std::string>(p.get_versionstr());
return util::to_string<std::string>(p.get_fullversion());
}
static std::string get_version_string()
{
boost::wave::util::predefined_macros p;
return util::to_string<std::string>(p.get_versionstr());
}
// access current language options
void set_language(boost::wave::language_support language_,
bool reset_macros = true)
{
language = language_;
bool reset_macros = true)
{
language = language_;
if (reset_macros)
reset_macro_definitions();
}
@@ -305,10 +305,10 @@ public:
hook_policy_type const &get_hooks() const { return hooks; }
// return type of actually used context type (might be the derived type)
actual_context_type& derived()
{ return *static_cast<actual_context_type*>(this); }
actual_context_type& derived()
{ return *static_cast<actual_context_type*>(this); }
actual_context_type const& derived() const
{ return *static_cast<actual_context_type const*>(this); }
{ return *static_cast<actual_context_type const*>(this); }
// return the directory of the currently preprocessed file
boost::filesystem::path get_current_directory() const
@@ -320,7 +320,7 @@ protected:
friend class boost::wave::impl::pp_iterator_functor<context>;
#endif
// make sure the context has been initialized
// make sure the context has been initialized
void init_context()
{
if (!has_been_initialized) {
@@ -340,22 +340,22 @@ protected:
{ return macros.is_defined(begin, end); }
// maintain include paths (helper functions)
void set_current_directory(char const *path_)
void set_current_directory(char const *path_)
{ includes.set_current_directory(path_); }
// conditional compilation contexts
bool get_if_block_status() const { return ifblocks.get_status(); }
bool get_if_block_some_part_status() const
{ return ifblocks.get_some_part_status(); }
bool get_if_block_some_part_status() const
{ return ifblocks.get_some_part_status(); }
bool get_enclosing_if_block_status() const
{ return ifblocks.get_enclosing_status(); }
void enter_if_block(bool new_status)
void enter_if_block(bool new_status)
{ ifblocks.enter_if_block(new_status); }
bool enter_elif_block(bool new_status)
bool enter_elif_block(bool new_status)
{ return ifblocks.enter_elif_block(new_status); }
bool enter_else_block() { return ifblocks.enter_else_block(); }
bool exit_if_block() { return ifblocks.exit_if_block(); }
typename boost::wave::util::if_block_stack::size_type get_if_block_depth() const
typename boost::wave::util::if_block_stack::size_type get_if_block_depth() const
{ return ifblocks.get_if_block_depth(); }
// stack of iteration contexts
@@ -366,29 +366,29 @@ protected:
///////////////////////////////////////////////////////////////////////////////
//
// expand_tokensequence():
// expands all macros contained in a given token sequence, handles '##'
// and '#' pp operators and re-scans the resulting sequence
// expand_tokensequence():
// expands all macros contained in a given token sequence, handles '##'
// and '#' pp operators and re-scans the resulting sequence
// (essentially pre-processes the token sequence).
//
// The expand_undefined parameter is true during macro expansion inside
// a C++ expression given for a #if or #elif statement.
// a C++ expression given for a #if or #elif statement.
//
///////////////////////////////////////////////////////////////////////////////
template <typename IteratorT2>
token_type expand_tokensequence(IteratorT2 &first_, IteratorT2 const &last_,
token_sequence_type &pending, token_sequence_type &expanded,
token_type expand_tokensequence(IteratorT2 &first_, IteratorT2 const &last_,
token_sequence_type &pending, token_sequence_type &expanded,
bool& seen_newline, bool expand_undefined = false)
{
return macros.expand_tokensequence(first_, last_, pending, expanded,
return macros.expand_tokensequence(first_, last_, pending, expanded,
seen_newline, expand_undefined);
}
template <typename IteratorT2>
void expand_whole_tokensequence(IteratorT2 &first_, IteratorT2 const &last_,
void expand_whole_tokensequence(IteratorT2 &first_, IteratorT2 const &last_,
token_sequence_type &expanded, bool expand_undefined = true)
{
macros.expand_whole_tokensequence(expanded, first_, last_,
macros.expand_whole_tokensequence(expanded, first_, last_,
expand_undefined);
// remove any contained placeholder
@@ -401,33 +401,33 @@ public:
// maintain the real name of the current preprocessed file
void set_current_filename(char const *real_name)
{ current_filename = real_name; }
std::string const &get_current_filename() const
std::string const &get_current_filename() const
{ return current_filename; }
// maintain the list of known headers containing #pragma once
// maintain the list of known headers containing #pragma once
bool has_pragma_once(std::string const &filename_)
{ return includes.has_pragma_once(filename_); }
bool add_pragma_once_header(std::string const &filename_,
std::string const& guard_name)
{
{
get_hooks().detected_include_guard(derived(), filename_, guard_name);
return includes.add_pragma_once_header(filename_, guard_name);
return includes.add_pragma_once_header(filename_, guard_name);
}
bool add_pragma_once_header(token_type const &pragma_,
bool add_pragma_once_header(token_type const &pragma_,
std::string const &filename_)
{
{
get_hooks().detected_pragma_once(derived(), pragma_, filename_);
return includes.add_pragma_once_header(filename_,
"__BOOST_WAVE_PRAGMA_ONCE__");
return includes.add_pragma_once_header(filename_,
"__BOOST_WAVE_PRAGMA_ONCE__");
}
#endif
#endif
void set_current_relative_filename(char const *real_name)
{ current_relative_filename = real_name; }
std::string const &get_current_relative_filename() const
std::string const &get_current_relative_filename() const
{ return current_relative_filename; }
bool find_include_file (std::string &s, std::string &d, bool is_system,
bool find_include_file (std::string &s, std::string &d, bool is_system,
char const *current_file) const
{ return includes.find_include_file(s, d, is_system, current_file); }
@@ -459,8 +459,8 @@ private:
{
using namespace boost::serialization;
if (version != (loaded_version & ~version_mask)) {
BOOST_WAVE_THROW_CTX((*this), preprocess_exception,
incompatible_config, "cpp_context state version",
BOOST_WAVE_THROW_CTX((*this), preprocess_exception,
incompatible_config, "cpp_context state version",
get_main_pos());
return;
}
@@ -471,7 +471,7 @@ private:
// BOOST_PP_STRINGIZE(BOOST_WAVE_CONFIG)
ar & make_nvp("config", config);
if (config != BOOST_PP_STRINGIZE(BOOST_WAVE_CONFIG)) {
BOOST_WAVE_THROW_CTX((*this), preprocess_exception,
BOOST_WAVE_THROW_CTX((*this), preprocess_exception,
incompatible_config, "BOOST_WAVE_CONFIG", get_main_pos());
return;
}
@@ -479,8 +479,8 @@ private:
// BOOST_WAVE_PRAGMA_KEYWORD
ar & make_nvp("pragma_keyword", pragma_keyword);
if (pragma_keyword != BOOST_WAVE_PRAGMA_KEYWORD) {
BOOST_WAVE_THROW_CTX((*this), preprocess_exception,
incompatible_config, "BOOST_WAVE_PRAGMA_KEYWORD",
BOOST_WAVE_THROW_CTX((*this), preprocess_exception,
incompatible_config, "BOOST_WAVE_PRAGMA_KEYWORD",
get_main_pos());
return;
}
@@ -488,7 +488,7 @@ private:
// BOOST_PP_STRINGIZE((BOOST_WAVE_STRINGTYPE))
ar & make_nvp("string_type", string_type_str);
if (string_type_str != BOOST_PP_STRINGIZE((BOOST_WAVE_STRINGTYPE))) {
BOOST_WAVE_THROW_CTX((*this), preprocess_exception,
BOOST_WAVE_THROW_CTX((*this), preprocess_exception,
incompatible_config, "BOOST_WAVE_STRINGTYPE", get_main_pos());
return;
}
@@ -501,7 +501,7 @@ private:
}
catch (boost::wave::preprocess_exception const& e) {
// catch version mismatch exceptions and call error handler
get_hooks().throw_exception(derived(), e);
get_hooks().throw_exception(derived(), e);
}
}
BOOST_SERIALIZATION_SPLIT_MEMBER()
@@ -515,7 +515,7 @@ private:
bool has_been_initialized; // set cwd once
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
std::string current_filename; // real name of current preprocessed file
#endif
#endif
std::string current_relative_filename; // real relative name of current preprocessed file
boost::wave::util::if_block_stack ifblocks; // conditional compilation contexts
@@ -534,7 +534,7 @@ private:
namespace boost { namespace serialization {
template<
typename Iterator, typename LexIterator,
typename Iterator, typename LexIterator,
typename InputPolicy, typename Hooks
>
struct tracking_level<boost::wave::context<Iterator, LexIterator, InputPolicy, Hooks> >
@@ -548,7 +548,7 @@ struct tracking_level<boost::wave::context<Iterator, LexIterator, InputPolicy, H
};
template<
typename Iterator, typename LexIterator,
typename Iterator, typename LexIterator,
typename InputPolicy, typename Hooks
>
struct version<boost::wave::context<Iterator, LexIterator, InputPolicy, Hooks> >

View File

@@ -20,7 +20,7 @@
#include <cctype>
#include <boost/assert.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/std::shared_ptr.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/spirit/include/classic_multi_pass.hpp>
@@ -359,7 +359,7 @@ protected:
private:
ContextT &ctx; // context, this iterator is associated with
boost::shared_ptr<base_iteration_context_type> iter_ctx;
boost::std::shared_ptr<base_iteration_context_type> iter_ctx;
bool seen_newline; // needed for recognizing begin of line
bool skipped_newline; // a newline has been skipped since last one
@@ -1608,7 +1608,7 @@ char const *current_name = 0; // never try to match current file name
ctx.set_current_directory(native_path_str.c_str());
// preprocess the opened file
boost::shared_ptr<base_iteration_context_type> new_iter_ctx (
boost::std::shared_ptr<base_iteration_context_type> new_iter_ctx (
new iteration_context_type(ctx, native_path_str.c_str(), act_pos,
boost::wave::enable_prefer_pp_numbers(ctx.get_language()),
is_system ? base_iteration_context_type::system_header :

View File

@@ -28,7 +28,7 @@
#include <boost/wave/wave_config.hpp>
#if BOOST_WAVE_SERIALIZATION != 0
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/std::shared_ptr.hpp>
#endif
#include <boost/filesystem/path.hpp>
@@ -259,7 +259,7 @@ private:
private:
defined_macros_type *current_macros; // current symbol table
boost::shared_ptr<defined_macros_type> defined_macros; // global symbol table
boost::std::shared_ptr<defined_macros_type> defined_macros; // global symbol table
token_type act_token; // current token
position_type main_pos; // last token position in the pp_iterator

View File

@@ -14,14 +14,14 @@
#include <map>
#include <boost/wave/wave_config.hpp>
#include <boost/intrusive_ptr.hpp>
#include <boost/intrusive_ptr.hpp>
#if BOOST_WAVE_SERIALIZATION != 0
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/map.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/std::shared_ptr.hpp>
#else
#include <boost/intrusive_ptr.hpp>
#include <boost/intrusive_ptr.hpp>
#endif
#include <boost/iterator/transform_iterator.hpp>
@@ -38,27 +38,27 @@ namespace util {
///////////////////////////////////////////////////////////////////////////////
//
// The symbol_table class is used for the storage of defined macros.
// The symbol_table class is used for the storage of defined macros.
//
///////////////////////////////////////////////////////////////////////////////
template <typename StringT, typename MacroDefT>
struct symbol_table
struct symbol_table
#if BOOST_WAVE_SERIALIZATION != 0
: public std::map<StringT, boost::shared_ptr<MacroDefT> >
: public std::map<StringT, boost::std::shared_ptr<MacroDefT> >
#else
: public std::map<StringT, boost::intrusive_ptr<MacroDefT> >
: public std::map<StringT, boost::intrusive_ptr<MacroDefT> >
#endif
{
#if BOOST_WAVE_SERIALIZATION != 0
typedef std::map<StringT, boost::shared_ptr<MacroDefT> > base_type;
typedef std::map<StringT, boost::std::shared_ptr<MacroDefT> > base_type;
#else
typedef std::map<StringT, boost::intrusive_ptr<MacroDefT> > base_type;
#endif
typedef typename base_type::iterator iterator_type;
typedef typename base_type::const_iterator const_iterator_type;
symbol_table(long uid_ = 0)
symbol_table(long uid_ = 0)
{}
#if BOOST_WAVE_SERIALIZATION != 0
@@ -68,7 +68,7 @@ private:
void serialize(Archive &ar, const unsigned int version)
{
using namespace boost::serialization;
ar & make_nvp("symbol_table",
ar & make_nvp("symbol_table",
boost::serialization::base_object<base_type>(*this));
}
#endif
@@ -76,7 +76,7 @@ private:
private:
///////////////////////////////////////////////////////////////////////////
//
// This is a special iterator allowing to iterate the names of all defined
// This is a special iterator allowing to iterate the names of all defined
// macros.
//
///////////////////////////////////////////////////////////////////////////
@@ -94,13 +94,13 @@ private:
typedef get_first<StringT> unary_functor;
public:
typedef transform_iterator<unary_functor, iterator_type>
typedef transform_iterator<unary_functor, iterator_type>
name_iterator;
typedef transform_iterator<unary_functor, const_iterator_type>
typedef transform_iterator<unary_functor, const_iterator_type>
const_name_iterator;
template <typename Iterator>
static
static
transform_iterator<unary_functor, Iterator> make_iterator(Iterator it)
{
return boost::make_transform_iterator<unary_functor>(it);