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

@@ -2,9 +2,9 @@
// Copyright Beman Dawes 2002-2009
// Copyright Jan Langer 2002
// Copyright Dietmar Kuehl 2001
// Copyright Dietmar Kuehl 2001
// Copyright Vladimir Prus 2002
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
@@ -28,7 +28,7 @@
#include <boost/detail/bitmask.hpp>
#include <boost/system/error_code.hpp>
#include <boost/system/system_error.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/std::shared_ptr.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/iterator.hpp>
@@ -59,7 +59,7 @@ namespace boost
//--------------------------------------------------------------------------------------//
enum file_type
{
{
status_error,
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
status_unknown = status_error,
@@ -92,7 +92,7 @@ namespace boost
// Values are from POSIX and are given in octal per the POSIX standard.
// permission bits
owner_read = 0400, // S_IRUSR, Read permission, owner
owner_write = 0200, // S_IWUSR, Write permission, owner
owner_exe = 0100, // S_IXUSR, Execute/search permission, owner
@@ -115,8 +115,8 @@ namespace boost
set_uid_on_exe = 04000, // S_ISUID, Set-user-ID on execution
set_gid_on_exe = 02000, // S_ISGID, Set-group-ID on execution
sticky_bit = 01000, // S_ISVTX,
// (POSIX XSI) On directories, restricted deletion flag
// (V7) 'sticky bit': save swapped text even after use
// (POSIX XSI) On directories, restricted deletion flag
// (V7) 'sticky bit': save swapped text even after use
// (SunOS) On non-directories: don't cache this file
// (SVID-v4.2) On directories: restricted deletion flag
// Also see http://en.wikipedia.org/wiki/Sticky_bit
@@ -151,13 +151,13 @@ namespace boost
// observers
file_type type() const { return m_value; }
perms permissions() const { return m_perms; }
perms permissions() const { return m_perms; }
// modifiers
void type(file_type v) { m_value = v; }
void permissions(perms prms) { m_perms = prms; }
bool operator==(const file_status& rhs) const { return type() == rhs.type() &&
bool operator==(const file_status& rhs) const { return type() == rhs.type() &&
permissions() == rhs.permissions(); }
bool operator!=(const file_status& rhs) const { return !(*this == rhs); }
@@ -260,7 +260,7 @@ namespace boost
BOOST_FILESYSTEM_DECL
void resize_file(const path& p, uintmax_t size, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
space_info space(const path& p, system::error_code* ec=0);
space_info space(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
path system_complete(const path& p, system::error_code* ec=0);
BOOST_FILESYSTEM_DECL
@@ -277,37 +277,37 @@ namespace boost
inline
file_status status(const path& p) {return detail::status(p);}
inline
inline
file_status status(const path& p, system::error_code& ec)
{return detail::status(p, &ec);}
inline
inline
file_status symlink_status(const path& p) {return detail::symlink_status(p);}
inline
file_status symlink_status(const path& p, system::error_code& ec)
{return detail::symlink_status(p, &ec);}
inline
inline
bool exists(const path& p) {return exists(detail::status(p));}
inline
inline
bool exists(const path& p, system::error_code& ec)
{return exists(detail::status(p, &ec));}
inline
inline
bool is_directory(const path& p) {return is_directory(detail::status(p));}
inline
inline
bool is_directory(const path& p, system::error_code& ec)
{return is_directory(detail::status(p, &ec));}
inline
inline
bool is_regular_file(const path& p) {return is_regular_file(detail::status(p));}
inline
inline
bool is_regular_file(const path& p, system::error_code& ec)
{return is_regular_file(detail::status(p, &ec));}
inline
inline
bool is_other(const path& p) {return is_other(detail::status(p));}
inline
inline
bool is_other(const path& p, system::error_code& ec)
{return is_other(detail::status(p, &ec));}
inline
bool is_symlink(const path& p) {return is_symlink(detail::symlink_status(p));}
inline
inline
bool is_symlink(const path& p, system::error_code& ec)
{return is_symlink(detail::symlink_status(p, &ec));}
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
@@ -330,7 +330,7 @@ namespace boost
// in alphabetical order, unless otherwise noted //
// //
//--------------------------------------------------------------------------------------//
// forward declarations
path current_path(); // fwd declaration
path initial_path();
@@ -367,7 +367,7 @@ namespace boost
void copy(const path& from, const path& to) {detail::copy(from, to);}
inline
void copy(const path& from, const path& to, system::error_code& ec)
void copy(const path& from, const path& to, system::error_code& ec)
{detail::copy(from, to, &ec);}
inline
void copy_directory(const path& from, const path& to)
@@ -500,7 +500,7 @@ namespace boost
inline
boost::uintmax_t remove_all(const path& p) {return detail::remove_all(p);}
inline
boost::uintmax_t remove_all(const path& p, system::error_code& ec)
{return detail::remove_all(p, &ec);}
@@ -517,10 +517,10 @@ namespace boost
void resize_file(const path& p, uintmax_t size, system::error_code& ec)
{detail::resize_file(p, size, &ec);}
inline
space_info space(const path& p) {return detail::space(p);}
space_info space(const path& p) {return detail::space(p);}
inline
space_info space(const path& p, system::error_code& ec) {return detail::space(p, &ec);}
space_info space(const path& p, system::error_code& ec) {return detail::space(p, &ec);}
# ifndef BOOST_FILESYSTEM_NO_DEPRECATED
inline bool symbolic_link_exists(const path& p)
@@ -537,7 +537,7 @@ namespace boost
path temp_directory_path() {return detail::temp_directory_path();}
inline
path temp_directory_path(system::error_code& ec)
path temp_directory_path(system::error_code& ec)
{return detail::temp_directory_path(&ec);}
inline
path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%")
@@ -552,7 +552,7 @@ namespace boost
// //
//--------------------------------------------------------------------------------------//
// GCC has a problem with a member function named path within a namespace or
// GCC has a problem with a member function named path within a namespace or
// sub-namespace that also has a class named path. The workaround is to always
// fully qualify the name path when it refers to the class name.
@@ -593,12 +593,12 @@ public:
file_status symlink_status() const {return m_get_symlink_status();}
file_status symlink_status(system::error_code& ec) const {return m_get_symlink_status(&ec);}
bool operator==(const directory_entry& rhs) {return m_path == rhs.m_path;}
bool operator!=(const directory_entry& rhs) {return m_path != rhs.m_path;}
bool operator< (const directory_entry& rhs) {return m_path < rhs.m_path;}
bool operator<=(const directory_entry& rhs) {return m_path <= rhs.m_path;}
bool operator> (const directory_entry& rhs) {return m_path > rhs.m_path;}
bool operator>=(const directory_entry& rhs) {return m_path >= rhs.m_path;}
bool operator==(const directory_entry& rhs) {return m_path == rhs.m_path;}
bool operator!=(const directory_entry& rhs) {return m_path != rhs.m_path;}
bool operator< (const directory_entry& rhs) {return m_path < rhs.m_path;}
bool operator<=(const directory_entry& rhs) {return m_path <= rhs.m_path;}
bool operator> (const directory_entry& rhs) {return m_path > rhs.m_path;}
bool operator>=(const directory_entry& rhs) {return m_path >= rhs.m_path;}
private:
boost::filesystem::path m_path;
@@ -625,7 +625,7 @@ namespace detail
# if defined(BOOST_POSIX_API)
, void *& buffer
# endif
);
);
struct dir_itr_imp
{
@@ -688,7 +688,7 @@ namespace detail
~directory_iterator() {} // never throws
directory_iterator& increment(system::error_code& ec)
{
{
detail::directory_iterator_increment(*this, &ec);
return *this;
}
@@ -700,16 +700,16 @@ namespace detail
friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_increment(directory_iterator& it,
system::error_code* ec);
// shared_ptr provides shallow-copy semantics required for InputIterators.
// std::shared_ptr provides shallow-copy semantics required for InputIterators.
// m_imp.get()==0 indicates the end iterator.
boost::shared_ptr< detail::dir_itr_imp > m_imp;
boost::std::shared_ptr< detail::dir_itr_imp > m_imp;
friend class boost::iterator_core_access;
boost::iterator_facade<
directory_iterator,
directory_entry,
boost::single_pass_traversal_tag >::reference dereference() const
boost::single_pass_traversal_tag >::reference dereference() const
{
BOOST_ASSERT_MSG(m_imp.get(), "attempt to dereference end iterator");
return m_imp->dir_entry;
@@ -884,7 +884,7 @@ namespace detail
}
int level() const
{
{
BOOST_ASSERT_MSG(m_imp.get(),
"level() on end recursive_directory_iterator");
return m_imp->m_level;
@@ -903,7 +903,7 @@ namespace detail
# endif
void pop()
{
{
BOOST_ASSERT_MSG(m_imp.get(),
"pop() on end recursive_directory_iterator");
m_imp->pop();
@@ -936,17 +936,17 @@ namespace detail
private:
// shared_ptr provides shallow-copy semantics required for InputIterators.
// std::shared_ptr provides shallow-copy semantics required for InputIterators.
// m_imp.get()==0 indicates the end iterator.
boost::shared_ptr< detail::recur_dir_itr_imp > m_imp;
boost::std::shared_ptr< detail::recur_dir_itr_imp > m_imp;
friend class boost::iterator_core_access;
boost::iterator_facade<
boost::iterator_facade<
recursive_directory_iterator,
directory_entry,
boost::single_pass_traversal_tag >::reference
dereference() const
dereference() const
{
BOOST_ASSERT_MSG(m_imp.get(),
"dereference of end recursive_directory_iterator");
@@ -954,7 +954,7 @@ namespace detail
}
void increment()
{
{
BOOST_ASSERT_MSG(m_imp.get(),
"increment of end recursive_directory_iterator");
m_imp->increment(0);
@@ -976,7 +976,7 @@ namespace detail
// class filesystem_error //
// //
//--------------------------------------------------------------------------------------//
class BOOST_SYMBOL_VISIBLE filesystem_error : public system::system_error
{
// see http://www.boost.org/more/error_handling.html for design rationale
@@ -1009,7 +1009,7 @@ namespace detail
}
catch (...) { m_imp_ptr.reset(); }
}
filesystem_error(
const std::string & what_arg, const path& path1_arg,
const path& path2_arg, system::error_code ec)
@@ -1075,7 +1075,7 @@ namespace detail
path m_path2; // may be empty()
std::string m_what; // not built until needed
};
boost::shared_ptr<m_imp> m_imp_ptr;
boost::std::shared_ptr<m_imp> m_imp_ptr;
};
// test helper -----------------------------------------------------------------------//

View File

@@ -26,7 +26,7 @@
#include <boost/system/error_code.hpp>
#include <boost/system/system_error.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/std::shared_ptr.hpp>
#include <boost/io/detail/quoted_manip.hpp>
#include <boost/static_assert.hpp>
#include <boost/functional/hash_fwd.hpp>
@@ -62,11 +62,11 @@ namespace filesystem
# ifdef BOOST_WINDOWS_API
typedef wchar_t value_type;
BOOST_STATIC_CONSTEXPR value_type preferred_separator = L'\\';
# else
# else
typedef char value_type;
BOOST_STATIC_CONSTEXPR value_type preferred_separator = '/';
# endif
typedef std::basic_string<value_type> string_type;
typedef std::basic_string<value_type> string_type;
typedef std::codecvt<wchar_t, char,
std::mbstate_t> codecvt_type;
@@ -89,7 +89,7 @@ namespace filesystem
//
// The path locale, which is global to the thread, can be changed by the
// imbue() function. It is initialized to an implementation defined locale.
//
//
// For Windows, wchar_t strings do not undergo conversion. char strings
// are converted using the "ANSI" or "OEM" code pages, as determined by
// the AreFileApisANSI() function, or, if a conversion argument is given,
@@ -98,7 +98,7 @@ namespace filesystem
// See m_pathname comments for further important rationale.
// TODO: rules needed for operating systems that use / or .
// differently, or format directory paths differently from file paths.
// differently, or format directory paths differently from file paths.
//
// **********************************************************************************
//
@@ -127,7 +127,7 @@ namespace filesystem
// ----- constructors -----
path(){}
path(){}
path(const path& p) : m_pathname(p.m_pathname) {}
@@ -159,7 +159,7 @@ namespace filesystem
template <class InputIterator>
path(InputIterator begin, InputIterator end)
{
{
if (begin != end)
{
std::basic_string<typename std::iterator_traits<InputIterator>::value_type>
@@ -170,7 +170,7 @@ namespace filesystem
template <class InputIterator>
path(InputIterator begin, InputIterator end, const codecvt_type& cvt)
{
{
if (begin != end)
{
std::basic_string<typename std::iterator_traits<InputIterator>::value_type>
@@ -225,7 +225,7 @@ namespace filesystem
template <class InputIterator>
path& assign(InputIterator begin, InputIterator end, const codecvt_type& cvt)
{
{
m_pathname.clear();
if (begin != end)
{
@@ -270,13 +270,13 @@ namespace filesystem
template <class InputIterator>
path& concat(InputIterator begin, InputIterator end)
{
{
return concat(begin, end, codecvt());
}
template <class InputIterator>
path& concat(InputIterator begin, InputIterator end, const codecvt_type& cvt)
{
{
if (begin == end)
return *this;
std::basic_string<typename std::iterator_traits<InputIterator>::value_type>
@@ -313,7 +313,7 @@ namespace filesystem
template <class InputIterator>
path& append(InputIterator begin, InputIterator end)
{
{
return append(begin, end, codecvt());
}
@@ -334,7 +334,7 @@ namespace filesystem
void swap(path& rhs) { m_pathname.swap(rhs.m_pathname); }
// ----- observers -----
// For operating systems that format file paths differently than directory
// paths, return values from observers are formatted as file names unless there
// is a trailing separator, in which case returns are formatted as directory
@@ -364,16 +364,16 @@ namespace filesystem
String string(const codecvt_type& cvt) const;
# ifdef BOOST_WINDOWS_API
const std::string string() const { return string(codecvt()); }
const std::string string() const { return string(codecvt()); }
const std::string string(const codecvt_type& cvt) const
{
{
std::string tmp;
if (!m_pathname.empty())
path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(),
tmp, cvt);
return tmp;
}
// string_type is std::wstring, so there is no conversion
const std::wstring& wstring() const { return m_pathname; }
const std::wstring& wstring(const codecvt_type&) const { return m_pathname; }
@@ -385,7 +385,7 @@ namespace filesystem
const std::wstring wstring() const { return wstring(codecvt()); }
const std::wstring wstring(const codecvt_type& cvt) const
{
{
std::wstring tmp;
if (!m_pathname.empty())
path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(),
@@ -404,8 +404,8 @@ namespace filesystem
String generic_string(const codecvt_type& cvt) const;
# ifdef BOOST_WINDOWS_API
const std::string generic_string() const { return generic_string(codecvt()); }
const std::string generic_string(const codecvt_type& cvt) const;
const std::string generic_string() const { return generic_string(codecvt()); }
const std::string generic_string(const codecvt_type& cvt) const;
const std::wstring generic_wstring() const;
const std::wstring generic_wstring(const codecvt_type&) const { return generic_wstring(); };
@@ -426,7 +426,7 @@ namespace filesystem
// ----- decomposition -----
path root_path() const;
path root_path() const;
path root_name() const; // returns 0 or 1 element path
// even on POSIX, root_name() is non-empty() for network paths
path root_directory() const; // returns 0 or 1 element path
@@ -455,7 +455,7 @@ namespace filesystem
return has_root_directory();
# endif
}
bool is_relative() const { return !is_absolute(); }
bool is_relative() const { return !is_absolute(); }
// ----- iterators -----
@@ -489,7 +489,7 @@ namespace filesystem
# if defined(BOOST_FILESYSTEM_DEPRECATED)
// deprecated functions with enough signature or semantic changes that they are
// not supplied by default
// not supplied by default
const std::string file_string() const { return string(); }
const std::string directory_string() const { return string(); }
const std::string native_file_string() const { return string(); }
@@ -502,7 +502,7 @@ namespace filesystem
//basic_path(const string_type& str, name_check) { operator/=(str); }
//basic_path(const typename string_type::value_type* s, name_check)
// { operator/=(s);}
//static bool default_name_check_writable() { return false; }
//static bool default_name_check_writable() { return false; }
//static void default_name_check(name_check) {}
//static name_check default_name_check() { return 0; }
//basic_path& canonize();
@@ -529,7 +529,7 @@ namespace filesystem
// slashes NOT converted to backslashes
# if defined(_MSC_VER)
# pragma warning(pop) // restore warning settings.
# endif
# endif
string_type::size_type m_append_separator_if_needed();
// Returns: If separator is to be appended, m_pathname.size() before append. Otherwise 0.
@@ -541,7 +541,7 @@ namespace filesystem
path& m_normalize();
// Was qualified; como433beta8 reports:
// warning #427-D: qualified name is not allowed in member declaration
// warning #427-D: qualified name is not allowed in member declaration
friend class iterator;
friend bool operator<(const path& lhs, const path& rhs);
@@ -565,7 +565,7 @@ namespace filesystem
//------------------------------------------------------------------------------------//
// class path::iterator //
//------------------------------------------------------------------------------------//
class path::iterator
: public boost::iterator_facade<
path::iterator,
@@ -596,7 +596,7 @@ namespace filesystem
// m_path_ptr->m_pathname.
// if m_element is implicit dot, m_pos is the
// position of the last separator in the path.
// end() iterator is indicated by
// end() iterator is indicated by
// m_pos == m_path_ptr->m_pathname.size()
}; // path::iterator
@@ -611,15 +611,15 @@ namespace filesystem
inline bool lexicographical_compare(path::iterator first1, path::iterator last1,
path::iterator first2, path::iterator last2)
{ return detail::lex_compare(first1, last1, first2, last2) < 0; }
inline bool operator==(const path& lhs, const path& rhs) {return lhs.compare(rhs) == 0;}
inline bool operator==(const path& lhs, const path::string_type& rhs) {return lhs.compare(rhs) == 0;}
inline bool operator==(const path& lhs, const path::string_type& rhs) {return lhs.compare(rhs) == 0;}
inline bool operator==(const path::string_type& lhs, const path& rhs) {return rhs.compare(lhs) == 0;}
inline bool operator==(const path& lhs, const path::value_type* rhs) {return lhs.compare(rhs) == 0;}
inline bool operator==(const path::value_type* lhs, const path& rhs) {return rhs.compare(lhs) == 0;}
inline bool operator!=(const path& lhs, const path& rhs) {return lhs.compare(rhs) != 0;}
inline bool operator!=(const path& lhs, const path::string_type& rhs) {return lhs.compare(rhs) != 0;}
inline bool operator!=(const path& lhs, const path::string_type& rhs) {return lhs.compare(rhs) != 0;}
inline bool operator!=(const path::string_type& lhs, const path& rhs) {return rhs.compare(lhs) != 0;}
inline bool operator!=(const path& lhs, const path::value_type* rhs) {return lhs.compare(rhs) != 0;}
inline bool operator!=(const path::value_type* lhs, const path& rhs) {return rhs.compare(lhs) != 0;}
@@ -658,7 +658,7 @@ namespace filesystem
return os
<< boost::io::quoted(p.template string<std::basic_string<Char> >(), static_cast<Char>('&'));
}
template <class Char, class Traits>
inline std::basic_istream<Char, Traits>&
operator>>(std::basic_istream<Char, Traits>& is, path& p)
@@ -668,7 +668,7 @@ namespace filesystem
p = str;
return is;
}
// name_checks
// These functions are holdovers from version 1. It isn't clear they have much
@@ -680,14 +680,14 @@ namespace filesystem
BOOST_FILESYSTEM_DECL bool portable_directory_name(const std::string & name);
BOOST_FILESYSTEM_DECL bool portable_file_name(const std::string & name);
BOOST_FILESYSTEM_DECL bool native(const std::string & name);
//--------------------------------------------------------------------------------------//
// class path member template implementation //
//--------------------------------------------------------------------------------------//
template <class InputIterator>
path& path::append(InputIterator begin, InputIterator end, const codecvt_type& cvt)
{
{
if (begin == end)
return *this;
string_type::size_type sep_pos(m_append_separator_if_needed());