2
0
mirror of https://github.com/boostorg/lambda.git synced 2026-01-21 04:52:25 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Marshall Clow
522d95581e Release 1.52.0
[SVN r81201]
2012-11-05 15:31:58 +00:00
Steven Watanabe
3caa685662 Merge [67640] from the trunk.
[SVN r70065]
2011-03-17 16:29:28 +00:00
4 changed files with 29 additions and 5 deletions

0
doc/detail/lambda_doc.xml Executable file → Normal file
View File

View File

@@ -16,6 +16,9 @@
#include "boost/tuple/tuple.hpp"
#include "boost/type_traits/same_traits.hpp"
#include "boost/type_traits/remove_reference.hpp"
#include "boost/type_traits/remove_cv.hpp"
#include "boost/type_traits/add_const.hpp"
#include "boost/type_traits/add_volatile.hpp"
#include "boost/utility/result_of.hpp"
namespace boost {
@@ -237,22 +240,26 @@ struct function_adaptor<T Object::*> {
// the data member is accessed is const, and finally adding a reference
template<class Args> class sig {
typedef typename boost::tuples::element<1, Args>::type argument_type;
typedef typename boost::remove_reference<
argument_type
>::type unref_type;
typedef typename detail::IF<boost::is_const<argument_type>::value,
typedef typename detail::IF<boost::is_const<unref_type>::value,
typename boost::add_const<T>::type,
T
>::RET properly_consted_return_type;
typedef typename detail::IF<
boost::is_volatile<properly_consted_return_type>::value,
typedef typename detail::IF<boost::is_volatile<unref_type>::value,
typename boost::add_volatile<properly_consted_return_type>::type,
properly_consted_return_type
>::RET properly_cvd_return_type;
public:
typedef typename
boost::add_reference<properly_cvd_return_type>::type type;
typedef typename detail::IF<boost::is_reference<argument_type>::value,
typename boost::add_reference<properly_cvd_return_type>::type,
typename boost::remove_cv<T>::type
>::RET type;
};
template <class RET>

0
test/Makefile Executable file → Normal file
View File

View File

@@ -80,6 +80,23 @@ void test_member_functions()
// bind(&A::add, a, _1);
}
struct B {
B(int n) : i(n) {};
int i;
};
void test_data_members()
{
using boost::ref;
B b(10);
BOOST_CHECK(bind(&B::i, ref(b))() == 10);
BOOST_CHECK(bind(&B::i, b)() == 10);
BOOST_CHECK(bind(&B::i, _1)(b) == 10);
BOOST_CHECK(bind(&B::i, _1)(B(11)) == 11);
bind(&B::i, ref(b))() = 1;
BOOST_CHECK(b.i == 1);
}
int test_main(int, char *[]) {
int i = 1; int j = 2; int k = 3;