Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Member Qualifier Features

add_member_const
remove_member_const
add_member_volatile
remove_member_volatile
add_member_cv
remove_member_cv
add_member_lvalue_reference
add_member_rvalue_reference
remove_member_reference
has_member_qualifiers
is_const_member
is_volatile_member
is_cv_member
is_lvalue_reference_member
is_rvalue_reference_member
is_reference_member
Header
#include <boost/callable_traits/add_member_const.hpp>
Definition
template<typename T>
using add_member_const_t = //see below

template<typename T>
struct add_member_const {
    using type = add_member_const_t<T>;
};
Constraints
  • T must be a function type or a member function pointer type
Behavior
  • A substitution failure occurs if the constraints are violated.
  • Adds a member const qualifier to T, if not already present.
Compatibility Notes

A substitution failure occurs on GCC builds older than version 4.9.2 with function types, because those versions did not support abominable function types. Full support on GCC 4.9.2+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

add_member_const_t<T>

int()

int() const

int(foo::*)()

int(foo::*)() const

int(foo::*)() &

int(foo::*)() const &

int(foo::*)() &&

int(foo::*)() const &&

int(foo::*)() const

int(foo::*)() const

int(foo::*)() volatile

int(foo::*)() const volatile

int(foo::*)() transaction_safe

int(foo::*)() const transaction_safe

int

(substitution failure)

int (&)()

(substitution failure)

int (*)()

(substitution failure)

int foo::*

(substitution failure)

int (foo::* const)()

(substitution failure)

Example Program
#include <type_traits>
#include <boost/callable_traits/add_member_const.hpp>

namespace ct = boost::callable_traits;

struct foo {};

int main() {

    {
        using pmf = int(foo::*)();
        using expect = int(foo::*)() const;
        using test = ct::add_member_const_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        // add_member_const_t doesn't change anything when
        // the function type is already const.
        using pmf = int(foo::*)() const &&;
        using expect = int(foo::*)() const &&;
        using test = ct::add_member_const_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        using pmf = int(foo::*)() volatile &;
        using expect = int(foo::*)() const volatile &;
        using test = ct::add_member_const_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        // add_member_const_t can also be used with "abominable"
        // function types.
        using f = int();
        using expect = int() const;
        using test = ct::add_member_const_t<f>;
        static_assert(std::is_same<test, expect>::value, "");
    }
}
Header
#include <boost/callable_traits/remove_member_const.hpp>
Definition
template<typename T>
using remove_member_const_t = //see below

template<typename T>
struct remove_member_const {
    using type = remove_member_const_t<T>;
};
Constraints
  • T must be a function type or a member function pointer type
Behavior
  • A substitution failure occurs if the constraints are violated.
  • Removes the member const qualifier from T, if present.
Compatibility Notes

Full support on GCC 4.7.4+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

remove_member_const_t<T>

int() const

int()

int(foo::*)() const

int(foo::*)()

int(foo::*)() const &

int(foo::*)() &

int(foo::*)() const &&

int(foo::*)() &&

int(foo::*)() const

int(foo::*)()

int(foo::*)() const volatile

int(foo::*)() volatile

int

(substitution failure)

int (&)()

(substitution failure)

int (*)()

(substitution failure)

int foo::*

(substitution failure)

int (foo::* const)()

(substitution failure)

Example Program
#include <type_traits>
#include <boost/callable_traits/remove_member_const.hpp>

namespace ct = boost::callable_traits;

struct foo {};

int main() {

    {
        using pmf = int(foo::*)() const;
        using expect = int(foo::*)();
        using test = ct::remove_member_const_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        using pmf = int(foo::*)() const &&;
        using expect = int(foo::*)() &&;
        using test = ct::remove_member_const_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        using pmf = int(foo::*)() const volatile &;
        using expect = int(foo::*)() volatile &;
        using test = ct::remove_member_const_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        using f = int() const;
        using expect = int();
        using test = ct::remove_member_const_t<f>;
        static_assert(std::is_same<test, expect>::value, "");
    }
}
Header
#include <boost/callable_traits/add_member_volatile.hpp>
Definition
template<typename T>
using add_member_volatile_t = //see below

template<typename T>
struct add_member_volatile {
    using type = add_member_volatile_t<T>;
};
Constraints
  • T must be a function type or a member function pointer type
Behavior
  • A substitution failure occurs if the constraints are violated.
  • Adds a member volatile qualifier to T, if not already present.
Compatibility Notes

A substitution failure occurs on GCC builds older than version 4.9.2 with function types, because those versions did not support abominable function types. Full support on GCC 4.9.2+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

add_member_volatile_t<T>

int()

int() volatile

int(foo::*)()

int(foo::*)() volatile

int(foo::*)() &

int(foo::*)() volatile &

int(foo::*)() &&

int(foo::*)() volatile &&

int(foo::*)() const

int(foo::*)() const volatile

int(foo::*)() transaction_safe

int(foo::*)() volatile transaction_safe

int

(substitution failure)

int (&)()

(substitution failure)

int (*)()

(substitution failure)

int foo::*

(substitution failure)

int (foo::* const)()

(substitution failure)

Example Program
#include <type_traits>
#include <boost/callable_traits/add_member_volatile.hpp>

namespace ct = boost::callable_traits;

struct foo {};

int main() {

    {
        using pmf = void(foo::*)();
        using expect = void(foo::*)() volatile;
        using test = ct::add_member_volatile_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        // add_member_volatile_t doesn't change anything when
        // the function type is already volatile.
        using pmf = void(foo::*)() volatile &&;
        using expect = void(foo::*)() volatile &&;
        using test = ct::add_member_volatile_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        using pmf = void(foo::*)() const &;
        using expect = void(foo::*)() const volatile &;
        using test = ct::add_member_volatile_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        // add_member_volatile_t can also be used with "abominable"
        // function types.
        using f = void();
        using expect = void() volatile;
        using test = ct::add_member_volatile_t<f>;
        static_assert(std::is_same<test, expect>::value, "");
    }
}
Header
#include <boost/callable_traits/remove_member_volatile.hpp>
Definition
template<typename T>
using remove_member_volatile_t = //see below

template<typename T>
struct remove_member_volatile {
    using type = remove_member_volatile_t<T>;
};
Constraints
  • T must be a function type or a member function pointer type
Behavior
  • A substitution failure occurs if the constraints are violated.
  • Removes the member volatile qualifier from T, if present.
Compatibility Notes

Full support on GCC 4.7.4+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

remove_member_volatile_t<T>

int() volatile

int()

int(foo::*)() volatile

int(foo::*)()

int(foo::*)() volatile &

int(foo::*)() &

int(foo::*)() volatile &&

int(foo::*)() &&

int(foo::*)() volatile

int(foo::*)()

int(foo::*)() const volatile

int(foo::*)() const

int

(substitution failure)

int (&)()

(substitution failure)

int (*)()

(substitution failure)

int foo::*

(substitution failure)

int (foo::* const)()

(substitution failure)

Example Program
#include <type_traits>
#include <boost/callable_traits/remove_member_volatile.hpp>

namespace ct = boost::callable_traits;

struct foo {};

int main() {

    {
        using pmf = int(foo::*)() const volatile;
        using expect = int(foo::*)() const;
        using test = ct::remove_member_volatile_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        using pmf = int(foo::*)() volatile &&;
        using expect = int(foo::*)() &&;
        using test = ct::remove_member_volatile_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        using pmf = int(foo::*)() volatile &;
        using expect = int(foo::*)() &;
        using test = ct::remove_member_volatile_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        using f = int() const volatile;
        using expect = int() const;
        using test = ct::remove_member_volatile_t<f>;
        static_assert(std::is_same<test, expect>::value, "");
    }
}
Header
#include <boost/callable_traits/add_member_cv.hpp>
Definition
template<typename T>
using add_member_cv_t = //see below

template<typename T>
struct add_member_cv {
    using type = add_member_cv_t<T>;
};
Constraints
  • T must be a function type or a member function pointer type
Behavior
  • A substitution failure occurs if the constraints are violated.
  • Adds member const and volatile qualifiers to T, if not already present.
Compatibility Notes

A substitution failure occurs on GCC builds older than version 4.9.2 with function types, because those versions did not support abominable function types. Full support on GCC 4.9.2+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

add_member_cv_t<T>

int()

int() const volatile

int(foo::*)()

int(foo::*)() const volatile

int(foo::*)() &

int(foo::*)() const volatile &

int(foo::*)() &&

int(foo::*)() const volatile &&

int(foo::*)() const

int(foo::*)() const volatile

int(foo::*)() volatile

int(foo::*)() const volatile

int(foo::*)() transaction_safe

int(foo::*)() const volatile transaction_safe

int

(substitution failure)

int (&)()

(substitution failure)

int (*)()

(substitution failure)

int foo::*

(substitution failure)

int (foo::* const)()

(substitution failure)

Example Program
#include <type_traits>
#include <boost/callable_traits/add_member_cv.hpp>

namespace ct = boost::callable_traits;

struct foo {};

int main() {

    {
        using pmf = void(foo::*)();
        using expect = void(foo::*)() const volatile;
        using test = ct::add_member_cv_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        // add_member_cv_t doesn't change anything when
        // the function type is already cv-qualified.
        using pmf = void(foo::*)() const volatile &&;
        using expect = void(foo::*)() const volatile &&;
        using test = ct::add_member_cv_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        using pmf = void(foo::*)() volatile &;
        using expect = void(foo::*)() const volatile &;
        using test = ct::add_member_cv_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        // add_member_cv_t can also be used with "abominable"
        // function types.
        using f = void();
        using expect = void() const volatile;
        using test = ct::add_member_cv_t<f>;
        static_assert(std::is_same<test, expect>::value, "");
    }
}
Header
#include <boost/callable_traits/remove_member_cv.hpp>
Definition
template<typename T>
using remove_member_cv_t = //see below

template<typename T>
struct remove_member_cv {
    using type = remove_member_cv_t<T>;
};
Constraints
  • T must be a function type or a member function pointer type
Behavior
  • A substitution failure occurs if the constraints are violated.
  • Removes member const and/or volatile qualifiers from T, if present.
Compatibility Notes

Full support on GCC 4.7.4+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

remove_member_cv_t<T>

int() const volatile

int()

int(foo::*)() const volatile

int(foo::*)()

int(foo::*)() volatile

int(foo::*)()

int(foo::*)() const

int(foo::*)()

int(foo::*)() const &

int(foo::*)() &

int(foo::*)() const &&

int(foo::*)() &&

int(foo::*)() const

int(foo::*)()

int

(substitution failure)

int (&)()

(substitution failure)

int (*)()

(substitution failure)

int foo::*

(substitution failure)

int (foo::* const)()

(substitution failure)

Example Program
#include <type_traits>
#include <boost/callable_traits/remove_member_cv.hpp>

namespace ct = boost::callable_traits;

struct foo {};

int main() {

    {
        using pmf = int(foo::*)() const volatile;
        using expect = int(foo::*)();
        using test = ct::remove_member_cv_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        using pmf = int(foo::*)() const &&;
        using expect = int(foo::*)() &&;
        using test = ct::remove_member_cv_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        using pmf = int(foo::*)() const volatile &;
        using expect = int(foo::*)() &;
        using test = ct::remove_member_cv_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        using f = int() const volatile;
        using expect = int();
        using test = ct::remove_member_cv_t<f>;
        static_assert(std::is_same<test, expect>::value, "");
    }
}
Header
#include <boost/callable_traits/add_member_lvalue_reference.hpp>
Definition
#ifdef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS

template<typename T>
struct add_member_lvalue_reference_t {
    static_assert(std::is_same<T, detail::dummy>::value,
        "Reference member qualifiers are not supported by this configuration.");
};

#else

template<typename T>
using add_member_lvalue_reference_t = //see below

#endif // #ifdef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS

template<typename T>
struct add_member_lvalue_reference {
    using type = add_member_lvalue_reference_t<T>;
};
Constraints
  • T must be a function type or a member function pointer type
Behavior
  • A substitution failure occurs if the constraints are violated.
  • Adds a member lvalue reference qualifier (&) to T, if not already present.
  • If an rvalue reference qualifier is present, the lvalue reference qualifier replaces it (in accordance with reference collapsing rules).
Compatibility Notes

A static_assert always fails on GCC builds older than version 4.9.2, because those versions did not support reference member qualifiers. Full support on GCC 4.9.2+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

add_member_lvalue_reference_t<T>

int()

int() &

int(foo::*)()

int(foo::*)() &

int(foo::*)() &

int(foo::*)() &

int(foo::*)() &&

int(foo::*)() &

int(foo::*)() const

int(foo::*)() const &

int(foo::*)() transaction_safe

int(foo::*)() & transaction_safe

int

(substitution failure)

int (&)()

(substitution failure)

int (*)()

(substitution failure)

int foo::*

(substitution failure)

int (foo::* const)()

(substitution failure)

Example Program
#include <type_traits>
#include <boost/callable_traits/add_member_lvalue_reference.hpp>

namespace ct = boost::callable_traits;

struct foo {};

int main() {

    {
        using pmf = void(foo::*)();
        using expect = void(foo::*)() &;
        using test = ct::add_member_lvalue_reference_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        // add_member_lvalue_reference_t doesn't change anything when
        // the function type already has an lvalue qualifier.
        using pmf = void(foo::*)() &;
        using expect = void(foo::*)() &;
        using test = ct::add_member_lvalue_reference_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        // add_member_lvalue_reference_t models C++11 reference collapsing
        // rules, so that adding an lvalue qualifier to an
        // rvalue-qualified type will force the lvalue.
        using pmf = void(foo::*)() &&;
        using expect = void(foo::*)() &;
        using test = ct::add_member_lvalue_reference_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        // add_member_lvalue_reference_t can also be used to create "abominable"
        // function types.
        using f = void();
        using expect = void() &;
        using test = ct::add_member_lvalue_reference_t<f>;
        static_assert(std::is_same<test, expect>::value, "");
    }
}
Header
#include <boost/callable_traits/add_member_rvalue_reference.hpp>
Definition
#ifdef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS

template<typename T>
struct add_member_rvalue_reference_t {
    static_assert(std::is_same<T, detail::dummy>::value,
        "Reference member qualifiers are not supported by this configuration.");
};

#else

template<typename T>
using add_member_rvalue_reference_t = //see below

#endif // #ifdef BOOST_CLBL_TRTS_DISABLE_REFERENCE_QUALIFIERS

template<typename T>
struct add_member_rvalue_reference {
    using type = add_member_rvalue_reference_t<T>;
};
Constraints
  • T must be a function type or a member function pointer type
Behavior
  • A substitution failure occurs if the constraints are violated.
  • Adds a member rvalue reference qualifier (&&) to T, if not already present.
  • If an lvalue reference qualifier is present, the lvalue reference qualifier remains (in accordance with reference collapsing rules).
Compatibility Notes

A static_assert always fails on GCC builds older than version 4.9.2, because those versions did not support reference member qualifiers. Full support on GCC 4.9.2+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

add_member_rvalue_reference_t<T>

int()

int() &&

int(foo::*)()

int(foo::*)() &&

int(foo::*)() &

int(foo::*)() &

int(foo::*)() &&

int(foo::*)() &&

int(foo::*)() const

int(foo::*)() const &&

int(foo::*)() transaction_safe

int(foo::*)() && transaction_safe

int

(substitution failure)

int (&)()

(substitution failure)

int (*)()

(substitution failure)

int foo::*

(substitution failure)

int (foo::* const)()

(substitution failure)

Example Program
#include <type_traits>
#include <boost/callable_traits/add_member_rvalue_reference.hpp>

namespace ct = boost::callable_traits;

struct foo {};

int main() {

    {
        using pmf = void(foo::*)();
        using expect = void(foo::*)() &&;
        using test = ct::add_member_rvalue_reference_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        // add_member_rvalue_reference_t doesn't change anything when
        // the function type already has an rvalue qualifier.
        using pmf = void(foo::*)() &&;
        using expect = void(foo::*)() &&;
        using test = ct::add_member_rvalue_reference_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        // add_member_rvalue_reference_t models C++11 reference collapsing
        // rules, so that adding an rvalue qualifier to an
        // lvalue-qualified type will not change anything.
        using pmf = void(foo::*)() const &;
        using expect = void(foo::*)() const &;
        using test = ct::add_member_rvalue_reference_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        // add_member_rvalue_reference_t can also be used with "abominable"
        // function types.
        using f = void() const;
        using expect = void() const &&;
        using test = ct::add_member_rvalue_reference_t<f>;
        static_assert(std::is_same<test, expect>::value, "");
    }
}
Header
#include <boost/callable_traits/remove_member_reference.hpp>
Definition
template<typename T>
using remove_member_reference_t = //see below

template<typename T>
struct remove_member_reference {
    using type = remove_member_reference_t<T>;
};
Constraints
  • T must be a function type or a member function pointer type
Behavior
  • A substitution failure occuers if the constraints are violated.
  • Removes member & or && qualifiers from T, if present.
Compatibility Notes

Full support on GCC 4.7.4+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

remove_member_const_t<T>

int() &

int()

int(foo::*)() &

int(foo::*)()

int(foo::*)() const &

int(foo::*)() const

int(foo::*)() const &&

int(foo::*)() const

int(foo::*)()

int(foo::*)()

int

(substitution failure)

int (&)()

(substitution failure)

int (*)()

(substitution failure)

int foo::*

(substitution failure)

int (foo::* const)()

(substitution failure)

Example Program
#include <type_traits>
#include <boost/callable_traits/remove_member_reference.hpp>

namespace ct = boost::callable_traits;

struct foo {};

int main() {

    {
        using pmf = int(foo::*)() &;
        using expect = int(foo::*)();
        using test = ct::remove_member_reference_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        using pmf = int(foo::*)() const &&;
        using expect = int(foo::*)() const;
        using test = ct::remove_member_reference_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        using pmf = int(foo::*)() const volatile &;
        using expect = int(foo::*)() const volatile;
        using test = ct::remove_member_reference_t<pmf>;
        static_assert(std::is_same<test, expect>::value, "");
    } {
        using f = int() &&;
        using expect = int();
        using test = ct::remove_member_reference_t<f>;
        static_assert(std::is_same<test, expect>::value, "");
    }
}
Header
#include <boost/callable_traits/has_member_qualifiers.hpp>
Definition
template<typename T>
struct has_member_qualifiers; //immplementation-defined

template<typename T>
constexpr bool has_member_qualifiers_v = //see below
Constraints
  • none
Behavior
  • std::false_type is inherited by has_member_qualifiers<T> and is aliased by typename has_member_qualifiers<T>::type, except when one of the following criteria is met, in which case std::true_type would be similarly inherited and aliased:
    • T is a function with member qualifiers
    • T is a member function pointer with member qualifiers
    • T is a function object with a member-qualified operator()
  • On compilers that support variable templates, has_member_qualifiers_v<T> is equivalent to has_member_qualifiers<T>::value.
Compatibility Notes

Full support on GCC 4.7.4+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

has_member_qualifiers_v<T>

void() const

true

void() const transaction_safe

true

void() volatile &&

true

int(foo::*)() &

true

void(foo::*)() const

true

void(foo::*&)() const

false

void(foo::* const)() const

false

void()

false

void() transaction_safe

false

void(*)()

false

void(*&)()

false

int

false

const int

false

int foo::*

false

const int foo::*

false

Example Program
#include <type_traits>
#include <boost/callable_traits/has_member_qualifiers.hpp>

namespace ct = boost::callable_traits;

struct foo;

static_assert(ct::has_member_qualifiers<int(foo::*)() const>::value, "");
static_assert(ct::has_member_qualifiers<int(foo::*)() volatile>::value, "");
static_assert(!ct::has_member_qualifiers<int(foo::*)()>::value, "");

int main() {}
Header
#include <boost/callable_traits/is_const_member.hpp>
Definition
template<typename T>
struct is_const_member; //see below


#ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES

template<typename T>
struct is_const_member_v {
    static_assert(std::is_same<T, detail::dummy>::value,
        "Variable templates not supported on this compiler.");
};

#else

template<typename T>
constexpr bool is_const_member_v = //see below
#endif
Constraints
  • none
Behavior
  • std::false_type is inherited by is_const_member<T> and is aliased by typename is_const_member<T>::type, except when one of the following criteria is met, in which case std::true_type would be similarly inherited and aliased:
    • T is a function type with a const member qualifier
    • T is a pointer to a member function with a const member qualifier
    • T is a function object with a non-overloaded operator(), where the operator() has a const member qualifier
  • On compilers that support variable templates, is_const_member_v<T> is equivalent to is_const_member<T>::value.
Compatibility Notes

Full support on GCC 4.7.4+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

is_const_member_v<T>

int() const

true

int() const volatile

true

int() const & transaction_safe

true

int() const &&

true

int(foo::*)() const

true

int(foo::*)() const volatile

true

int(foo::*)() const volatile &&

true

int()

false

int() volatile

false

int() &&

false

int(*)()

false

int(foo::* const)() const

false

int

false

int foo::*

false

const int foo::*

false

Example Program
#include <type_traits>
#include <boost/callable_traits/is_const_member.hpp>

namespace ct = boost::callable_traits;

struct foo;

static_assert(ct::is_const_member<int(foo::*)() const>::value, "");
static_assert(!ct::is_const_member<int(foo::*)()>::value, "");

int main() {}
Header
#include <boost/callable_traits/is_volatile_member.hpp>
Definition
template<typename T>
struct is_volatile_member; //see below


#ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES

template<typename T>
struct is_volatile_member_v {
    static_assert(std::is_same<T, detail::dummy>::value,
        "Variable templates not supported on this compiler.");
};

#else

template<typename T>
constexpr bool is_volatile_member_v = //see below

#endif
Constraints
  • none
Behavior
  • std::false_type is inherited by is_volatile_member<T> and is aliased by typename is_volatile_member<T>::type, except when one of the following criteria is met, in which case std::true_type would be similarly inherited and aliased:
    • T is a function type with a volatile member qualifier
    • T is a pointer to a member function with a volatile member qualifier
    • T is a function object with a non-overloaded operator(), where the operator() has a volatile member qualifier
  • On compilers that support variable templates, is_volatile_member_v<T> is equivalent to is_volatile_member<T>::value.
Compatibility Notes

Full support on GCC 4.7.4+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

is_volatile_member_v<T>

int() volatile

true

int() const volatile

true

int() volatile &&

true

int(foo::*)() volatile

true

int(foo::*)() const volatile

true

int(foo::*)() const volatile &&

true

int()

false

int() const

false

int() &&

false

int(*)()

false

int(foo::* const)() volatile

false

int

false

int foo::*

false

volatile int foo::*

false

Example Program
#include <type_traits>
#include <boost/callable_traits/is_volatile_member.hpp>

namespace ct = boost::callable_traits;

static_assert(ct::is_volatile_member<int() volatile>::value, "");
static_assert(ct::is_volatile_member<int() const volatile>::value, "");
static_assert(!ct::is_volatile_member<int()>::value, "");

struct foo;

static_assert(ct::is_volatile_member<int(foo::*)() volatile>::value, "");
static_assert(!ct::is_volatile_member<int(foo::*)() const>::value, "");
static_assert(!ct::is_volatile_member<int(foo::*)()>::value, "");

int main() {}
Header
#include <boost/callable_traits/is_cv_member.hpp>
Definition
template<typename T>
struct is_cv_member; //see below


#ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES

template<typename T>
struct is_cv_member_v {
    static_assert(std::is_same<T, detail::dummy>::value,
        "Variable templates not supported on this compiler.");
};

#else

template<typename T>
constexpr bool is_cv_member_v = //see below

#endif
Constraints
  • none
Behavior
  • std::false_type is inherited by is_cv_member<T> and is aliased by typename is_cv_member<T>::type, except when one of the following criteria is met, in which case std::true_type would be similarly inherited and aliased:
    • T is a function type with both const and volatile member qualifiers
    • T is a pointer to a member function with both const and volatile member qualifiers
    • T is a function object with a non-overloaded operator(), where the operator() has both const and volatile member qualifiers
  • On compilers that support variable templates, is_cv_member_v<T> is equivalent to is_cv_member<T>::value.
Compatibility Notes

Full support on GCC 4.7.4+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

is_cv_member_v<T>

int() const volatile

true

int() const volatile &

true

int(foo::*)() const volatile

true

int() const

false

int() volatile

false

int(foo::*)() const

false

int() const

false

int() volatile

false

int() &&

false

int(*)()

false

int

false

int foo::*

false

const int foo::*

false

Example Program
#include <type_traits>
#include <boost/callable_traits/is_cv_member.hpp>

namespace ct = boost::callable_traits;

struct foo;

static_assert(ct::is_cv_member<int(foo::*)() const volatile>::value, "");
static_assert(!ct::is_cv_member<int(foo::*)()>::value, "");
static_assert(!ct::is_cv_member<int(foo::*)() const>::value, "");
static_assert(!ct::is_cv_member<int(foo::*)() volatile>::value, "");

int main() {}
Header
#include <boost/callable_traits/is_lvalue_reference_member.hpp>
Definition
template<typename T>
struct is_lvalue_reference_member; //see below


#ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES

template<typename T>
struct is_lvalue_reference_member_v {
    static_assert(std::is_same<T, detail::dummy>::value,
        "Variable templates not supported on this compiler.");
};

#else

template<typename T>
constexpr bool is_lvalue_reference_member_v = //see below
#endif
Constraints
  • none
Behavior
  • std::false_type is inherited by is_lvalue_reference_member<T> and is aliased by typename is_lvalue_reference_member<T>::type, except when one of the following criteria is met, in which case std::true_type would be similarly inherited and aliased:
    • T is a function type with a '&' member qualifier
    • T is a pointer to a member function with a '&' member qualifiers
    • T is a function object with a non-overloaded operator(), where the operator() has a '&' member qualifier
  • On compilers that support variable templates, is_lvalue_reference_member_v<T> is equivalent to is_lvalue_reference_member<T>::value.
Compatibility Notes

Full support on GCC 4.9.2+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

is_lvalue_reference_member_v<T>

int() &

true

int(foo::*)() const &

true

int() const

false

int() volatile

false

int(foo::*)() const

false

int() const

false

int() volatile

false

int() &&

false

int(*)()

false

int

false

int foo::*

false

const int foo::*

false

Example Program
#include <type_traits>
#include <boost/callable_traits/is_lvalue_reference_member.hpp>

namespace ct = boost::callable_traits;

static_assert(ct::is_lvalue_reference_member<int()&>::value, "");
static_assert(!ct::is_lvalue_reference_member<int()&&>::value, "");
static_assert(!ct::is_lvalue_reference_member<int()>::value, "");

struct foo;

static_assert(ct::is_lvalue_reference_member<int(foo::*)()&>::value, "");
static_assert(!ct::is_lvalue_reference_member<int(foo::*)()&&>::value, "");
static_assert(!ct::is_lvalue_reference_member<int(foo::*)()>::value, "");

int main() {}
Header
#include <boost/callable_traits/is_rvalue_reference_member.hpp>
Definition
template<typename T>
struct is_rvalue_reference_member; //see below


#ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES

template<typename T>
struct is_rvalue_reference_member_v {
    static_assert(std::is_same<T, detail::dummy>::value,
        "Variable templates not supported on this compiler.");
};

#else

template<typename T>
constexpr bool is_rvalue_reference_member_v = //see below

#endif
Constraints
  • none
Behavior
  • std::false_type is inherited by is_rvalue_reference_member<T> and is aliased by typename is_rvalue_reference_member<T>::type, except when one of the following criteria is met, in which case std::true_type would be similarly inherited and aliased:
    • T is a function type with a '&&' member qualifier
    • T is a pointer to a member function with a '&&' member qualifiers
    • T is a function object with a non-overloaded operator(), where the operator() has a '&&' member qualifier
  • On compilers that support variable templates, is_rvalue_reference_member_v<T> is equivalent to is_rvalue_reference_member<T>::value.
Compatibility Notes

Full support on GCC 4.9.2+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

is_rvalue_reference_member_v<T>

int() const &&

true

int(foo::*)() &&

true

int() const

false

int() volatile

false

int(foo::*)() const

false

int() const

false

int() volatile

false

int() &

false

int(*)()

false

int

false

int foo::*

false

const int foo::*

false

Example Program
#include <type_traits>
#include <boost/callable_traits/is_rvalue_reference_member.hpp>

namespace ct = boost::callable_traits;

static_assert(ct::is_rvalue_reference_member<int()&&>::value, "");
static_assert(!ct::is_rvalue_reference_member<int()&>::value, "");
static_assert(!ct::is_rvalue_reference_member<int()>::value, "");

struct foo;

static_assert(ct::is_rvalue_reference_member<int(foo::*)()&&>::value, "");
static_assert(!ct::is_rvalue_reference_member<int(foo::*)()&>::value, "");
static_assert(!ct::is_rvalue_reference_member<int(foo::*)()>::value, "");

int main() {}
Header
#include <boost/callable_traits/is_reference_member.hpp>
Definition
template<typename T>
struct is_reference_member; //see below


#ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES

template<typename T>
struct is_reference_member_v {
    static_assert(std::is_same<T, detail::dummy>::value,
        "Variable templates not supported on this compiler.");
};

#else

template<typename T>
constexpr bool is_reference_member_v = //see below
#endif
Constraints
  • none
Behavior
  • std::false_type is inherited by is_reference_member<T> and is aliased by typename is_reference_member<T>::type, except when one of the following criteria is met, in which case std::true_type would be similarly inherited and aliased:
    • T is a function type with a '&' or '&&' member qualifier
    • T is a pointer to a member function with a '&' or '&&' member qualifiers
    • T is a function object with a non-overloaded operator(), where the operator() has a '&' or '&&' member qualifier
  • On compilers that support variable templates, is_reference_member_v<T> is equivalent to is_reference_member<T>::value.
Compatibility Notes

Full support on GCC 4.9.2+, Clang 3.5+, Visual Studio 2015, and XCode 6.4+.

Input/Output Examples

T

is_reference_member_v<T>

int() &

true

int() const &&

true

int(foo::*)() &&

true

int(foo::*)() volatile &

true

int() const

false

int() volatile

false

int(foo::*)() const

false

int() const

false

int() volatile

false

int(*)()

false

int

false

int foo::*

false

const int foo::*

false

Example Program
#include <type_traits>
#include <boost/callable_traits/is_reference_member.hpp>

namespace ct = boost::callable_traits;

static_assert(ct::is_reference_member<int()&>::value, "");
static_assert(ct::is_reference_member<int()&&>::value, "");
static_assert(!ct::is_reference_member<int()>::value, "");

struct foo;

static_assert(ct::is_reference_member<int(foo::*)()&>::value, "");
static_assert(ct::is_reference_member<int(foo::*)()&&>::value, "");
static_assert(!ct::is_reference_member<int(foo::*)()>::value, "");

int main() {}

PrevUpHomeNext