mirror of
https://github.com/boostorg/move.git
synced 2025-07-31 12:57: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]
|
[section:release_notes_boost_1_79 Boost 1.79 Release]
|
||||||
|
|
||||||
* Fixed bugs:
|
* 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"]].
|
* [@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]
|
[endsect]
|
||||||
|
@ -44,12 +44,12 @@ class adaptive_xbuf
|
|||||||
typedef RandRawIt iterator;
|
typedef RandRawIt iterator;
|
||||||
typedef SizeType size_type;
|
typedef SizeType size_type;
|
||||||
|
|
||||||
adaptive_xbuf()
|
BOOST_MOVE_FORCEINLINE adaptive_xbuf()
|
||||||
: m_ptr(), m_size(0), m_capacity(0)
|
: m_ptr(), m_size(0), m_capacity(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
adaptive_xbuf(RandRawIt raw_memory, size_type capacity)
|
BOOST_MOVE_FORCEINLINE adaptive_xbuf(RandRawIt raw_memory, size_type cap)
|
||||||
: m_ptr(raw_memory), m_size(0), m_capacity(capacity)
|
: m_ptr(raw_memory), m_size(0), m_capacity(cap)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<class RandIt>
|
template<class RandIt>
|
||||||
@ -58,9 +58,9 @@ class adaptive_xbuf
|
|||||||
typedef typename iterator_traits<RandIt>::difference_type rand_diff_t;
|
typedef typename iterator_traits<RandIt>::difference_type rand_diff_t;
|
||||||
if(n <= m_size){
|
if(n <= m_size){
|
||||||
boost::move(first, first+rand_diff_t(n), m_ptr);
|
boost::move(first, first+rand_diff_t(n), m_ptr);
|
||||||
size_type size = m_size;
|
size_type sz = m_size;
|
||||||
while(size-- != n){
|
while(sz-- != n){
|
||||||
m_ptr[size].~T();
|
m_ptr[sz].~T();
|
||||||
}
|
}
|
||||||
m_size = n;
|
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){
|
if(m_size > sz){
|
||||||
for(size_type szt_i = size; szt_i != m_size; ++szt_i){
|
for(size_type szt_i = sz; szt_i != m_size; ++szt_i){
|
||||||
m_ptr[szt_i].~T();
|
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);
|
BOOST_ASSERT(m_size < m_capacity);
|
||||||
if(m_size < size){
|
if(m_size < sz){
|
||||||
BOOST_TRY
|
BOOST_TRY
|
||||||
{
|
{
|
||||||
::new((void*)&m_ptr[m_size]) T(::boost::move(t));
|
::new((void*)&m_ptr[m_size]) T(::boost::move(t));
|
||||||
++m_size;
|
++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]));
|
::new((void*)&m_ptr[m_size]) T(::boost::move(m_ptr[m_size-1]));
|
||||||
}
|
}
|
||||||
t = ::boost::move(m_ptr[m_size-1]);
|
t = ::boost::move(m_ptr[m_size-1]);
|
||||||
@ -145,22 +145,22 @@ class adaptive_xbuf
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
template<class RIt>
|
template<class RIt>
|
||||||
static bool is_raw_ptr(RIt)
|
BOOST_MOVE_FORCEINLINE static bool is_raw_ptr(RIt)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is_raw_ptr(T*)
|
BOOST_MOVE_FORCEINLINE static bool is_raw_ptr(T*)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template<class U>
|
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){
|
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()));
|
uintptr_t u_addr_cp = uintptr_t(&*(this->data()+this->capacity()));
|
||||||
u_addr_sz = ((u_addr_sz + sizeof(U)-1)/sizeof(U))*sizeof(U);
|
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);
|
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>
|
template<class U>
|
||||||
U *aligned_trailing() const
|
BOOST_MOVE_FORCEINLINE U *aligned_trailing() const
|
||||||
{
|
{
|
||||||
return this->aligned_trailing<U>(this->size());
|
return this->aligned_trailing<U>(this->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class U>
|
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));
|
uintptr_t u_addr = uintptr_t(&*(this->data()+pos));
|
||||||
u_addr = ((u_addr + sizeof(U)-1)/sizeof(U))*sizeof(U);
|
u_addr = ((u_addr + sizeof(U)-1)/sizeof(U))*sizeof(U);
|
||||||
return (U*)u_addr;
|
return (U*)u_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
~adaptive_xbuf()
|
BOOST_MOVE_FORCEINLINE ~adaptive_xbuf()
|
||||||
{
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_type capacity() const
|
BOOST_MOVE_FORCEINLINE size_type capacity() const
|
||||||
{ return m_capacity; }
|
{ return m_capacity; }
|
||||||
|
|
||||||
iterator data() const
|
BOOST_MOVE_FORCEINLINE iterator data() const
|
||||||
{ return m_ptr; }
|
{ return m_ptr; }
|
||||||
|
|
||||||
iterator begin() const
|
BOOST_MOVE_FORCEINLINE iterator begin() const
|
||||||
{ return m_ptr; }
|
{ return m_ptr; }
|
||||||
|
|
||||||
iterator end() const
|
BOOST_MOVE_FORCEINLINE iterator end() const
|
||||||
{ return m_ptr+m_size; }
|
{ return m_ptr+m_size; }
|
||||||
|
|
||||||
size_type size() const
|
BOOST_MOVE_FORCEINLINE size_type size() const
|
||||||
{ return m_size; }
|
{ return m_size; }
|
||||||
|
|
||||||
bool empty() const
|
BOOST_MOVE_FORCEINLINE bool empty() const
|
||||||
{ return !m_size; }
|
{ return !m_size; }
|
||||||
|
|
||||||
void clear()
|
BOOST_MOVE_FORCEINLINE void clear()
|
||||||
{
|
{
|
||||||
this->shrink_to_fit(0u);
|
this->shrink_to_fit(0u);
|
||||||
}
|
}
|
||||||
@ -269,10 +269,10 @@ class range_xbuf
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_size(size_type size)
|
void set_size(size_type sz)
|
||||||
{
|
{
|
||||||
m_last = m_first;
|
m_last = m_first;
|
||||||
m_last += size;
|
m_last += sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -24,19 +24,19 @@ namespace movelib {
|
|||||||
template<class Comp>
|
template<class Comp>
|
||||||
struct antistable
|
struct antistable
|
||||||
{
|
{
|
||||||
explicit antistable(Comp &comp)
|
BOOST_MOVE_FORCEINLINE explicit antistable(Comp &comp)
|
||||||
: m_comp(comp)
|
: m_comp(comp)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
antistable(const antistable & other)
|
BOOST_MOVE_FORCEINLINE antistable(const antistable & other)
|
||||||
: m_comp(other.m_comp)
|
: m_comp(other.m_comp)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<class U, class V>
|
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); }
|
{ return !m_comp(v, u); }
|
||||||
|
|
||||||
const Comp &get() const
|
BOOST_MOVE_FORCEINLINE const Comp &get() const
|
||||||
{ return m_comp; }
|
{ return m_comp; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -56,15 +56,15 @@ template <class Comp>
|
|||||||
class negate
|
class negate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
negate()
|
BOOST_MOVE_FORCEINLINE negate()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
explicit negate(Comp comp)
|
BOOST_MOVE_FORCEINLINE explicit negate(Comp comp)
|
||||||
: m_comp(comp)
|
: m_comp(comp)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template <class T1, class T2>
|
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);
|
return !m_comp(l, r);
|
||||||
}
|
}
|
||||||
@ -78,15 +78,15 @@ template <class Comp>
|
|||||||
class inverse
|
class inverse
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inverse()
|
BOOST_MOVE_FORCEINLINE inverse()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
explicit inverse(Comp comp)
|
BOOST_MOVE_FORCEINLINE explicit inverse(Comp comp)
|
||||||
: m_comp(comp)
|
: m_comp(comp)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template <class T1, class T2>
|
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);
|
return m_comp(r, l);
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,9 @@ struct A
|
|||||||
int a, b, c;
|
int a, b, c;
|
||||||
static int count;
|
static int count;
|
||||||
A() : a (999), b(1000), c(1001) {++count;}
|
A() : a (999), b(1000), c(1001) {++count;}
|
||||||
A(int a) : a (a), b(1000), c(1001) {++count;}
|
A(int x) : a (x), b(1000), c(1001) {++count;}
|
||||||
A(int a, int b) : a (a), b(b), c(1001) {++count;}
|
A(int x, int y) : a (x), b(y), c(1001) {++count;}
|
||||||
A(int a, int b, int c) : a (a), b(b), c(c) {++count;}
|
A(int x, int y, int z) : a (x), b(y), c(z) {++count;}
|
||||||
A(const A&) {++count;}
|
A(const A&) {++count;}
|
||||||
virtual ~A() {--count;}
|
virtual ~A() {--count;}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user