diff --git a/doc/has_bit_and.qbk b/doc/has_bit_and.qbk new file mode 100644 index 0000000..8aa5782 --- /dev/null +++ b/doc/has_bit_and.qbk @@ -0,0 +1,71 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_bit_and has_bit_and] + template + struct has_bit_and : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs&rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs&rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator&`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs&rhs); // is valid if has_bit_and::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_bit_and::value_type` is the type `bool`.] +[:`has_bit_and::value` is a `bool` integral constant expression.] +[:`has_bit_and::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_bit_and` inherits from `__true_type`.] + +[:`has_bit_and` inherits from `__true_type`.] +[:`has_bit_and` inherits from `__true_type`.] + +[:`has_bit_and` inherits from `__false_type`.] +[:`has_bit_and` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator&` is public or not: +if `operator&` is defined as a private member of `Lhs` then +instantiating `has_bit_and` will produce a compiler error. +For this reason `has_bit_and` cannot be used to determine whether a type has a public `operator&` or not. +`` +struct A { private: void operator&(const A&); }; +boost::has_bit_and::value; // error: A::operator&(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator&(const A&, const A&); +struct B { operator A(); }; +boost::has_bit_and::value; // this is fine +boost::has_bit_and::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_bit_and_assign.qbk b/doc/has_bit_and_assign.qbk new file mode 100644 index 0000000..59ff1e9 --- /dev/null +++ b/doc/has_bit_and_assign.qbk @@ -0,0 +1,71 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_bit_and_assign has_bit_and_assign] + template + struct has_bit_and_assign : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs&=rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs&=rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator&=`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs&=rhs); // is valid if has_bit_and_assign::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_bit_and_assign::value_type` is the type `bool`.] +[:`has_bit_and_assign::value` is a `bool` integral constant expression.] +[:`has_bit_and_assign::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_bit_and_assign` inherits from `__true_type`.] + +[:`has_bit_and_assign` inherits from `__true_type`.] + +[:`has_bit_and_assign` inherits from `__false_type`.] +[:`has_bit_and_assign` inherits from `__false_type`.] +[:`has_bit_and_assign` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator&=` is public or not: +if `operator&=` is defined as a private member of `Lhs` then +instantiating `has_bit_and_assign` will produce a compiler error. +For this reason `has_bit_and_assign` cannot be used to determine whether a type has a public `operator&=` or not. +`` +struct A { private: void operator&=(const A&); }; +boost::has_bit_and_assign::value; // error: A::operator&=(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator&=(const A&, const A&); +struct B { operator A(); }; +boost::has_bit_and_assign::value; // this is fine +boost::has_bit_and_assign::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_bit_or.qbk b/doc/has_bit_or.qbk new file mode 100644 index 0000000..d701cca --- /dev/null +++ b/doc/has_bit_or.qbk @@ -0,0 +1,71 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_bit_or has_bit_or] + template + struct has_bit_or : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs|rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs|rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator|`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs|rhs); // is valid if has_bit_or::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_bit_or::value_type` is the type `bool`.] +[:`has_bit_or::value` is a `bool` integral constant expression.] +[:`has_bit_or::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_bit_or` inherits from `__true_type`.] + +[:`has_bit_or` inherits from `__true_type`.] +[:`has_bit_or` inherits from `__true_type`.] + +[:`has_bit_or` inherits from `__false_type`.] +[:`has_bit_or` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator|` is public or not: +if `operator|` is defined as a private member of `Lhs` then +instantiating `has_bit_or` will produce a compiler error. +For this reason `has_bit_or` cannot be used to determine whether a type has a public `operator|` or not. +`` +struct A { private: void operator|(const A&); }; +boost::has_bit_or::value; // error: A::operator|(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator|(const A&, const A&); +struct B { operator A(); }; +boost::has_bit_or::value; // this is fine +boost::has_bit_or::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_bit_or_assign.qbk b/doc/has_bit_or_assign.qbk new file mode 100644 index 0000000..bde98da --- /dev/null +++ b/doc/has_bit_or_assign.qbk @@ -0,0 +1,71 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_bit_or_assign has_bit_or_assign] + template + struct has_bit_or_assign : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs|=rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs|=rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator|=`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs|=rhs); // is valid if has_bit_or_assign::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_bit_or_assign::value_type` is the type `bool`.] +[:`has_bit_or_assign::value` is a `bool` integral constant expression.] +[:`has_bit_or_assign::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_bit_or_assign` inherits from `__true_type`.] + +[:`has_bit_or_assign` inherits from `__true_type`.] + +[:`has_bit_or_assign` inherits from `__false_type`.] +[:`has_bit_or_assign` inherits from `__false_type`.] +[:`has_bit_or_assign` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator|=` is public or not: +if `operator|=` is defined as a private member of `Lhs` then +instantiating `has_bit_or_assign` will produce a compiler error. +For this reason `has_bit_or_assign` cannot be used to determine whether a type has a public `operator|=` or not. +`` +struct A { private: void operator|=(const A&); }; +boost::has_bit_or_assign::value; // error: A::operator|=(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator|=(const A&, const A&); +struct B { operator A(); }; +boost::has_bit_or_assign::value; // this is fine +boost::has_bit_or_assign::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_bit_xor.qbk b/doc/has_bit_xor.qbk new file mode 100644 index 0000000..e47af4c --- /dev/null +++ b/doc/has_bit_xor.qbk @@ -0,0 +1,71 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_bit_xor has_bit_xor] + template + struct has_bit_xor : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs^rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs^rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator^`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs^rhs); // is valid if has_bit_xor::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_bit_xor::value_type` is the type `bool`.] +[:`has_bit_xor::value` is a `bool` integral constant expression.] +[:`has_bit_xor::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_bit_xor` inherits from `__true_type`.] + +[:`has_bit_xor` inherits from `__true_type`.] +[:`has_bit_xor` inherits from `__true_type`.] + +[:`has_bit_xor` inherits from `__false_type`.] +[:`has_bit_xor` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator^` is public or not: +if `operator^` is defined as a private member of `Lhs` then +instantiating `has_bit_xor` will produce a compiler error. +For this reason `has_bit_xor` cannot be used to determine whether a type has a public `operator^` or not. +`` +struct A { private: void operator^(const A&); }; +boost::has_bit_xor::value; // error: A::operator^(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator^(const A&, const A&); +struct B { operator A(); }; +boost::has_bit_xor::value; // this is fine +boost::has_bit_xor::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_bit_xor_assign.qbk b/doc/has_bit_xor_assign.qbk new file mode 100644 index 0000000..ea4f0c9 --- /dev/null +++ b/doc/has_bit_xor_assign.qbk @@ -0,0 +1,71 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_bit_xor_assign has_bit_xor_assign] + template + struct has_bit_xor_assign : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs^=rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs^=rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator^=`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs^=rhs); // is valid if has_bit_xor_assign::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_bit_xor_assign::value_type` is the type `bool`.] +[:`has_bit_xor_assign::value` is a `bool` integral constant expression.] +[:`has_bit_xor_assign::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_bit_xor_assign` inherits from `__true_type`.] + +[:`has_bit_xor_assign` inherits from `__true_type`.] + +[:`has_bit_xor_assign` inherits from `__false_type`.] +[:`has_bit_xor_assign` inherits from `__false_type`.] +[:`has_bit_xor_assign` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator^=` is public or not: +if `operator^=` is defined as a private member of `Lhs` then +instantiating `has_bit_xor_assign` will produce a compiler error. +For this reason `has_bit_xor_assign` cannot be used to determine whether a type has a public `operator^=` or not. +`` +struct A { private: void operator^=(const A&); }; +boost::has_bit_xor_assign::value; // error: A::operator^=(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator^=(const A&, const A&); +struct B { operator A(); }; +boost::has_bit_xor_assign::value; // this is fine +boost::has_bit_xor_assign::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_complement.qbk b/doc/has_complement.qbk new file mode 100644 index 0000000..e43aec6 --- /dev/null +++ b/doc/has_complement.qbk @@ -0,0 +1,73 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_complement has_complement] + template + struct has_complement : public __tof {}; + +__inherit +If (i) `rhs` of type `Rhs` can be used in expression `~rhs`, +and (ii) `Ret=dont_care` or the result of expression `~rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of prefix `operator~`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Rhs rhs; +f(~rhs); // is valid if has_complement::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_complement::value_type` is the type `bool`.] +[:`has_complement::value` is a `bool` integral constant expression.] +[:`has_complement::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_complement` inherits from `__true_type`.] + +[:`has_complement` inherits from `__true_type`.] +[:`has_complement` inherits from `__true_type`.] +[:`has_complement` inherits from `__true_type`.] + +[:`has_complement` inherits from `__false_type`.] +[:`has_complement` inherits from `__false_type`.] +[:`has_complement` inherits from `__false_type`.] +[:`has_complement` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether prefix `operator~` is public or not: +if `operator~` is defined as a private member of `Rhs` then +instantiating `has_complement` will produce a compiler error. +For this reason `has_complement` cannot be used to determine whether a type has a public `operator~` or not. +`` +struct A { private: void operator~(); }; +boost::has_complement::value; // error: A::operator~() is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator~(const A&); +struct B { operator A(); }; +boost::has_complement::value; // this is fine +boost::has_complement::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_dereference.qbk b/doc/has_dereference.qbk new file mode 100644 index 0000000..30b20ac --- /dev/null +++ b/doc/has_dereference.qbk @@ -0,0 +1,76 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_dereference has_dereference] + template + struct has_dereference : public __tof {}; + +__inherit +If (i) `rhs` of type `Rhs` can be used in expression `*rhs`, +and (ii) `Ret=dont_care` or the result of expression `*rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of prefix `operator*`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Rhs rhs; +f(*rhs); // is valid if has_dereference::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_dereference::value_type` is the type `bool`.] +[:`has_dereference::value` is a `bool` integral constant expression.] +[:`has_dereference::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_dereference` inherits from `__true_type`.] + + +[:`has_dereference` inherits from `__true_type`.] +[:`has_dereference` inherits from `__true_type`.] +[:`has_dereference` inherits from `__true_type`.] +[:`has_dereference` inherits from `__true_type`.] +[:`has_dereference` inherits from `__true_type`.] + +[:`has_dereference` inherits from `__false_type`.] +[:`has_dereference` inherits from `__false_type`.] +[:`has_dereference` inherits from `__false_type`.] +[:`has_dereference` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether prefix `operator*` is public or not: +if `operator*` is defined as a private member of `Rhs` then +instantiating `has_dereference` will produce a compiler error. +For this reason `has_dereference` cannot be used to determine whether a type has a public `operator*` or not. +`` +struct A { private: void operator*(); }; +boost::has_dereference::value; // error: A::operator*() is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator*(const A&); +struct B { operator A(); }; +boost::has_dereference::value; // this is fine +boost::has_dereference::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_divides.qbk b/doc/has_divides.qbk new file mode 100644 index 0000000..0d723d6 --- /dev/null +++ b/doc/has_divides.qbk @@ -0,0 +1,73 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_divides has_divides] + template + struct has_divides : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs/rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs/rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator/`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs/rhs); // is valid if has_divides::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_divides::value_type` is the type `bool`.] +[:`has_divides::value` is a `bool` integral constant expression.] +[:`has_divides::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_divides` inherits from `__true_type`.] + +[:`has_divides` inherits from `__true_type`.] +[:`has_divides` inherits from `__true_type`.] +[:`has_divides` inherits from `__true_type`.] +[:`has_divides` inherits from `__true_type`.] +[:`has_divides::value` inherits from `__true_type`.] + +[:`has_divides` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator/` is public or not: +if `operator/` is defined as a private member of `Lhs` then +instantiating `has_divides` will produce a compiler error. +For this reason `has_divides` cannot be used to determine whether a type has a public `operator/` or not. +`` +struct A { private: void operator/(const A&); }; +boost::has_divides::value; // error: A::operator/(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator/(const A&, const A&); +struct B { operator A(); }; +boost::has_divides::value; // this is fine +boost::has_divides::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_divides_assign.qbk b/doc/has_divides_assign.qbk new file mode 100644 index 0000000..62ad479 --- /dev/null +++ b/doc/has_divides_assign.qbk @@ -0,0 +1,73 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_divides_assign has_divides_assign] + template + struct has_divides_assign : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs/=rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs/=rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator/=`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs/=rhs); // is valid if has_divides_assign::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_divides_assign::value_type` is the type `bool`.] +[:`has_divides_assign::value` is a `bool` integral constant expression.] +[:`has_divides_assign::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_divides_assign` inherits from `__true_type`.] + +[:`has_divides_assign` inherits from `__true_type`.] +[:`has_divides_assign` inherits from `__true_type`.] +[:`has_divides_assign` inherits from `__true_type`.] +[:`has_divides_assign` inherits from `__true_type`.] + +[:`has_divides_assign::value` inherits from `__false_type`.] +[:`has_divides_assign` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator/=` is public or not: +if `operator/=` is defined as a private member of `Lhs` then +instantiating `has_divides_assign` will produce a compiler error. +For this reason `has_divides_assign` cannot be used to determine whether a type has a public `operator/=` or not. +`` +struct A { private: void operator/=(const A&); }; +boost::has_divides_assign::value; // error: A::operator/=(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator/=(const A&, const A&); +struct B { operator A(); }; +boost::has_divides_assign::value; // this is fine +boost::has_divides_assign::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_equal_to.qbk b/doc/has_equal_to.qbk new file mode 100644 index 0000000..4b4d73e --- /dev/null +++ b/doc/has_equal_to.qbk @@ -0,0 +1,73 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_equal_to has_equal_to] + template + struct has_equal_to : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs==rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs==rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator==`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs==rhs); // is valid if has_equal_to::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_equal_to::value_type` is the type `bool`.] +[:`has_equal_to::value` is a `bool` integral constant expression.] +[:`has_equal_to::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_equal_to` inherits from `__true_type`.] + +[:`has_equal_to` inherits from `__true_type`.] +[:`has_equal_to` inherits from `__true_type`.] +[:`has_equal_to` inherits from `__true_type`.] + +[:`has_equal_to` inherits from `__false_type`.] +[:`has_equal_to` inherits from `__false_type`.] +[:`has_equal_to` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator==` is public or not: +if `operator==` is defined as a private member of `Lhs` then +instantiating `has_equal_to` will produce a compiler error. +For this reason `has_equal_to` cannot be used to determine whether a type has a public `operator==` or not. +`` +struct A { private: void operator==(const A&); }; +boost::has_equal_to::value; // error: A::operator==(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator==(const A&, const A&); +struct B { operator A(); }; +boost::has_equal_to::value; // this is fine +boost::has_equal_to::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_greater.qbk b/doc/has_greater.qbk new file mode 100644 index 0000000..d0cd93e --- /dev/null +++ b/doc/has_greater.qbk @@ -0,0 +1,73 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_greater has_greater] + template + struct has_greater : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs>rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs>rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator>`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs>rhs); // is valid if has_greater::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_greater::value_type` is the type `bool`.] +[:`has_greater::value` is a `bool` integral constant expression.] +[:`has_greater::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_greater` inherits from `__true_type`.] + +[:`has_greater` inherits from `__true_type`.] +[:`has_greater` inherits from `__true_type`.] +[:`has_greater` inherits from `__true_type`.] + +[:`has_greater` inherits from `__false_type`.] +[:`has_greater` inherits from `__false_type`.] +[:`has_greater` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator>` is public or not: +if `operator>` is defined as a private member of `Lhs` then +instantiating `has_greater` will produce a compiler error. +For this reason `has_greater` cannot be used to determine whether a type has a public `operator>` or not. +`` +struct A { private: void operator>(const A&); }; +boost::has_greater::value; // error: A::operator>(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator>(const A&, const A&); +struct B { operator A(); }; +boost::has_greater::value; // this is fine +boost::has_greater::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_greater_equal.qbk b/doc/has_greater_equal.qbk new file mode 100644 index 0000000..14c5a2a --- /dev/null +++ b/doc/has_greater_equal.qbk @@ -0,0 +1,73 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_greater_equal has_greater_equal] + template + struct has_greater_equal : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs>=rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs>=rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator>=`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs>=rhs); // is valid if has_greater_equal::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_greater_equal::value_type` is the type `bool`.] +[:`has_greater_equal::value` is a `bool` integral constant expression.] +[:`has_greater_equal::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_greater_equal` inherits from `__true_type`.] + +[:`has_greater_equal` inherits from `__true_type`.] +[:`has_greater_equal` inherits from `__true_type`.] +[:`has_greater_equal` inherits from `__true_type`.] + +[:`has_greater_equal` inherits from `__false_type`.] +[:`has_greater_equal` inherits from `__false_type`.] +[:`has_greater_equal` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator>=` is public or not: +if `operator>=` is defined as a private member of `Lhs` then +instantiating `has_greater_equal` will produce a compiler error. +For this reason `has_greater_equal` cannot be used to determine whether a type has a public `operator>=` or not. +`` +struct A { private: void operator>=(const A&); }; +boost::has_greater_equal::value; // error: A::operator>=(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator>=(const A&, const A&); +struct B { operator A(); }; +boost::has_greater_equal::value; // this is fine +boost::has_greater_equal::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_left_shift.qbk b/doc/has_left_shift.qbk new file mode 100644 index 0000000..c1af904 --- /dev/null +++ b/doc/has_left_shift.qbk @@ -0,0 +1,74 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_left_shift has_left_shift] + template + struct has_left_shift : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs<::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_left_shift::value_type` is the type `bool`.] +[:`has_left_shift::value` is a `bool` integral constant expression.] +[:`has_left_shift::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_left_shift` inherits from `__true_type`.] + +[:`has_left_shift` inherits from `__true_type`.] +[:`has_left_shift` inherits from `__true_type`.] +[:`has_left_shift` inherits from `__true_type`.] +[:`has_left_shift` inherits from `__true_type`.] +[:`has_left_shift` inherits from `__true_type`.] + +[:`has_left_shift` inherits from `__false_type`.] +[:`has_left_shift` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator<<` is public or not: +if `operator<<` is defined as a private member of `Lhs` then +instantiating `has_left_shift` will produce a compiler error. +For this reason `has_left_shift` cannot be used to determine whether a type has a public `operator<<` or not. +`` +struct A { private: void operator<<(const A&); }; +boost::has_left_shift::value; // error: A::operator<<(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator<<(const A&, const A&); +struct B { operator A(); }; +boost::has_left_shift::value; // this is fine +boost::has_left_shift::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_left_shift_assign.qbk b/doc/has_left_shift_assign.qbk new file mode 100644 index 0000000..63d0e5b --- /dev/null +++ b/doc/has_left_shift_assign.qbk @@ -0,0 +1,71 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_left_shift_assign has_left_shift_assign] + template + struct has_left_shift_assign : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs<<=rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs<<=rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator<<=`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs<<=rhs); // is valid if has_left_shift_assign::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_left_shift_assign::value_type` is the type `bool`.] +[:`has_left_shift_assign::value` is a `bool` integral constant expression.] +[:`has_left_shift_assign::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_left_shift_assign` inherits from `__true_type`.] + +[:`has_left_shift_assign` inherits from `__true_type`.] + +[:`has_left_shift_assign` inherits from `__false_type`.] +[:`has_left_shift_assign` inherits from `__false_type`.] +[:`has_left_shift_assign` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator<<=` is public or not: +if `operator<<=` is defined as a private member of `Lhs` then +instantiating `has_left_shift_assign` will produce a compiler error. +For this reason `has_left_shift_assign` cannot be used to determine whether a type has a public `operator<<=` or not. +`` +struct A { private: void operator<<=(const A&); }; +boost::has_left_shift_assign::value; // error: A::operator<<=(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator<<=(const A&, const A&); +struct B { operator A(); }; +boost::has_left_shift_assign::value; // this is fine +boost::has_left_shift_assign::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_less.qbk b/doc/has_less.qbk new file mode 100644 index 0000000..1956238 --- /dev/null +++ b/doc/has_less.qbk @@ -0,0 +1,73 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_less has_less] + template + struct has_less : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_less::value_type` is the type `bool`.] +[:`has_less::value` is a `bool` integral constant expression.] +[:`has_less::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_less` inherits from `__true_type`.] + +[:`has_less` inherits from `__true_type`.] +[:`has_less` inherits from `__true_type`.] +[:`has_less` inherits from `__true_type`.] + +[:`has_less` inherits from `__false_type`.] +[:`has_less` inherits from `__false_type`.] +[:`has_less` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator<` is public or not: +if `operator<` is defined as a private member of `Lhs` then +instantiating `has_less` will produce a compiler error. +For this reason `has_less` cannot be used to determine whether a type has a public `operator<` or not. +`` +struct A { private: void operator<(const A&); }; +boost::has_less::value; // error: A::operator<(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator<(const A&, const A&); +struct B { operator A(); }; +boost::has_less::value; // this is fine +boost::has_less::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_less_equal.qbk b/doc/has_less_equal.qbk new file mode 100644 index 0000000..dc3fd49 --- /dev/null +++ b/doc/has_less_equal.qbk @@ -0,0 +1,73 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_less_equal has_less_equal] + template + struct has_less_equal : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs<=rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs<=rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator<=`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs<=rhs); // is valid if has_less_equal::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_less_equal::value_type` is the type `bool`.] +[:`has_less_equal::value` is a `bool` integral constant expression.] +[:`has_less_equal::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_less_equal` inherits from `__true_type`.] + +[:`has_less_equal` inherits from `__true_type`.] +[:`has_less_equal` inherits from `__true_type`.] +[:`has_less_equal` inherits from `__true_type`.] + +[:`has_less_equal` inherits from `__false_type`.] +[:`has_less_equal` inherits from `__false_type`.] +[:`has_less_equal` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator<=` is public or not: +if `operator<=` is defined as a private member of `Lhs` then +instantiating `has_less_equal` will produce a compiler error. +For this reason `has_less_equal` cannot be used to determine whether a type has a public `operator<=` or not. +`` +struct A { private: void operator<=(const A&); }; +boost::has_less_equal::value; // error: A::operator<=(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator<=(const A&, const A&); +struct B { operator A(); }; +boost::has_less_equal::value; // this is fine +boost::has_less_equal::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_logical_and.qbk b/doc/has_logical_and.qbk new file mode 100644 index 0000000..c3d22ff --- /dev/null +++ b/doc/has_logical_and.qbk @@ -0,0 +1,72 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_logical_and has_logical_and] + template + struct has_logical_and : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs&&rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs&&rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator&&`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs&&rhs); // is valid if has_logical_and::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_logical_and::value_type` is the type `bool`.] +[:`has_logical_and::value` is a `bool` integral constant expression.] +[:`has_logical_and::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_logical_and` inherits from `__true_type`.] + +[:`has_logical_and` inherits from `__true_type`.] +[:`has_logical_and` inherits from `__true_type`.] +[:`has_logical_and` inherits from `__true_type`.] +[:`has_logical_and::value` inherits from `__true_type`.] + +[:`has_logical_and` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator&&` is public or not: +if `operator&&` is defined as a private member of `Lhs` then +instantiating `has_logical_and` will produce a compiler error. +For this reason `has_logical_and` cannot be used to determine whether a type has a public `operator&&` or not. +`` +struct A { private: void operator&&(const A&); }; +boost::has_logical_and::value; // error: A::operator&&(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator&&(const A&, const A&); +struct B { operator A(); }; +boost::has_logical_and::value; // this is fine +boost::has_logical_and::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_logical_not.qbk b/doc/has_logical_not.qbk new file mode 100644 index 0000000..30c41ff --- /dev/null +++ b/doc/has_logical_not.qbk @@ -0,0 +1,72 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_logical_not has_logical_not] + template + struct has_logical_not : public __tof {}; + +__inherit +If (i) `rhs` of type `Rhs` can be used in expression `!rhs`, +and (ii) `Ret=dont_care` or the result of expression `!rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of prefix `operator!`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Rhs rhs; +f(!rhs); // is valid if has_logical_not::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_logical_not::value_type` is the type `bool`.] +[:`has_logical_not::value` is a `bool` integral constant expression.] +[:`has_logical_not::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_logical_not` inherits from `__true_type`.] + +[:`has_logical_not` inherits from `__true_type`.] +[:`has_logical_not` inherits from `__true_type`.] +[:`has_logical_not` inherits from `__true_type`.] +[:`has_logical_not` inherits from `__true_type`.] +[:`has_logical_not` inherits from `__true_type`.] + +[:`has_logical_not` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether prefix `operator!` is public or not: +if `operator!` is defined as a private member of `Rhs` then +instantiating `has_logical_not` will produce a compiler error. +For this reason `has_logical_not` cannot be used to determine whether a type has a public `operator!` or not. +`` +struct A { private: void operator!(); }; +boost::has_logical_not::value; // error: A::operator!() is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator!(const A&); +struct B { operator A(); }; +boost::has_logical_not::value; // this is fine +boost::has_logical_not::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_logical_or.qbk b/doc/has_logical_or.qbk new file mode 100644 index 0000000..943dfa5 --- /dev/null +++ b/doc/has_logical_or.qbk @@ -0,0 +1,72 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_logical_or has_logical_or] + template + struct has_logical_or : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs||rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs||rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator||`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs||rhs); // is valid if has_logical_or::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_logical_or::value_type` is the type `bool`.] +[:`has_logical_or::value` is a `bool` integral constant expression.] +[:`has_logical_or::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_logical_or` inherits from `__true_type`.] + +[:`has_logical_or` inherits from `__true_type`.] +[:`has_logical_or` inherits from `__true_type`.] +[:`has_logical_or` inherits from `__true_type`.] +[:`has_logical_or::value` inherits from `__true_type`.] + +[:`has_logical_or` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator||` is public or not: +if `operator||` is defined as a private member of `Lhs` then +instantiating `has_logical_or` will produce a compiler error. +For this reason `has_logical_or` cannot be used to determine whether a type has a public `operator||` or not. +`` +struct A { private: void operator||(const A&); }; +boost::has_logical_or::value; // error: A::operator||(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator||(const A&, const A&); +struct B { operator A(); }; +boost::has_logical_or::value; // this is fine +boost::has_logical_or::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_minus.qbk b/doc/has_minus.qbk new file mode 100644 index 0000000..b97cd32 --- /dev/null +++ b/doc/has_minus.qbk @@ -0,0 +1,73 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_minus has_minus] + template + struct has_minus : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs-rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs-rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator-`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs-rhs); // is valid if has_minus::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_minus::value_type` is the type `bool`.] +[:`has_minus::value` is a `bool` integral constant expression.] +[:`has_minus::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_minus` inherits from `__true_type`.] + +[:`has_minus` inherits from `__true_type`.] +[:`has_minus` inherits from `__true_type`.] +[:`has_minus` inherits from `__true_type`.] +[:`has_minus` inherits from `__true_type`.] +[:`has_minus::value` inherits from `__true_type`.] + +[:`has_minus` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator-` is public or not: +if `operator-` is defined as a private member of `Lhs` then +instantiating `has_minus` will produce a compiler error. +For this reason `has_minus` cannot be used to determine whether a type has a public `operator-` or not. +`` +struct A { private: void operator-(const A&); }; +boost::has_minus::value; // error: A::operator-(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator-(const A&, const A&); +struct B { operator A(); }; +boost::has_minus::value; // this is fine +boost::has_minus::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_minus_assign.qbk b/doc/has_minus_assign.qbk new file mode 100644 index 0000000..90f0190 --- /dev/null +++ b/doc/has_minus_assign.qbk @@ -0,0 +1,73 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_minus_assign has_minus_assign] + template + struct has_minus_assign : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs-=rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs-=rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator-=`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs-=rhs); // is valid if has_minus_assign::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_minus_assign::value_type` is the type `bool`.] +[:`has_minus_assign::value` is a `bool` integral constant expression.] +[:`has_minus_assign::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_minus_assign` inherits from `__true_type`.] + +[:`has_minus_assign` inherits from `__true_type`.] +[:`has_minus_assign` inherits from `__true_type`.] +[:`has_minus_assign` inherits from `__true_type`.] +[:`has_minus_assign` inherits from `__true_type`.] + +[:`has_minus_assign::value` inherits from `__false_type`.] +[:`has_minus_assign` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator-=` is public or not: +if `operator-=` is defined as a private member of `Lhs` then +instantiating `has_minus_assign` will produce a compiler error. +For this reason `has_minus_assign` cannot be used to determine whether a type has a public `operator-=` or not. +`` +struct A { private: void operator-=(const A&); }; +boost::has_minus_assign::value; // error: A::operator-=(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator-=(const A&, const A&); +struct B { operator A(); }; +boost::has_minus_assign::value; // this is fine +boost::has_minus_assign::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_modulus.qbk b/doc/has_modulus.qbk new file mode 100644 index 0000000..339be1a --- /dev/null +++ b/doc/has_modulus.qbk @@ -0,0 +1,71 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_modulus has_modulus] + template + struct has_modulus : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs%rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs%rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator%`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs%rhs); // is valid if has_modulus::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_modulus::value_type` is the type `bool`.] +[:`has_modulus::value` is a `bool` integral constant expression.] +[:`has_modulus::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_modulus` inherits from `__true_type`.] + +[:`has_modulus` inherits from `__true_type`.] +[:`has_modulus` inherits from `__true_type`.] +[:`has_modulus::value` inherits from `__true_type`.] + +[:`has_modulus` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator%` is public or not: +if `operator%` is defined as a private member of `Lhs` then +instantiating `has_modulus` will produce a compiler error. +For this reason `has_modulus` cannot be used to determine whether a type has a public `operator%` or not. +`` +struct A { private: void operator%(const A&); }; +boost::has_modulus::value; // error: A::operator%(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator%(const A&, const A&); +struct B { operator A(); }; +boost::has_modulus::value; // this is fine +boost::has_modulus::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_modulus_assign.qbk b/doc/has_modulus_assign.qbk new file mode 100644 index 0000000..c0a5a29 --- /dev/null +++ b/doc/has_modulus_assign.qbk @@ -0,0 +1,71 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_modulus_assign has_modulus_assign] + template + struct has_modulus_assign : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs%=rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs%=rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator%=`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs%=rhs); // is valid if has_modulus_assign::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_modulus_assign::value_type` is the type `bool`.] +[:`has_modulus_assign::value` is a `bool` integral constant expression.] +[:`has_modulus_assign::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_modulus_assign` inherits from `__true_type`.] + +[:`has_modulus_assign` inherits from `__true_type`.] +[:`has_modulus_assign` inherits from `__true_type`.] + +[:`has_modulus_assign::value` inherits from `__false_type`.] +[:`has_modulus_assign` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator%=` is public or not: +if `operator%=` is defined as a private member of `Lhs` then +instantiating `has_modulus_assign` will produce a compiler error. +For this reason `has_modulus_assign` cannot be used to determine whether a type has a public `operator%=` or not. +`` +struct A { private: void operator%=(const A&); }; +boost::has_modulus_assign::value; // error: A::operator%=(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator%=(const A&, const A&); +struct B { operator A(); }; +boost::has_modulus_assign::value; // this is fine +boost::has_modulus_assign::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_multiplies.qbk b/doc/has_multiplies.qbk new file mode 100644 index 0000000..5f0599a --- /dev/null +++ b/doc/has_multiplies.qbk @@ -0,0 +1,73 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_multiplies has_multiplies] + template + struct has_multiplies : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs*rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs*rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator*`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs*rhs); // is valid if has_multiplies::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_multiplies::value_type` is the type `bool`.] +[:`has_multiplies::value` is a `bool` integral constant expression.] +[:`has_multiplies::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_multiplies` inherits from `__true_type`.] + +[:`has_multiplies` inherits from `__true_type`.] +[:`has_multiplies` inherits from `__true_type`.] +[:`has_multiplies` inherits from `__true_type`.] +[:`has_multiplies` inherits from `__true_type`.] +[:`has_multiplies::value` inherits from `__true_type`.] + +[:`has_multiplies` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator*` is public or not: +if `operator*` is defined as a private member of `Lhs` then +instantiating `has_multiplies` will produce a compiler error. +For this reason `has_multiplies` cannot be used to determine whether a type has a public `operator*` or not. +`` +struct A { private: void operator*(const A&); }; +boost::has_multiplies::value; // error: A::operator*(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator*(const A&, const A&); +struct B { operator A(); }; +boost::has_multiplies::value; // this is fine +boost::has_multiplies::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_multiplies_assign.qbk b/doc/has_multiplies_assign.qbk new file mode 100644 index 0000000..f64fb1e --- /dev/null +++ b/doc/has_multiplies_assign.qbk @@ -0,0 +1,73 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_multiplies_assign has_multiplies_assign] + template + struct has_multiplies_assign : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs*=rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs*=rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator*=`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs*=rhs); // is valid if has_multiplies_assign::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_multiplies_assign::value_type` is the type `bool`.] +[:`has_multiplies_assign::value` is a `bool` integral constant expression.] +[:`has_multiplies_assign::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_multiplies_assign` inherits from `__true_type`.] + +[:`has_multiplies_assign` inherits from `__true_type`.] +[:`has_multiplies_assign` inherits from `__true_type`.] +[:`has_multiplies_assign` inherits from `__true_type`.] +[:`has_multiplies_assign` inherits from `__true_type`.] + +[:`has_multiplies_assign::value` inherits from `__false_type`.] +[:`has_multiplies_assign` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator*=` is public or not: +if `operator*=` is defined as a private member of `Lhs` then +instantiating `has_multiplies_assign` will produce a compiler error. +For this reason `has_multiplies_assign` cannot be used to determine whether a type has a public `operator*=` or not. +`` +struct A { private: void operator*=(const A&); }; +boost::has_multiplies_assign::value; // error: A::operator*=(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator*=(const A&, const A&); +struct B { operator A(); }; +boost::has_multiplies_assign::value; // this is fine +boost::has_multiplies_assign::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_negate.qbk b/doc/has_negate.qbk new file mode 100644 index 0000000..9d1dc94 --- /dev/null +++ b/doc/has_negate.qbk @@ -0,0 +1,72 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_negate has_negate] + template + struct has_negate : public __tof {}; + +__inherit +If (i) `rhs` of type `Rhs` can be used in expression `-rhs`, +and (ii) `Ret=dont_care` or the result of expression `-rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of prefix `operator-`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Rhs rhs; +f(-rhs); // is valid if has_negate::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_negate::value_type` is the type `bool`.] +[:`has_negate::value` is a `bool` integral constant expression.] +[:`has_negate::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_negate` inherits from `__true_type`.] + +[:`has_negate` inherits from `__true_type`.] +[:`has_negate` inherits from `__true_type`.] +[:`has_negate` inherits from `__true_type`.] +[:`has_negate` inherits from `__true_type`.] +[:`has_negate` inherits from `__true_type`.] + +[:`has_negate` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether prefix `operator-` is public or not: +if `operator-` is defined as a private member of `Rhs` then +instantiating `has_negate` will produce a compiler error. +For this reason `has_negate` cannot be used to determine whether a type has a public `operator-` or not. +`` +struct A { private: void operator-(); }; +boost::has_negate::value; // error: A::operator-() is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator-(const A&); +struct B { operator A(); }; +boost::has_negate::value; // this is fine +boost::has_negate::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_not_equal_to.qbk b/doc/has_not_equal_to.qbk new file mode 100644 index 0000000..bdcdcea --- /dev/null +++ b/doc/has_not_equal_to.qbk @@ -0,0 +1,73 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_not_equal_to has_not_equal_to] + template + struct has_not_equal_to : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs!=rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs!=rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator!=`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs!=rhs); // is valid if has_not_equal_to::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_not_equal_to::value_type` is the type `bool`.] +[:`has_not_equal_to::value` is a `bool` integral constant expression.] +[:`has_not_equal_to::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_not_equal_to` inherits from `__true_type`.] + +[:`has_not_equal_to` inherits from `__true_type`.] +[:`has_not_equal_to` inherits from `__true_type`.] +[:`has_not_equal_to` inherits from `__true_type`.] + +[:`has_not_equal_to` inherits from `__false_type`.] +[:`has_not_equal_to` inherits from `__false_type`.] +[:`has_not_equal_to` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator!=` is public or not: +if `operator!=` is defined as a private member of `Lhs` then +instantiating `has_not_equal_to` will produce a compiler error. +For this reason `has_not_equal_to` cannot be used to determine whether a type has a public `operator!=` or not. +`` +struct A { private: void operator!=(const A&); }; +boost::has_not_equal_to::value; // error: A::operator!=(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator!=(const A&, const A&); +struct B { operator A(); }; +boost::has_not_equal_to::value; // this is fine +boost::has_not_equal_to::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_plus.qbk b/doc/has_plus.qbk new file mode 100644 index 0000000..4a48be4 --- /dev/null +++ b/doc/has_plus.qbk @@ -0,0 +1,73 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_plus has_plus] + template + struct has_plus : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs+rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs+rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator+`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs+rhs); // is valid if has_plus::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_plus::value_type` is the type `bool`.] +[:`has_plus::value` is a `bool` integral constant expression.] +[:`has_plus::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_plus` inherits from `__true_type`.] + +[:`has_plus` inherits from `__true_type`.] +[:`has_plus` inherits from `__true_type`.] +[:`has_plus` inherits from `__true_type`.] +[:`has_plus` inherits from `__true_type`.] +[:`has_plus::value` inherits from `__true_type`.] + +[:`has_plus` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator+` is public or not: +if `operator+` is defined as a private member of `Lhs` then +instantiating `has_plus` will produce a compiler error. +For this reason `has_plus` cannot be used to determine whether a type has a public `operator+` or not. +`` +struct A { private: void operator+(const A&); }; +boost::has_plus::value; // error: A::operator+(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator+(const A&, const A&); +struct B { operator A(); }; +boost::has_plus::value; // this is fine +boost::has_plus::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_plus_assign.qbk b/doc/has_plus_assign.qbk new file mode 100644 index 0000000..2e4091e --- /dev/null +++ b/doc/has_plus_assign.qbk @@ -0,0 +1,73 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_plus_assign has_plus_assign] + template + struct has_plus_assign : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs+=rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs+=rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator+=`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs+=rhs); // is valid if has_plus_assign::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_plus_assign::value_type` is the type `bool`.] +[:`has_plus_assign::value` is a `bool` integral constant expression.] +[:`has_plus_assign::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_plus_assign` inherits from `__true_type`.] + +[:`has_plus_assign` inherits from `__true_type`.] +[:`has_plus_assign` inherits from `__true_type`.] +[:`has_plus_assign` inherits from `__true_type`.] +[:`has_plus_assign` inherits from `__true_type`.] + +[:`has_plus_assign::value` inherits from `__false_type`.] +[:`has_plus_assign` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator+=` is public or not: +if `operator+=` is defined as a private member of `Lhs` then +instantiating `has_plus_assign` will produce a compiler error. +For this reason `has_plus_assign` cannot be used to determine whether a type has a public `operator+=` or not. +`` +struct A { private: void operator+=(const A&); }; +boost::has_plus_assign::value; // error: A::operator+=(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator+=(const A&, const A&); +struct B { operator A(); }; +boost::has_plus_assign::value; // this is fine +boost::has_plus_assign::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_post_decrement.qbk b/doc/has_post_decrement.qbk new file mode 100644 index 0000000..22c785e --- /dev/null +++ b/doc/has_post_decrement.qbk @@ -0,0 +1,74 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_post_decrement has_post_decrement] + template + struct has_post_decrement : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` can be used in expression `lhs--`, +and (ii) `Ret=dont_care` or the result of expression `lhs--` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of postfix `operator--`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +f(lhs--); // is valid if has_post_decrement::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_post_decrement::value_type` is the type `bool`.] +[:`has_post_decrement::value` is a `bool` integral constant expression.] +[:`has_post_decrement::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_post_decrement` inherits from `__true_type`.] + +[:`has_post_decrement` inherits from `__true_type`.] +[:`has_post_decrement` inherits from `__true_type`.] +[:`has_post_decrement` inherits from `__true_type`.] +[:`has_post_decrement` inherits from `__true_type`.] + +[:`has_post_decrement` inherits from `__false_type`.] +[:`has_post_decrement` inherits from `__false_type`.] +[:`has_post_decrement` inherits from `__false_type`.] +[:`has_post_decrement` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether postfix `operator--` is public or not: +if `operator--` is defined as a private member of `Lhs` then +instantiating `has_post_decrement` will produce a compiler error. +For this reason `has_post_decrement` cannot be used to determine whether a type has a public `operator--` or not. +`` +struct A { private: void operator--(int); }; +boost::has_post_decrement::value; // error: A::operator--(int) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator--(const A&, int); +struct B { operator A(); }; +boost::has_post_decrement::value; // this is fine +boost::has_post_decrement::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_post_increment.qbk b/doc/has_post_increment.qbk new file mode 100644 index 0000000..0d17aec --- /dev/null +++ b/doc/has_post_increment.qbk @@ -0,0 +1,74 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_post_increment has_post_increment] + template + struct has_post_increment : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` can be used in expression `lhs++`, +and (ii) `Ret=dont_care` or the result of expression `lhs++` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of postfix `operator++`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +f(lhs++); // is valid if has_post_increment::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_post_increment::value_type` is the type `bool`.] +[:`has_post_increment::value` is a `bool` integral constant expression.] +[:`has_post_increment::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_post_increment` inherits from `__true_type`.] + +[:`has_post_increment` inherits from `__true_type`.] +[:`has_post_increment` inherits from `__true_type`.] +[:`has_post_increment` inherits from `__true_type`.] +[:`has_post_increment` inherits from `__true_type`.] +[:`has_post_increment` inherits from `__true_type`.] + +[:`has_post_increment` inherits from `__false_type`.] +[:`has_post_increment` inherits from `__false_type`.] +[:`has_post_increment` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether postfix `operator++` is public or not: +if `operator++` is defined as a private member of `Lhs` then +instantiating `has_post_increment` will produce a compiler error. +For this reason `has_post_increment` cannot be used to determine whether a type has a public `operator++` or not. +`` +struct A { private: void operator++(int); }; +boost::has_post_increment::value; // error: A::operator++(int) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator++(const A&, int); +struct B { operator A(); }; +boost::has_post_increment::value; // this is fine +boost::has_post_increment::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_pre_decrement.qbk b/doc/has_pre_decrement.qbk new file mode 100644 index 0000000..8e7c4cd --- /dev/null +++ b/doc/has_pre_decrement.qbk @@ -0,0 +1,74 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_pre_decrement has_pre_decrement] + template + struct has_pre_decrement : public __tof {}; + +__inherit +If (i) `rhs` of type `Rhs` can be used in expression `--rhs`, +and (ii) `Ret=dont_care` or the result of expression `--rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of prefix `operator--`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Rhs rhs; +f(--rhs); // is valid if has_pre_decrement::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_pre_decrement::value_type` is the type `bool`.] +[:`has_pre_decrement::value` is a `bool` integral constant expression.] +[:`has_pre_decrement::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_pre_decrement` inherits from `__true_type`.] + +[:`has_pre_decrement` inherits from `__true_type`.] +[:`has_pre_decrement` inherits from `__true_type`.] +[:`has_pre_decrement` inherits from `__true_type`.] +[:`has_pre_decrement` inherits from `__true_type`.] + +[:`has_pre_decrement` inherits from `__false_type`.] +[:`has_pre_decrement` inherits from `__false_type`.] +[:`has_pre_decrement` inherits from `__false_type`.] +[:`has_pre_decrement` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether prefix `operator--` is public or not: +if `operator--` is defined as a private member of `Rhs` then +instantiating `has_pre_decrement` will produce a compiler error. +For this reason `has_pre_decrement` cannot be used to determine whether a type has a public `operator--` or not. +`` +struct A { private: void operator--(); }; +boost::has_pre_decrement::value; // error: A::operator--() is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator--(const A&); +struct B { operator A(); }; +boost::has_pre_decrement::value; // this is fine +boost::has_pre_decrement::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_pre_increment.qbk b/doc/has_pre_increment.qbk new file mode 100644 index 0000000..e3cb616 --- /dev/null +++ b/doc/has_pre_increment.qbk @@ -0,0 +1,74 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_pre_increment has_pre_increment] + template + struct has_pre_increment : public __tof {}; + +__inherit +If (i) `rhs` of type `Rhs` can be used in expression `++rhs`, +and (ii) `Ret=dont_care` or the result of expression `++rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of prefix `operator++`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Rhs rhs; +f(++rhs); // is valid if has_pre_increment::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_pre_increment::value_type` is the type `bool`.] +[:`has_pre_increment::value` is a `bool` integral constant expression.] +[:`has_pre_increment::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_pre_increment` inherits from `__true_type`.] + +[:`has_pre_increment` inherits from `__true_type`.] +[:`has_pre_increment` inherits from `__true_type`.] +[:`has_pre_increment` inherits from `__true_type`.] +[:`has_pre_increment` inherits from `__true_type`.] +[:`has_pre_increment` inherits from `__true_type`.] + +[:`has_pre_increment` inherits from `__false_type`.] +[:`has_pre_increment` inherits from `__false_type`.] +[:`has_pre_increment` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether prefix `operator++` is public or not: +if `operator++` is defined as a private member of `Rhs` then +instantiating `has_pre_increment` will produce a compiler error. +For this reason `has_pre_increment` cannot be used to determine whether a type has a public `operator++` or not. +`` +struct A { private: void operator++(); }; +boost::has_pre_increment::value; // error: A::operator++() is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator++(const A&); +struct B { operator A(); }; +boost::has_pre_increment::value; // this is fine +boost::has_pre_increment::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_right_shift.qbk b/doc/has_right_shift.qbk new file mode 100644 index 0000000..5dfa90b --- /dev/null +++ b/doc/has_right_shift.qbk @@ -0,0 +1,74 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_right_shift has_right_shift] + template + struct has_right_shift : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs>>rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs>>rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator>>`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs>>rhs); // is valid if has_right_shift::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_right_shift::value_type` is the type `bool`.] +[:`has_right_shift::value` is a `bool` integral constant expression.] +[:`has_right_shift::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_right_shift` inherits from `__true_type`.] + +[:`has_right_shift` inherits from `__true_type`.] +[:`has_right_shift` inherits from `__true_type`.] +[:`has_right_shift` inherits from `__true_type`.] +[:`has_right_shift` inherits from `__true_type`.] +[:`has_right_shift` inherits from `__true_type`.] + +[:`has_right_shift` inherits from `__false_type`.] +[:`has_right_shift` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator>>` is public or not: +if `operator>>` is defined as a private member of `Lhs` then +instantiating `has_right_shift` will produce a compiler error. +For this reason `has_right_shift` cannot be used to determine whether a type has a public `operator>>` or not. +`` +struct A { private: void operator>>(const A&); }; +boost::has_right_shift::value; // error: A::operator>>(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator>>(const A&, const A&); +struct B { operator A(); }; +boost::has_right_shift::value; // this is fine +boost::has_right_shift::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_right_shift_assign.qbk b/doc/has_right_shift_assign.qbk new file mode 100644 index 0000000..5cfeb09 --- /dev/null +++ b/doc/has_right_shift_assign.qbk @@ -0,0 +1,71 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_right_shift_assign has_right_shift_assign] + template + struct has_right_shift_assign : public __tof {}; + +__inherit +If (i) `lhs` of type `Lhs` and `rhs` of type `Rhs` can be used in expression `lhs>>=rhs`, +and (ii) `Ret=dont_care` or the result of expression `lhs>>=rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of binary `operator>>=`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Lhs lhs; +Rhs rhs; +f(lhs>>=rhs); // is valid if has_right_shift_assign::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_right_shift_assign::value_type` is the type `bool`.] +[:`has_right_shift_assign::value` is a `bool` integral constant expression.] +[:`has_right_shift_assign::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_right_shift_assign` inherits from `__true_type`.] + +[:`has_right_shift_assign` inherits from `__true_type`.] + +[:`has_right_shift_assign` inherits from `__false_type`.] +[:`has_right_shift_assign` inherits from `__false_type`.] +[:`has_right_shift_assign` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether binary `operator>>=` is public or not: +if `operator>>=` is defined as a private member of `Lhs` then +instantiating `has_right_shift_assign` will produce a compiler error. +For this reason `has_right_shift_assign` cannot be used to determine whether a type has a public `operator>>=` or not. +`` +struct A { private: void operator>>=(const A&); }; +boost::has_right_shift_assign::value; // error: A::operator>>=(const A&) is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator>>=(const A&, const A&); +struct B { operator A(); }; +boost::has_right_shift_assign::value; // this is fine +boost::has_right_shift_assign::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_unary_minus.qbk b/doc/has_unary_minus.qbk new file mode 100644 index 0000000..0e6112a --- /dev/null +++ b/doc/has_unary_minus.qbk @@ -0,0 +1,72 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_unary_minus has_unary_minus] + template + struct has_unary_minus : public __tof {}; + +__inherit +If (i) `rhs` of type `Rhs` can be used in expression `-rhs`, +and (ii) `Ret=dont_care` or the result of expression `-rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of prefix `operator-`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Rhs rhs; +f(-rhs); // is valid if has_unary_minus::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_unary_minus::value_type` is the type `bool`.] +[:`has_unary_minus::value` is a `bool` integral constant expression.] +[:`has_unary_minus::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_unary_minus` inherits from `__true_type`.] + +[:`has_unary_minus` inherits from `__true_type`.] +[:`has_unary_minus` inherits from `__true_type`.] +[:`has_unary_minus` inherits from `__true_type`.] +[:`has_unary_minus` inherits from `__true_type`.] +[:`has_unary_minus` inherits from `__true_type`.] + +[:`has_unary_minus` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether prefix `operator-` is public or not: +if `operator-` is defined as a private member of `Rhs` then +instantiating `has_unary_minus` will produce a compiler error. +For this reason `has_unary_minus` cannot be used to determine whether a type has a public `operator-` or not. +`` +struct A { private: void operator-(); }; +boost::has_unary_minus::value; // error: A::operator-() is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator-(const A&); +struct B { operator A(); }; +boost::has_unary_minus::value; // this is fine +boost::has_unary_minus::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/has_unary_plus.qbk b/doc/has_unary_plus.qbk new file mode 100644 index 0000000..1f542c9 --- /dev/null +++ b/doc/has_unary_plus.qbk @@ -0,0 +1,72 @@ +[/ + (C) Copyright 2009-2011 Frederic Bron. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + +[section:has_unary_plus has_unary_plus] + template + struct has_unary_plus : public __tof {}; + +__inherit +If (i) `rhs` of type `Rhs` can be used in expression `+rhs`, +and (ii) `Ret=dont_care` or the result of expression `+rhs` is convertible to `Ret` +then inherits from __true_type, +otherwise inherits from __false_type. + +The default behaviour (`Ret=dont_care`) is to not check for the return value of prefix `operator+`. +If `Ret` is different from the default `dont_care` type, the return value is checked to be convertible to `Ret`. +Convertible to `Ret` means that the return value of the operator can be used as argument to a function expecting `Ret`: +`` +void f(Ret); +Rhs rhs; +f(+rhs); // is valid if has_unary_plus::value==true +`` +If `Ret=void`, the return type is checked to be exactly `void`. + +__header `#include ` or `#include ` + +__examples + +[:`has_unary_plus::value_type` is the type `bool`.] +[:`has_unary_plus::value` is a `bool` integral constant expression.] +[:`has_unary_plus::value` is a `bool` integral constant expression that evaluates to `true`.] +[:`has_unary_plus` inherits from `__true_type`.] + +[:`has_unary_plus` inherits from `__true_type`.] +[:`has_unary_plus` inherits from `__true_type`.] +[:`has_unary_plus` inherits from `__true_type`.] +[:`has_unary_plus` inherits from `__true_type`.] +[:`has_unary_plus` inherits from `__true_type`.] + +[:`has_unary_plus` inherits from `__false_type`.] + + +[*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] + +[*Known issues:] + +* This trait cannot detect whether prefix `operator+` is public or not: +if `operator+` is defined as a private member of `Rhs` then +instantiating `has_unary_plus` will produce a compiler error. +For this reason `has_unary_plus` cannot be used to determine whether a type has a public `operator+` or not. +`` +struct A { private: void operator+(); }; +boost::has_unary_plus::value; // error: A::operator+() is private +`` + +* There is an issue if the operator exists only for type `A` and `B` is +convertible to `A`. In this case, the compiler will report an ambiguous overload. +`` +struct A { }; +void operator+(const A&); +struct B { operator A(); }; +boost::has_unary_plus::value; // this is fine +boost::has_unary_plus::value; // error: ambiguous overload +`` + +* `volatile` qualifier is not properly handled and would lead to undefined behavior + +[endsect] + diff --git a/doc/html/boost_typetraits/background.html b/doc/html/boost_typetraits/background.html index 460e86b..2be4fa6 100644 --- a/doc/html/boost_typetraits/background.html +++ b/doc/html/boost_typetraits/background.html @@ -3,7 +3,7 @@ Background and Tutorial - + @@ -669,10 +669,11 @@ -
-
-
-

-PrevUpHomeNext +PrevUpHomeNext

@@ -161,10 +161,11 @@

-

-PrevUpHomeNext +PrevUpHomeNext
diff --git a/doc/html/boost_typetraits/category/value_traits.html b/doc/html/boost_typetraits/category/value_traits.html index a7bf570..f4567c4 100644 --- a/doc/html/boost_typetraits/category/value_traits.html +++ b/doc/html/boost_typetraits/category/value_traits.html @@ -3,7 +3,7 @@ Type Traits that Describe the Properties of a Type - + @@ -34,6 +34,8 @@ Type Properties
Relationships Between Two Types
+
Operator + Type Traits

These traits are all value traits, which is to say the @@ -48,10 +50,11 @@

-
-
-