diff --git a/doc/has_bit_and.qbk b/doc/has_bit_and.qbk index bf91a7c..7961e25 100644 --- a/doc/has_bit_and.qbk +++ b/doc/has_bit_and.qbk @@ -46,62 +46,7 @@ __examples [has_binary_operator_compat] -[*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator&` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator&(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g&g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b&b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_bit_and..&..A..contains..const ] [endsect] diff --git a/doc/has_bit_and_assign.qbk b/doc/has_bit_and_assign.qbk index 200f8ae..cd8a022 100644 --- a/doc/has_bit_and_assign.qbk +++ b/doc/has_bit_and_assign.qbk @@ -46,62 +46,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator&=` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator&=(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g&=g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b&=b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_bit_and_assign..&=..A&..contains&..[/Nothing]] [endsect] diff --git a/doc/has_bit_or.qbk b/doc/has_bit_or.qbk index 4ec707d..46c845f 100644 --- a/doc/has_bit_or.qbk +++ b/doc/has_bit_or.qbk @@ -46,62 +46,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator|` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator|(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g|g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b|b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_bit_or..|..A..contains..const ] [endsect] diff --git a/doc/has_bit_or_assign.qbk b/doc/has_bit_or_assign.qbk index 9f07d47..0d345a7 100644 --- a/doc/has_bit_or_assign.qbk +++ b/doc/has_bit_or_assign.qbk @@ -46,62 +46,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator|=` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator|=(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g|=g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b|=b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_bit_or_assign..|=..A&..contains&..[/Nothing]] [endsect] diff --git a/doc/has_bit_xor.qbk b/doc/has_bit_xor.qbk index 8018beb..c2e4f13 100644 --- a/doc/has_bit_xor.qbk +++ b/doc/has_bit_xor.qbk @@ -46,62 +46,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator^` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator^(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g^g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b^b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_bit_xor..^..A..contains..const ] [endsect] diff --git a/doc/has_bit_xor_assign.qbk b/doc/has_bit_xor_assign.qbk index 9791c27..8848afe 100644 --- a/doc/has_bit_xor_assign.qbk +++ b/doc/has_bit_xor_assign.qbk @@ -46,62 +46,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator^=` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator^=(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g^=g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b^=b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_bit_xor_assign..^=..A&..contains&..[/Nothing]] [endsect] diff --git a/doc/has_divides.qbk b/doc/has_divides.qbk index 9a758ec..b17615e 100644 --- a/doc/has_divides.qbk +++ b/doc/has_divides.qbk @@ -48,62 +48,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator/` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator/(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g/g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b/b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_divides../..A..contains..const ] [endsect] diff --git a/doc/has_divides_assign.qbk b/doc/has_divides_assign.qbk index 7968b8f..a1e43bd 100644 --- a/doc/has_divides_assign.qbk +++ b/doc/has_divides_assign.qbk @@ -48,62 +48,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator/=` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator/=(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g/=g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b/=b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_divides_assign../=..A&..contains&..[/Nothing]] [endsect] diff --git a/doc/has_equal_to.qbk b/doc/has_equal_to.qbk index d33e790..7446cab 100644 --- a/doc/has_equal_to.qbk +++ b/doc/has_equal_to.qbk @@ -48,62 +48,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator==` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator==(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g==g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b==b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_equal_to..==..bool..bool..const ] [endsect] diff --git a/doc/has_greater.qbk b/doc/has_greater.qbk index d344420..ab476e7 100644 --- a/doc/has_greater.qbk +++ b/doc/has_greater.qbk @@ -48,62 +48,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator>` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator>(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g>g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b>b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_greater..>..bool..bool..const ] [endsect] diff --git a/doc/has_greater_equal.qbk b/doc/has_greater_equal.qbk index bed5042..6e4529c 100644 --- a/doc/has_greater_equal.qbk +++ b/doc/has_greater_equal.qbk @@ -48,62 +48,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator>=` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator>=(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g>=g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b>=b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_greater_equal..>=..bool..bool..const ] [endsect] diff --git a/doc/has_left_shift.qbk b/doc/has_left_shift.qbk index b807a36..21350f3 100644 --- a/doc/has_left_shift.qbk +++ b/doc/has_left_shift.qbk @@ -49,62 +49,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator<<` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator<<(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g< - std::cout< >::value<<'\n'; // true, should be false - contains b; - b<..const ] [endsect] diff --git a/doc/has_left_shift_assign.qbk b/doc/has_left_shift_assign.qbk index fcfa92a..c963374 100644 --- a/doc/has_left_shift_assign.qbk +++ b/doc/has_left_shift_assign.qbk @@ -46,62 +46,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator<<=` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator<<=(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g<<=g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b<<=b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_left_shift_assign..<<=..A&..contains&..[/]] [endsect] diff --git a/doc/has_less.qbk b/doc/has_less.qbk index daa81cb..dbe6b7a 100644 --- a/doc/has_less.qbk +++ b/doc/has_less.qbk @@ -48,62 +48,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator<` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator<(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g - std::cout< >::value<<'\n'; // true, should be false - contains b; - b` 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 -`` - -* There is an issue when applying this trait to template classes. -If `operator<=` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator<=(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g<=g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b<=b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_less_equal..<=..bool..bool..const ] [endsect] diff --git a/doc/has_logical_and.qbk b/doc/has_logical_and.qbk index 62f2672..8b159e5 100644 --- a/doc/has_logical_and.qbk +++ b/doc/has_logical_and.qbk @@ -46,63 +46,8 @@ __examples [*See also:] [link boost_typetraits.category.value_traits.operators Operator Type Traits] +[binary_operator_known_issues has_logical_and..&&..bool..bool..const ] -[*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator&&` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator&&(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g&&g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b&&b; // compile time error - return 0; -} -`` - -* `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 index 9bf2fd2..901cfe1 100644 --- a/doc/has_logical_or.qbk +++ b/doc/has_logical_or.qbk @@ -47,62 +47,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator||` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator||(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g||g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b||b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_logical_or..||..bool..bool..const ] [endsect] diff --git a/doc/has_minus.qbk b/doc/has_minus.qbk index 06141ce..624751f 100644 --- a/doc/has_minus.qbk +++ b/doc/has_minus.qbk @@ -48,62 +48,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator-` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator-(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g-g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b-b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_minus..-..A..contains..const ] [endsect] diff --git a/doc/has_minus_assign.qbk b/doc/has_minus_assign.qbk index cb39468..ecd7329 100644 --- a/doc/has_minus_assign.qbk +++ b/doc/has_minus_assign.qbk @@ -48,62 +48,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator-=` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator-=(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g-=g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b-=b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_minus_assign..-=..A&..contains&..[/]] [endsect] diff --git a/doc/has_modulus.qbk b/doc/has_modulus.qbk index 5f1384e..3d8b904 100644 --- a/doc/has_modulus.qbk +++ b/doc/has_modulus.qbk @@ -46,62 +46,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator%` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator%(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g%g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b%b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_modulus..%..A..contains..const ] [endsect] diff --git a/doc/has_modulus_assign.qbk b/doc/has_modulus_assign.qbk index 636a250..52226a2 100644 --- a/doc/has_modulus_assign.qbk +++ b/doc/has_modulus_assign.qbk @@ -46,62 +46,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator%=` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator%=(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g%=g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b%=b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_modulus_assign..%=..A&..contains&..[/]] [endsect] diff --git a/doc/has_multiplies.qbk b/doc/has_multiplies.qbk index fed1e65..3579052 100644 --- a/doc/has_multiplies.qbk +++ b/doc/has_multiplies.qbk @@ -48,62 +48,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator*` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator*(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g*g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b*b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_multiplies..*..A..contains..const ] [endsect] diff --git a/doc/has_multiplies_assign.qbk b/doc/has_multiplies_assign.qbk index 7bd67ad..4ec9f2e 100644 --- a/doc/has_multiplies_assign.qbk +++ b/doc/has_multiplies_assign.qbk @@ -48,62 +48,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator*=` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator*=(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g*=g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b*=b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_multiplies_assign..*=..A&..contains&..[/]] [endsect] diff --git a/doc/has_not_equal_to.qbk b/doc/has_not_equal_to.qbk index 83a857e..8b4177d 100644 --- a/doc/has_not_equal_to.qbk +++ b/doc/has_not_equal_to.qbk @@ -48,62 +48,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator!=` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator!=(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g!=g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b!=b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_not_equal_to..!=..bool..bool..const ] [endsect] diff --git a/doc/has_plus.qbk b/doc/has_plus.qbk index 48f4281..483f0e9 100644 --- a/doc/has_plus.qbk +++ b/doc/has_plus.qbk @@ -48,62 +48,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator+` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator+(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g+g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b+b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_plus..+..A..contains..const ] [endsect] diff --git a/doc/has_plus_assign.qbk b/doc/has_plus_assign.qbk index 400ec43..929e8a0 100644 --- a/doc/has_plus_assign.qbk +++ b/doc/has_plus_assign.qbk @@ -48,62 +48,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator+=` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator+=(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g+=g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b+=b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_plus_assign..+=..A&..contains&..const ] [endsect] diff --git a/doc/has_right_shift.qbk b/doc/has_right_shift.qbk index dee8852..4e2d08a 100644 --- a/doc/has_right_shift.qbk +++ b/doc/has_right_shift.qbk @@ -49,62 +49,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator>>` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator>>(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g>>g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b>>b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_right_shift..>>..A..contains..const ] [endsect] diff --git a/doc/has_right_shift_assign.qbk b/doc/has_right_shift_assign.qbk index d45dea5..1545b88 100644 --- a/doc/has_right_shift_assign.qbk +++ b/doc/has_right_shift_assign.qbk @@ -46,62 +46,7 @@ __examples [*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 -`` - -* There is an issue when applying this trait to template classes. -If `operator>>=` is defined but does not bind for a given template type, -it is still detected by the trait which returns `true` instead of `false`. -Example: -`` -#include -#include - -template -struct contains { T data; }; - -template -bool operator>>=(const contains &lhs, const contains &rhs) { - return f(lhs.data, rhs.data); -} - -class bad { }; -class good { }; -bool f(const good&, const good&) { } - -int main() { - std::cout< - std::cout< >::value<<'\n'; // true - contains g; - g>>=g; // ok - // does not work for contains - std::cout< >::value<<'\n'; // true, should be false - contains b; - b>>=b; // compile time error - return 0; -} -`` - -* `volatile` qualifier is not properly handled and would lead to undefined behavior +[binary_operator_known_issues has_right_shift_assign..>>=..A&..contains&..[/]] [endsect] diff --git a/doc/html/boost_typetraits/reference/has_bit_and.html b/doc/html/boost_typetraits/reference/has_bit_and.html index d6ba60e..ef22bba 100644 --- a/doc/html/boost_typetraits/reference/has_bit_and.html +++ b/doc/html/boost_typetraits/reference/has_bit_and.html @@ -107,68 +107,82 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_bit_and<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator& - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_bit_and.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_bit_and.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_bit_and cannot + perform introspection of the template function body to ensure that the type + meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_bit_and.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator&(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T> operator & (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_bit_and< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g&g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_bit_and< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b&b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_bit_and< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_bit_and< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A operator & (const A&); };
    +boost::has_bit_and<A>::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 { };
    +A operator & (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_bit_and<A>::value; // this is fine
    +boost::has_bit_and<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_bit_and_assign.html b/doc/html/boost_typetraits/reference/has_bit_and_assign.html index d913cb5..cf061b4 100644 --- a/doc/html/boost_typetraits/reference/has_bit_and_assign.html +++ b/doc/html/boost_typetraits/reference/has_bit_and_assign.html @@ -107,68 +107,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_bit_and_assign<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator&= - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_bit_and_assign.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_bit_and_assign.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_bit_and_assign + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_bit_and_assign.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator&=(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T>& operator &= (contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_bit_and_assign< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g&=g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_bit_and_assign< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b&=b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_bit_and_assign< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_bit_and_assign< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A& operator &= (const A&); };
    +boost::has_bit_and_assign<A>::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 { };
    +A& operator &= (A&, const A&);
    +struct B { operator A(); };
    +boost::has_bit_and_assign<A>::value; // this is fine
    +boost::has_bit_and_assign<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_bit_or.html b/doc/html/boost_typetraits/reference/has_bit_or.html index 89cd8dc..36d43d6 100644 --- a/doc/html/boost_typetraits/reference/has_bit_or.html +++ b/doc/html/boost_typetraits/reference/has_bit_or.html @@ -107,66 +107,82 @@

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<Lhs> - 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<A>::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<A>::value; // this is fine
    -boost::has_bit_or<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator| - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_bit_or.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_bit_or.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_bit_or cannot + perform introspection of the template function body to ensure that the type + meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_bit_or.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator|(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T> operator | (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_bit_or< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g|g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_bit_or< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b|b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_bit_or< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_bit_or< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A operator | (const A&); };
    +boost::has_bit_or<A>::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 { };
    +A operator | (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_bit_or<A>::value; // this is fine
    +boost::has_bit_or<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_bit_or_assign.html b/doc/html/boost_typetraits/reference/has_bit_or_assign.html index 4f93a5e..1a8fb2e 100644 --- a/doc/html/boost_typetraits/reference/has_bit_or_assign.html +++ b/doc/html/boost_typetraits/reference/has_bit_or_assign.html @@ -107,68 +107,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_bit_or_assign<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator|= - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_bit_or_assign.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_bit_or_assign.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_bit_or_assign + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_bit_or_assign.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator|=(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T>& operator |= (contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_bit_or_assign< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g|=g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_bit_or_assign< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b|=b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_bit_or_assign< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_bit_or_assign< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A& operator |= (const A&); };
    +boost::has_bit_or_assign<A>::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 { };
    +A& operator |= (A&, const A&);
    +struct B { operator A(); };
    +boost::has_bit_or_assign<A>::value; // this is fine
    +boost::has_bit_or_assign<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_bit_xor.html b/doc/html/boost_typetraits/reference/has_bit_xor.html index 80463de..49380ed 100644 --- a/doc/html/boost_typetraits/reference/has_bit_xor.html +++ b/doc/html/boost_typetraits/reference/has_bit_xor.html @@ -107,66 +107,82 @@

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<Lhs> - 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<A>::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<A>::value; // this is fine
    -boost::has_bit_xor<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator^ - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_bit_xor.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_bit_xor.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_bit_xor cannot + perform introspection of the template function body to ensure that the type + meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_bit_xor.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator^(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T> operator ^ (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_bit_xor< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g^g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_bit_xor< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b^b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_bit_xor< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_bit_xor< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A operator ^ (const A&); };
    +boost::has_bit_xor<A>::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 { };
    +A operator ^ (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_bit_xor<A>::value; // this is fine
    +boost::has_bit_xor<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_bit_xor_assign.html b/doc/html/boost_typetraits/reference/has_bit_xor_assign.html index a6fe0b3..0a23427 100644 --- a/doc/html/boost_typetraits/reference/has_bit_xor_assign.html +++ b/doc/html/boost_typetraits/reference/has_bit_xor_assign.html @@ -107,68 +107,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_bit_xor_assign<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator^= - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_bit_xor_assign.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_bit_xor_assign.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_bit_xor_assign + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_bit_xor_assign.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator^=(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T>& operator ^= (contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_bit_xor_assign< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g^=g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_bit_xor_assign< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b^=b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_bit_xor_assign< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_bit_xor_assign< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A& operator ^= (const A&); };
    +boost::has_bit_xor_assign<A>::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 { };
    +A& operator ^= (A&, const A&);
    +struct B { operator A(); };
    +boost::has_bit_xor_assign<A>::value; // this is fine
    +boost::has_bit_xor_assign<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_divides.html b/doc/html/boost_typetraits/reference/has_divides.html index 4b7b851..3ed8dfc 100644 --- a/doc/html/boost_typetraits/reference/has_divides.html +++ b/doc/html/boost_typetraits/reference/has_divides.html @@ -113,66 +113,82 @@

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<Lhs> - 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<A>::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<A>::value; // this is fine
    -boost::has_divides<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator/ - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_divides.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_divides.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_divides cannot + perform introspection of the template function body to ensure that the type + meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_divides.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator/(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T> operator / (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_divides< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g/g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_divides< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b/b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_divides< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_divides< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A operator / (const A&); };
    +boost::has_divides<A>::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 { };
    +A operator / (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_divides<A>::value; // this is fine
    +boost::has_divides<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_divides_assign.html b/doc/html/boost_typetraits/reference/has_divides_assign.html index b843a3f..487d5eb 100644 --- a/doc/html/boost_typetraits/reference/has_divides_assign.html +++ b/doc/html/boost_typetraits/reference/has_divides_assign.html @@ -113,68 +113,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_divides_assign<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator/= - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_divides_assign.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_divides_assign.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_divides_assign + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_divides_assign.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator/=(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T>& operator /= (contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_divides_assign< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g/=g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_divides_assign< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b/=b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_divides_assign< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_divides_assign< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A& operator /= (const A&); };
    +boost::has_divides_assign<A>::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 { };
    +A& operator /= (A&, const A&);
    +struct B { operator A(); };
    +boost::has_divides_assign<A>::value; // this is fine
    +boost::has_divides_assign<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_equal_to.html b/doc/html/boost_typetraits/reference/has_equal_to.html index 5afe3de..afade4b 100644 --- a/doc/html/boost_typetraits/reference/has_equal_to.html +++ b/doc/html/boost_typetraits/reference/has_equal_to.html @@ -112,68 +112,82 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_equal_to<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator== - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_equal_to.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_equal_to.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_equal_to cannot + perform introspection of the template function body to ensure that the type + meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_equal_to.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator==(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +bool operator == (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_equal_to< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g==g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_equal_to< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b==b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_equal_to< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_equal_to< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: bool operator == (const A&); };
    +boost::has_equal_to<A>::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 { };
    +bool operator == (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_equal_to<A>::value; // this is fine
    +boost::has_equal_to<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_greater.html b/doc/html/boost_typetraits/reference/has_greater.html index ac426f6..2c15928 100644 --- a/doc/html/boost_typetraits/reference/has_greater.html +++ b/doc/html/boost_typetraits/reference/has_greater.html @@ -112,68 +112,82 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_greater<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator> - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_greater.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_greater.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_greater cannot + perform introspection of the template function body to ensure that the type + meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_greater.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator>(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +bool operator > (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_greater< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g>g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_greater< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b>b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_greater< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_greater< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: bool operator > (const A&); };
    +boost::has_greater<A>::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 { };
    +bool operator > (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_greater<A>::value; // this is fine
    +boost::has_greater<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_greater_equal.html b/doc/html/boost_typetraits/reference/has_greater_equal.html index 1a1621a..f3e86a1 100644 --- a/doc/html/boost_typetraits/reference/has_greater_equal.html +++ b/doc/html/boost_typetraits/reference/has_greater_equal.html @@ -112,68 +112,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_greater_equal<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator>= - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_greater_equal.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_greater_equal.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_greater_equal + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_greater_equal.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator>=(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +bool operator >= (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_greater_equal< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g>=g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_greater_equal< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b>=b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_greater_equal< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_greater_equal< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: bool operator >= (const A&); };
    +boost::has_greater_equal<A>::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 { };
    +bool operator >= (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_greater_equal<A>::value; // this is fine
    +boost::has_greater_equal<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_left_shift.html b/doc/html/boost_typetraits/reference/has_left_shift.html index 83166b3..796bf15 100644 --- a/doc/html/boost_typetraits/reference/has_left_shift.html +++ b/doc/html/boost_typetraits/reference/has_left_shift.html @@ -119,68 +119,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_left_shift<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator<< - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_left_shift.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_left_shift.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_left_shift + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_left_shift.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator<<(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T> operator << (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_left_shift< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g<<g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_left_shift< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b<<b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_left_shift< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_left_shift< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A operator << (const A&); };
    +boost::has_left_shift<A>::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 { };
    +A operator << (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_left_shift<A>::value; // this is fine
    +boost::has_left_shift<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_left_shift_assign.html b/doc/html/boost_typetraits/reference/has_left_shift_assign.html index 7ff5107..d7ab64f 100644 --- a/doc/html/boost_typetraits/reference/has_left_shift_assign.html +++ b/doc/html/boost_typetraits/reference/has_left_shift_assign.html @@ -107,68 +107,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_left_shift_assign<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator<<= - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_left_shift_assign.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_left_shift_assign.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_left_shift_assign + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_left_shift_assign.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator<<=(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T>& operator <<= (contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_left_shift_assign< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g<<=g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_left_shift_assign< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b<<=b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_left_shift_assign< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_left_shift_assign< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> + 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: A& operator <<= (const A&); };
    +boost::has_left_shift_assign<A>::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 { };
    +A& operator <<= (A&, const A&);
    +struct B { operator A(); };
    +boost::has_left_shift_assign<A>::value; // this is fine
    +boost::has_left_shift_assign<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_less.html b/doc/html/boost_typetraits/reference/has_less.html index 9bf9414..21a0089 100644 --- a/doc/html/boost_typetraits/reference/has_less.html +++ b/doc/html/boost_typetraits/reference/has_less.html @@ -112,68 +112,82 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_less<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator< - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_less.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_less.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_less cannot + perform introspection of the template function body to ensure that the type + meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_less.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator<(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +bool operator < (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_less< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g<g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_less< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b<b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_less< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_less< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: bool operator < (const A&); };
    +boost::has_less<A>::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 { };
    +bool operator < (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_less<A>::value; // this is fine
    +boost::has_less<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_less_equal.html b/doc/html/boost_typetraits/reference/has_less_equal.html index 7c7cb81..011a498 100644 --- a/doc/html/boost_typetraits/reference/has_less_equal.html +++ b/doc/html/boost_typetraits/reference/has_less_equal.html @@ -112,68 +112,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_less_equal<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator<= - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_less_equal.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_less_equal.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_less_equal + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_less_equal.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator<=(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +bool operator <= (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_less_equal< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g<=g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_less_equal< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b<=b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_less_equal< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_less_equal< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: bool operator <= (const A&); };
    +boost::has_less_equal<A>::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 { };
    +bool operator <= (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_less_equal<A>::value; // this is fine
    +boost::has_less_equal<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_logical_and.html b/doc/html/boost_typetraits/reference/has_logical_and.html index fc71cd5..8c0a310 100644 --- a/doc/html/boost_typetraits/reference/has_logical_and.html +++ b/doc/html/boost_typetraits/reference/has_logical_and.html @@ -110,68 +110,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_logical_and<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator&& - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_logical_and.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_logical_and.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_logical_and + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_logical_and.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator&&(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +bool operator && (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_logical_and< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g&&g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_logical_and< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b&&b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_logical_and< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_logical_and< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: bool operator && (const A&); };
    +boost::has_logical_and<A>::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 { };
    +bool operator && (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_logical_and<A>::value; // this is fine
    +boost::has_logical_and<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_logical_or.html b/doc/html/boost_typetraits/reference/has_logical_or.html index 2196395..94e9f83 100644 --- a/doc/html/boost_typetraits/reference/has_logical_or.html +++ b/doc/html/boost_typetraits/reference/has_logical_or.html @@ -110,68 +110,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_logical_or<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator|| - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_logical_or.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_logical_or.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_logical_or + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_logical_or.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator||(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +bool operator || (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_logical_or< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g||g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_logical_or< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b||b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_logical_or< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_logical_or< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: bool operator || (const A&); };
    +boost::has_logical_or<A>::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 { };
    +bool operator || (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_logical_or<A>::value; // this is fine
    +boost::has_logical_or<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_minus.html b/doc/html/boost_typetraits/reference/has_minus.html index db0b1a9..92bffb4 100644 --- a/doc/html/boost_typetraits/reference/has_minus.html +++ b/doc/html/boost_typetraits/reference/has_minus.html @@ -113,66 +113,82 @@

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<Lhs> - 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<A>::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<A>::value; // this is fine
    -boost::has_minus<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator- - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_minus.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_minus.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_minus cannot + perform introspection of the template function body to ensure that the type + meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_minus.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator-(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T> operator - (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_minus< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g-g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_minus< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b-b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_minus< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_minus< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A operator - (const A&); };
    +boost::has_minus<A>::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 { };
    +A operator - (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_minus<A>::value; // this is fine
    +boost::has_minus<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_minus_assign.html b/doc/html/boost_typetraits/reference/has_minus_assign.html index f78699d..e90a42e 100644 --- a/doc/html/boost_typetraits/reference/has_minus_assign.html +++ b/doc/html/boost_typetraits/reference/has_minus_assign.html @@ -113,68 +113,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_minus_assign<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator-= - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_minus_assign.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_minus_assign.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_minus_assign + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_minus_assign.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator-=(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T>& operator -= (contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_minus_assign< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g-=g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_minus_assign< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b-=b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_minus_assign< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_minus_assign< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A& operator -= (const A&); };
    +boost::has_minus_assign<A>::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 { };
    +A& operator -= (A&, const A&);
    +struct B { operator A(); };
    +boost::has_minus_assign<A>::value; // this is fine
    +boost::has_minus_assign<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_modulus.html b/doc/html/boost_typetraits/reference/has_modulus.html index 3a9a322..d6c44c3 100644 --- a/doc/html/boost_typetraits/reference/has_modulus.html +++ b/doc/html/boost_typetraits/reference/has_modulus.html @@ -106,66 +106,82 @@

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<Lhs> - 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<A>::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<A>::value; // this is fine
    -boost::has_modulus<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator% - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_modulus.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_modulus.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_modulus cannot + perform introspection of the template function body to ensure that the type + meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_modulus.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator%(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T> operator % (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_modulus< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g%g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_modulus< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b%b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_modulus< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_modulus< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A operator % (const A&); };
    +boost::has_modulus<A>::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 { };
    +A operator % (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_modulus<A>::value; // this is fine
    +boost::has_modulus<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_modulus_assign.html b/doc/html/boost_typetraits/reference/has_modulus_assign.html index 0468489..23fbe63 100644 --- a/doc/html/boost_typetraits/reference/has_modulus_assign.html +++ b/doc/html/boost_typetraits/reference/has_modulus_assign.html @@ -106,68 +106,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_modulus_assign<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator%= - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_modulus_assign.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_modulus_assign.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_modulus_assign + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_modulus_assign.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator%=(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T>& operator %= (contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_modulus_assign< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g%=g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_modulus_assign< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b%=b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_modulus_assign< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_modulus_assign< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A& operator %= (const A&); };
    +boost::has_modulus_assign<A>::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 { };
    +A& operator %= (A&, const A&);
    +struct B { operator A(); };
    +boost::has_modulus_assign<A>::value; // this is fine
    +boost::has_modulus_assign<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_multiplies.html b/doc/html/boost_typetraits/reference/has_multiplies.html index 456f941..2219f67 100644 --- a/doc/html/boost_typetraits/reference/has_multiplies.html +++ b/doc/html/boost_typetraits/reference/has_multiplies.html @@ -113,66 +113,81 @@

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<Lhs> - 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<A>::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<A>::value; // this is fine
    -boost::has_multiplies<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator* - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_multiplies.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_multiplies.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_multiplies + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_multiplies.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator*(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T> operator * (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_multiplies< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g*g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_multiplies< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b*b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_multiplies< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_multiplies< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A operator * (const A&); };
    +boost::has_multiplies<A>::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 { };
    +A operator * (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_multiplies<A>::value; // this is fine
    +boost::has_multiplies<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_multiplies_assign.html b/doc/html/boost_typetraits/reference/has_multiplies_assign.html index 8089c33..69b4b2e 100644 --- a/doc/html/boost_typetraits/reference/has_multiplies_assign.html +++ b/doc/html/boost_typetraits/reference/has_multiplies_assign.html @@ -113,68 +113,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_multiplies_assign<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator*= - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_multiplies_assign.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_multiplies_assign.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_multiplies_assign + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_multiplies_assign.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator*=(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T>& operator *= (contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_multiplies_assign< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g*=g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_multiplies_assign< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b*=b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_multiplies_assign< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_multiplies_assign< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> + 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: A& operator *= (const A&); };
    +boost::has_multiplies_assign<A>::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 { };
    +A& operator *= (A&, const A&);
    +struct B { operator A(); };
    +boost::has_multiplies_assign<A>::value; // this is fine
    +boost::has_multiplies_assign<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_not_equal_to.html b/doc/html/boost_typetraits/reference/has_not_equal_to.html index 60ec945..09b4370 100644 --- a/doc/html/boost_typetraits/reference/has_not_equal_to.html +++ b/doc/html/boost_typetraits/reference/has_not_equal_to.html @@ -112,68 +112,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_not_equal_to<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator!= - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_not_equal_to.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_not_equal_to.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_not_equal_to + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_not_equal_to.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator!=(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +bool operator != (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_not_equal_to< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g!=g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_not_equal_to< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b!=b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_not_equal_to< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_not_equal_to< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: bool operator != (const A&); };
    +boost::has_not_equal_to<A>::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 { };
    +bool operator != (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_not_equal_to<A>::value; // this is fine
    +boost::has_not_equal_to<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_plus.html b/doc/html/boost_typetraits/reference/has_plus.html index 946261d..3af7c65 100644 --- a/doc/html/boost_typetraits/reference/has_plus.html +++ b/doc/html/boost_typetraits/reference/has_plus.html @@ -113,66 +113,82 @@

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<Lhs> - 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<A>::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<A>::value; // this is fine
    -boost::has_plus<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator+ - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_plus.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_plus.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_plus cannot + perform introspection of the template function body to ensure that the type + meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_plus.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator+(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T> operator + (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_plus< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g+g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_plus< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b+b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_plus< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_plus< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A operator + (const A&); };
    +boost::has_plus<A>::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 { };
    +A operator + (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_plus<A>::value; // this is fine
    +boost::has_plus<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_plus_assign.html b/doc/html/boost_typetraits/reference/has_plus_assign.html index d47688d..8148d20 100644 --- a/doc/html/boost_typetraits/reference/has_plus_assign.html +++ b/doc/html/boost_typetraits/reference/has_plus_assign.html @@ -113,68 +113,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_plus_assign<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator+= - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_plus_assign.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_plus_assign.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_plus_assign + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_plus_assign.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator+=(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T>& operator += (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_plus_assign< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g+=g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_plus_assign< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b+=b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_plus_assign< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_plus_assign< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A& operator += (const A&); };
    +boost::has_plus_assign<A>::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 { };
    +A& operator += (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_plus_assign<A>::value; // this is fine
    +boost::has_plus_assign<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_right_shift.html b/doc/html/boost_typetraits/reference/has_right_shift.html index 9961fff..5b6ef96 100644 --- a/doc/html/boost_typetraits/reference/has_right_shift.html +++ b/doc/html/boost_typetraits/reference/has_right_shift.html @@ -119,68 +119,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_right_shift<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator>> - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_right_shift.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_right_shift.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_right_shift + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_right_shift.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator>>(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T> operator >> (const contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_right_shift< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g>>g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_right_shift< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b>>b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_right_shift< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_right_shift< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> 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: A operator >> (const A&); };
    +boost::has_right_shift<A>::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 { };
    +A operator >> (const A&, const A&);
    +struct B { operator A(); };
    +boost::has_right_shift<A>::value; // this is fine
    +boost::has_right_shift<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/boost_typetraits/reference/has_right_shift_assign.html b/doc/html/boost_typetraits/reference/has_right_shift_assign.html index fceeead..1e80680 100644 --- a/doc/html/boost_typetraits/reference/has_right_shift_assign.html +++ b/doc/html/boost_typetraits/reference/has_right_shift_assign.html @@ -111,68 +111,81 @@

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<Lhs> 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<A>::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<A>::value; // this is fine
    -boost::has_right_shift_assign<B>::value; // error: ambiguous overload
    -
    -
  • -
  • - There is an issue when applying this trait to template classes. If operator>>= - is defined but does not bind for a given template type, it is still detected - by the trait which returns true - instead of false. Example: -
    #include <boost/type_traits/has_right_shift_assign.hpp>
    +

    + For modern compilers (those that support arbitrary SFINAE-expressions and + decltype/declval) this trait offers near perfect detection. In this situation + the macro BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + will be defined after including <boost/type_traits/has_right_shift_assign.hpp>. + Please note however, that detection is based on function signature only, + in the case that the operator is a function template then has_right_shift_assign + cannot perform introspection of the template function body to ensure that + the type meets all of the conceptual requirements of the actual code. +

    +

    + Example: +

    +
    #include <boost/type_traits/has_right_shift_assign.hpp>
     #include <iostream>
     
     template <class T>
    -struct contains { T data; };
    +struct contains
    +{
    +   T data;
    +   contains(const T& d) : data(d) {}
    +};
     
     template <class T>
    -bool operator>>=(const contains<T> &lhs, const contains<T> &rhs) {
    -	return f(lhs.data, rhs.data);
    +contains<T>& operator >>= (contains<T> &lhs, const contains<T> &rhs) {
    +    return f(lhs.data, rhs.data);
     }
     
     class bad { };
     class good { };
    -bool f(const good&, const good&) { }
    +good f(const good&, const good&) { return /*something*/; }
     
     int main() {
    -	std::cout<<std::boolalpha;
    -	// works fine for contains<good>
    -	std::cout<<boost::has_right_shift_assign< contains< good > >::value<<'\n'; // true
    -	contains<good> g;
    -	g>>=g; // ok
    -	// does not work for contains<bad>
    -	std::cout<<boost::has_right_shift_assign< contains< bad > >::value<<'\n'; // true, should be false
    -	contains<bad> b;
    -	b>>=b; // compile time error
    -	return 0;
    +    std::cout<<std::boolalpha;
    +    // works fine for contains<good>
    +    std::cout<<boost::has_right_shift_assign< contains< good > >::value<<'\n'; // true
    +    contains<good> g;
    +    g&g; // ok
    +    // does not work for contains<bad>
    +    std::cout<<boost::has_right_shift_assign< contains< bad > >::value<<'\n'; // true, should be false
    +    contains<bad> b;
    +    b&b; // compile time error
    +    return 0;
     }
     
    -
  • -
  • +

    + For older compilers (BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION + not defined) then there are a number of 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<Lhs> + 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: A& operator >>= (const A&); };
    +boost::has_right_shift_assign<A>::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 { };
    +A& operator >>= (A&, const A&);
    +struct B { operator A(); };
    +boost::has_right_shift_assign<A>::value; // this is fine
    +boost::has_right_shift_assign<B>::value; // error: ambiguous overload
    +
    +
    • volatile qualifier is not properly handled and would lead to undefined behavior -
    • -
    +
diff --git a/doc/html/index/s11.html b/doc/html/index/s11.html index 3007515..67d11a8 100644 --- a/doc/html/index/s11.html +++ b/doc/html/index/s11.html @@ -24,7 +24,7 @@

-Class Index

+Class Index

A C D E F H I M N O P R T

F R T V

diff --git a/doc/html/index/s13.html b/doc/html/index/s13.html index a8db2be..bccba63 100644 --- a/doc/html/index/s13.html +++ b/doc/html/index/s13.html @@ -24,7 +24,7 @@

-Macro Index

+Macro Index

B

@@ -164,6 +164,39 @@
  • +

    BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION

    + +
  • +
  • BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION

  • diff --git a/doc/html/index/s14.html b/doc/html/index/s14.html index 6727001..7fc3df5 100644 --- a/doc/html/index/s14.html +++ b/doc/html/index/s14.html @@ -23,7 +23,7 @@

    -Index

    +Index

    A B C D E F H I M N O P R T U V

    @@ -195,6 +195,39 @@
  • +

    BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION

    + +
  • +
  • BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION

  • @@ -308,49 +341,49 @@
  • has_bit_and

  • has_bit_and_assign

  • has_bit_or

  • has_bit_or_assign

  • has_bit_xor

  • has_bit_xor_assign

  • @@ -372,82 +405,82 @@
  • has_divides

  • has_divides_assign

  • has_equal_to

  • has_greater

  • has_greater_equal

  • has_left_shift

  • has_left_shift_assign

  • has_less

  • has_less_equal

  • has_logical_and

  • @@ -461,57 +494,57 @@
  • has_logical_or

  • has_minus

  • has_minus_assign

  • has_modulus

  • has_modulus_assign

  • has_multiplies

  • has_multiplies_assign

  • @@ -558,9 +591,9 @@
  • has_not_equal_to

  • @@ -570,17 +603,17 @@
  • has_plus

  • has_plus_assign

  • @@ -618,17 +651,17 @@
  • has_right_shift

  • has_right_shift_assign

  • @@ -982,42 +1015,14 @@
  • trait