mirror of
https://github.com/boostorg/move.git
synced 2025-07-30 12:27:14 +02:00
Fix -Wshadow warnings
This commit is contained in:
@ -805,6 +805,7 @@ Special thanks to:
|
||||
[section:release_notes_boost_1_79 Boost 1.79 Release]
|
||||
|
||||
* Fixed bugs:
|
||||
* [@https://github.com/boostorg/move/pull/46 Git Issue #46: ['"Include <algorithm> when BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE is defined"]].
|
||||
* [@https://github.com/boostorg/move/issues/48 Git Issue #48: ['"MSVC warning C4643: Forward declaring 'nothrow_t' in namespace std is not permitted by the C++ Standard"]].
|
||||
|
||||
[endsect]
|
||||
|
@ -44,12 +44,12 @@ class adaptive_xbuf
|
||||
typedef RandRawIt iterator;
|
||||
typedef SizeType size_type;
|
||||
|
||||
adaptive_xbuf()
|
||||
BOOST_MOVE_FORCEINLINE adaptive_xbuf()
|
||||
: m_ptr(), m_size(0), m_capacity(0)
|
||||
{}
|
||||
|
||||
adaptive_xbuf(RandRawIt raw_memory, size_type capacity)
|
||||
: m_ptr(raw_memory), m_size(0), m_capacity(capacity)
|
||||
BOOST_MOVE_FORCEINLINE adaptive_xbuf(RandRawIt raw_memory, size_type cap)
|
||||
: m_ptr(raw_memory), m_size(0), m_capacity(cap)
|
||||
{}
|
||||
|
||||
template<class RandIt>
|
||||
@ -58,9 +58,9 @@ class adaptive_xbuf
|
||||
typedef typename iterator_traits<RandIt>::difference_type rand_diff_t;
|
||||
if(n <= m_size){
|
||||
boost::move(first, first+rand_diff_t(n), m_ptr);
|
||||
size_type size = m_size;
|
||||
while(size-- != n){
|
||||
m_ptr[size].~T();
|
||||
size_type sz = m_size;
|
||||
while(sz-- != n){
|
||||
m_ptr[sz].~T();
|
||||
}
|
||||
m_size = n;
|
||||
}
|
||||
@ -103,30 +103,30 @@ class adaptive_xbuf
|
||||
}
|
||||
}
|
||||
|
||||
void set_size(size_type size)
|
||||
BOOST_MOVE_FORCEINLINE void set_size(size_type sz)
|
||||
{
|
||||
m_size = size;
|
||||
m_size = sz;
|
||||
}
|
||||
|
||||
void shrink_to_fit(size_type const size)
|
||||
void shrink_to_fit(size_type const sz)
|
||||
{
|
||||
if(m_size > size){
|
||||
for(size_type szt_i = size; szt_i != m_size; ++szt_i){
|
||||
if(m_size > sz){
|
||||
for(size_type szt_i = sz; szt_i != m_size; ++szt_i){
|
||||
m_ptr[szt_i].~T();
|
||||
}
|
||||
m_size = size;
|
||||
m_size = sz;
|
||||
}
|
||||
}
|
||||
|
||||
void initialize_until(size_type const size, T &t)
|
||||
void initialize_until(size_type const sz, T &t)
|
||||
{
|
||||
BOOST_ASSERT(m_size < m_capacity);
|
||||
if(m_size < size){
|
||||
if(m_size < sz){
|
||||
BOOST_TRY
|
||||
{
|
||||
::new((void*)&m_ptr[m_size]) T(::boost::move(t));
|
||||
++m_size;
|
||||
for(; m_size != size; ++m_size){
|
||||
for(; m_size != sz; ++m_size){
|
||||
::new((void*)&m_ptr[m_size]) T(::boost::move(m_ptr[m_size-1]));
|
||||
}
|
||||
t = ::boost::move(m_ptr[m_size-1]);
|
||||
@ -145,22 +145,22 @@ class adaptive_xbuf
|
||||
|
||||
private:
|
||||
template<class RIt>
|
||||
static bool is_raw_ptr(RIt)
|
||||
BOOST_MOVE_FORCEINLINE static bool is_raw_ptr(RIt)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool is_raw_ptr(T*)
|
||||
BOOST_MOVE_FORCEINLINE static bool is_raw_ptr(T*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
template<class U>
|
||||
bool supports_aligned_trailing(size_type size, size_type trail_count) const
|
||||
bool supports_aligned_trailing(size_type sz, size_type trail_count) const
|
||||
{
|
||||
if(this->is_raw_ptr(this->data()) && m_capacity){
|
||||
uintptr_t u_addr_sz = uintptr_t(&*(this->data()+size));
|
||||
uintptr_t u_addr_sz = uintptr_t(&*(this->data()+sz));
|
||||
uintptr_t u_addr_cp = uintptr_t(&*(this->data()+this->capacity()));
|
||||
u_addr_sz = ((u_addr_sz + sizeof(U)-1)/sizeof(U))*sizeof(U);
|
||||
return (u_addr_cp >= u_addr_sz) && ((u_addr_cp - u_addr_sz)/sizeof(U) >= trail_count);
|
||||
@ -169,43 +169,43 @@ class adaptive_xbuf
|
||||
}
|
||||
|
||||
template<class U>
|
||||
U *aligned_trailing() const
|
||||
BOOST_MOVE_FORCEINLINE U *aligned_trailing() const
|
||||
{
|
||||
return this->aligned_trailing<U>(this->size());
|
||||
}
|
||||
|
||||
template<class U>
|
||||
U *aligned_trailing(size_type pos) const
|
||||
BOOST_MOVE_FORCEINLINE U *aligned_trailing(size_type pos) const
|
||||
{
|
||||
uintptr_t u_addr = uintptr_t(&*(this->data()+pos));
|
||||
u_addr = ((u_addr + sizeof(U)-1)/sizeof(U))*sizeof(U);
|
||||
return (U*)u_addr;
|
||||
}
|
||||
|
||||
~adaptive_xbuf()
|
||||
BOOST_MOVE_FORCEINLINE ~adaptive_xbuf()
|
||||
{
|
||||
this->clear();
|
||||
}
|
||||
|
||||
size_type capacity() const
|
||||
BOOST_MOVE_FORCEINLINE size_type capacity() const
|
||||
{ return m_capacity; }
|
||||
|
||||
iterator data() const
|
||||
BOOST_MOVE_FORCEINLINE iterator data() const
|
||||
{ return m_ptr; }
|
||||
|
||||
iterator begin() const
|
||||
BOOST_MOVE_FORCEINLINE iterator begin() const
|
||||
{ return m_ptr; }
|
||||
|
||||
iterator end() const
|
||||
BOOST_MOVE_FORCEINLINE iterator end() const
|
||||
{ return m_ptr+m_size; }
|
||||
|
||||
size_type size() const
|
||||
BOOST_MOVE_FORCEINLINE size_type size() const
|
||||
{ return m_size; }
|
||||
|
||||
bool empty() const
|
||||
BOOST_MOVE_FORCEINLINE bool empty() const
|
||||
{ return !m_size; }
|
||||
|
||||
void clear()
|
||||
BOOST_MOVE_FORCEINLINE void clear()
|
||||
{
|
||||
this->shrink_to_fit(0u);
|
||||
}
|
||||
@ -269,10 +269,10 @@ class range_xbuf
|
||||
return pos;
|
||||
}
|
||||
|
||||
void set_size(size_type size)
|
||||
void set_size(size_type sz)
|
||||
{
|
||||
m_last = m_first;
|
||||
m_last += size;
|
||||
m_last += sz;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -24,19 +24,19 @@ namespace movelib {
|
||||
template<class Comp>
|
||||
struct antistable
|
||||
{
|
||||
explicit antistable(Comp &comp)
|
||||
BOOST_MOVE_FORCEINLINE explicit antistable(Comp &comp)
|
||||
: m_comp(comp)
|
||||
{}
|
||||
|
||||
antistable(const antistable & other)
|
||||
BOOST_MOVE_FORCEINLINE antistable(const antistable & other)
|
||||
: m_comp(other.m_comp)
|
||||
{}
|
||||
|
||||
template<class U, class V>
|
||||
bool operator()(const U &u, const V & v)
|
||||
BOOST_MOVE_FORCEINLINE bool operator()(const U &u, const V & v)
|
||||
{ return !m_comp(v, u); }
|
||||
|
||||
const Comp &get() const
|
||||
BOOST_MOVE_FORCEINLINE const Comp &get() const
|
||||
{ return m_comp; }
|
||||
|
||||
private:
|
||||
@ -56,15 +56,15 @@ template <class Comp>
|
||||
class negate
|
||||
{
|
||||
public:
|
||||
negate()
|
||||
BOOST_MOVE_FORCEINLINE negate()
|
||||
{}
|
||||
|
||||
explicit negate(Comp comp)
|
||||
BOOST_MOVE_FORCEINLINE explicit negate(Comp comp)
|
||||
: m_comp(comp)
|
||||
{}
|
||||
|
||||
template <class T1, class T2>
|
||||
bool operator()(const T1& l, const T2& r)
|
||||
BOOST_MOVE_FORCEINLINE bool operator()(const T1& l, const T2& r)
|
||||
{
|
||||
return !m_comp(l, r);
|
||||
}
|
||||
@ -78,15 +78,15 @@ template <class Comp>
|
||||
class inverse
|
||||
{
|
||||
public:
|
||||
inverse()
|
||||
BOOST_MOVE_FORCEINLINE inverse()
|
||||
{}
|
||||
|
||||
explicit inverse(Comp comp)
|
||||
BOOST_MOVE_FORCEINLINE explicit inverse(Comp comp)
|
||||
: m_comp(comp)
|
||||
{}
|
||||
|
||||
template <class T1, class T2>
|
||||
bool operator()(const T1& l, const T2& r)
|
||||
BOOST_MOVE_FORCEINLINE bool operator()(const T1& l, const T2& r)
|
||||
{
|
||||
return m_comp(r, l);
|
||||
}
|
||||
|
@ -18,9 +18,9 @@ struct A
|
||||
int a, b, c;
|
||||
static int count;
|
||||
A() : a (999), b(1000), c(1001) {++count;}
|
||||
A(int a) : a (a), b(1000), c(1001) {++count;}
|
||||
A(int a, int b) : a (a), b(b), c(1001) {++count;}
|
||||
A(int a, int b, int c) : a (a), b(b), c(c) {++count;}
|
||||
A(int x) : a (x), b(1000), c(1001) {++count;}
|
||||
A(int x, int y) : a (x), b(y), c(1001) {++count;}
|
||||
A(int x, int y, int z) : a (x), b(y), c(z) {++count;}
|
||||
A(const A&) {++count;}
|
||||
virtual ~A() {--count;}
|
||||
};
|
||||
|
Reference in New Issue
Block a user