mirror of
https://github.com/boostorg/utility.git
synced 2025-10-14 17:45:20 +02:00
Compare commits
1 Commits
boost-1.43
...
boost-1.41
Author | SHA1 | Date | |
---|---|---|---|
|
7ee1814664 |
@@ -281,7 +281,7 @@ object_id_compare::operator ()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return a.second->before( *b.second ) != 0;
|
return a.second->before( *b.second );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,10 +11,6 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
|
||||||
#pragma warning(disable:4996) // warning C4996: 'std::equal': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Note: This file tests every single valid bit-grouping on its own, and some
|
Note: This file tests every single valid bit-grouping on its own, and some
|
||||||
random combinations of bit-groupings.
|
random combinations of bit-groupings.
|
||||||
|
@@ -21,10 +21,6 @@
|
|||||||
#include <libs/type_traits/test/test.hpp>
|
#include <libs/type_traits/test/test.hpp>
|
||||||
#include <libs/type_traits/test/check_type.hpp>
|
#include <libs/type_traits/test/check_type.hpp>
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
|
||||||
#pragma warning(disable:4181) // : warning C4181: qualifier applied to reference type; ignored
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// a way prevent warnings for unused variables
|
// a way prevent warnings for unused variables
|
||||||
template<class T> inline void unused_variable(const T&) {}
|
template<class T> inline void unused_variable(const T&) {}
|
||||||
|
|
||||||
@@ -56,8 +52,7 @@ struct contained
|
|||||||
const_reference const_get()const { return v_; }
|
const_reference const_get()const { return v_; }
|
||||||
// pass value:
|
// pass value:
|
||||||
void call(param_type){}
|
void call(param_type){}
|
||||||
private:
|
|
||||||
contained& operator=(const contained&);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
@@ -82,8 +77,6 @@ struct contained<T[N]>
|
|||||||
reference get() { return v_; }
|
reference get() { return v_; }
|
||||||
const_reference const_get()const { return v_; }
|
const_reference const_get()const { return v_; }
|
||||||
void call(param_type){}
|
void call(param_type){}
|
||||||
private:
|
|
||||||
contained& operator=(const contained&);
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -204,7 +197,7 @@ struct comparible_UDT
|
|||||||
bool operator == (const comparible_UDT& v){ return v.i_ == i_; }
|
bool operator == (const comparible_UDT& v){ return v.i_ == i_; }
|
||||||
};
|
};
|
||||||
|
|
||||||
int main()
|
int main(int argc, char *argv[ ])
|
||||||
{
|
{
|
||||||
call_traits_checker<comparible_UDT> c1;
|
call_traits_checker<comparible_UDT> c1;
|
||||||
comparible_UDT u;
|
comparible_UDT u;
|
||||||
|
@@ -6,6 +6,8 @@
|
|||||||
#ifndef UUID_1D94A7C6054E11DB9804B622A1EF5492
|
#ifndef UUID_1D94A7C6054E11DB9804B622A1EF5492
|
||||||
#define UUID_1D94A7C6054E11DB9804B622A1EF5492
|
#define UUID_1D94A7C6054E11DB9804B622A1EF5492
|
||||||
|
|
||||||
#error The header <boost/exception.hpp> has been deprecated. Please #include <boost/exception/all.hpp> instead.
|
//The header <boost/exception.hpp> has been deprecated.
|
||||||
|
//Please #include <boost/exception/all.hpp> instead.
|
||||||
|
#include <boost/exception/all.hpp>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -114,6 +114,8 @@ class value_initialized
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
T const& get ( value_initialized<T> const& x )
|
T const& get ( value_initialized<T> const& x )
|
||||||
{
|
{
|
||||||
|
43
ref_test.cpp
43
ref_test.cpp
@@ -68,54 +68,11 @@ struct ref_wrapper
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct copy_counter {
|
|
||||||
static int count_;
|
|
||||||
copy_counter(copy_counter const& /*other*/) {
|
|
||||||
++count_;
|
|
||||||
}
|
|
||||||
copy_counter() {}
|
|
||||||
static void reset() { count_ = 0; }
|
|
||||||
static int count() { return copy_counter::count_; }
|
|
||||||
};
|
|
||||||
|
|
||||||
int copy_counter::count_ = 0;
|
|
||||||
|
|
||||||
} // namespace unnamed
|
} // namespace unnamed
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void do_unwrap(T t) {
|
|
||||||
|
|
||||||
/* typename unwrap_reference<T>::type& lt = */
|
|
||||||
unwrap_ref(t);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void unwrap_test() {
|
|
||||||
|
|
||||||
int i = 3;
|
|
||||||
const int ci = 2;
|
|
||||||
|
|
||||||
do_unwrap(i);
|
|
||||||
do_unwrap(ci);
|
|
||||||
do_unwrap(ref(i));
|
|
||||||
do_unwrap(cref(ci));
|
|
||||||
do_unwrap(ref(ci));
|
|
||||||
|
|
||||||
copy_counter cc;
|
|
||||||
BOOST_CHECK(cc.count() == 0);
|
|
||||||
|
|
||||||
do_unwrap(cc);
|
|
||||||
do_unwrap(ref(cc));
|
|
||||||
do_unwrap(cref(cc));
|
|
||||||
|
|
||||||
BOOST_CHECK(cc.count() == 1);
|
|
||||||
BOOST_CHECK(unwrap_ref(ref(cc)).count() == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int test_main(int, char * [])
|
int test_main(int, char * [])
|
||||||
{
|
{
|
||||||
ref_wrapper<int>::test(1);
|
ref_wrapper<int>::test(1);
|
||||||
ref_wrapper<int const>::test(1);
|
ref_wrapper<int const>::test(1);
|
||||||
unwrap_test();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2008 - 2010 Joseph Gauterin, Niels Dekker
|
// Copyright (c) 2008 Joseph Gauterin, Niels Dekker
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@@ -17,8 +17,8 @@
|
|||||||
int test_main(int, char*[])
|
int test_main(int, char*[])
|
||||||
{
|
{
|
||||||
typedef std::bitset<8> bitset_type;
|
typedef std::bitset<8> bitset_type;
|
||||||
const bitset_type initial_value1 = 1;
|
const bitset_type initial_value1 = 1ul;
|
||||||
const bitset_type initial_value2 = 2;
|
const bitset_type initial_value2 = 2ul;
|
||||||
|
|
||||||
bitset_type object1 = initial_value1;
|
bitset_type object1 = initial_value1;
|
||||||
bitset_type object2 = initial_value2;
|
bitset_type object2 = initial_value2;
|
||||||
|
@@ -29,9 +29,9 @@
|
|||||||
//
|
//
|
||||||
struct POD
|
struct POD
|
||||||
{
|
{
|
||||||
POD () : f(0), c(0), i(0){}
|
POD () : c(0), i(0), f(0) {}
|
||||||
|
|
||||||
POD ( char c_, int i_, float f_ ) : f(f_), c(c_), i(i_) {}
|
POD ( char c_, int i_, float f_ ) : c(c_), i(i_), f(f_) {}
|
||||||
|
|
||||||
friend std::ostream& operator << ( std::ostream& os, POD const& pod )
|
friend std::ostream& operator << ( std::ostream& os, POD const& pod )
|
||||||
{ return os << '(' << pod.c << ',' << pod.i << ',' << pod.f << ')' ; }
|
{ return os << '(' << pod.c << ',' << pod.i << ',' << pod.f << ')' ; }
|
||||||
@@ -291,7 +291,7 @@ int test_main(int, char **)
|
|||||||
{
|
{
|
||||||
BOOST_CHECK ( test( 0,1234 ) ) ;
|
BOOST_CHECK ( test( 0,1234 ) ) ;
|
||||||
BOOST_CHECK ( test( 0.0,12.34 ) ) ;
|
BOOST_CHECK ( test( 0.0,12.34 ) ) ;
|
||||||
BOOST_CHECK ( test( POD(0,0,0.0), POD('a',1234,56.78f) ) ) ;
|
BOOST_CHECK ( test( POD(0,0,0.0), POD('a',1234,56.78) ) ) ;
|
||||||
BOOST_CHECK ( test( NonPOD( std::string() ), NonPOD( std::string("something") ) ) ) ;
|
BOOST_CHECK ( test( NonPOD( std::string() ), NonPOD( std::string("something") ) ) ) ;
|
||||||
|
|
||||||
NonPOD NonPOD_object( std::string("NonPOD_object") );
|
NonPOD NonPOD_object( std::string("NonPOD_object") );
|
||||||
|
Reference in New Issue
Block a user