mirror of
https://github.com/boostorg/typeof.git
synced 2025-11-17 16:09:27 +01:00
33 lines
469 B
C++
33 lines
469 B
C++
|
|
#include "test.hpp"
|
||
|
|
#include <boost/noncopyable.hpp>
|
||
|
|
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||
|
|
|
||
|
|
struct x : boost::noncopyable
|
||
|
|
{
|
||
|
|
void foo() {}
|
||
|
|
void bar() const {}
|
||
|
|
};
|
||
|
|
|
||
|
|
BOOST_TYPEOF_REGISTER_TYPE(x)
|
||
|
|
|
||
|
|
x& make_ref()
|
||
|
|
{
|
||
|
|
static x result;
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
const x& make_const_ref()
|
||
|
|
{
|
||
|
|
static x result;
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
void foo()
|
||
|
|
{
|
||
|
|
BOOST_AUTO(& v1, make_ref());
|
||
|
|
v1.foo();
|
||
|
|
|
||
|
|
BOOST_AUTO(const& v2, make_const_ref());
|
||
|
|
v2.bar();
|
||
|
|
}
|