diff --git a/doc/html/declval.html b/doc/html/declval.html index 43dd657..305cf36 100644 --- a/doc/html/declval.html +++ b/doc/html/declval.html @@ -3,7 +3,7 @@ Declval - + @@ -31,9 +31,10 @@
-
+
-

+

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

@@ -43,7 +44,7 @@

Table of Contents

-
+
Overview
Reference
History
@@ -66,13 +67,13 @@ in a non-using context, e.g. given the declaration

template<class T>
-T&& declval(); // not used
-
+T&& declval(); // not used +

as part of the function template declaration

template<class To, class From>
-decltype(static_cast<To>(declval<From>())) convert(From&&);
+decltype(static_cast<To>(declval<From>())) convert(From&&);
 

or as part of a class template definition @@ -80,9 +81,9 @@

template<class> class result_of;
 
 template<class Fn, class... ArgTypes>
-struct result_of<Fn(ArgTypes...)> 
+struct result_of<Fn(ArgTypes...)>
 {
-  typedef decltype(declval<Fn>()(declval<ArgTypes>()...)) type;
+  typedef decltype(declval<Fn>()(declval<ArgTypes>()...)) type;
 };
 

@@ -94,8 +95,8 @@ to

template<class T>
-typename std::add_rvalue_reference<T>::type declval(); // not used
-
+typename std::add_rvalue_reference<T>::type declval(); // not used +

which ensures that we can also use cv void as template parameter. The careful reader might have noticed that declval() already exists under the name create() as @@ -119,10 +120,10 @@

namespace boost {
 
     template <typename T>
-    typename add_rvalue_reference<T>::type declval() noexcept; // as unevaluated operand
-
-}  // namespace boost
-
+ typename add_rvalue_reference<T>::type declval() noexcept; // as unevaluated operand + +} // namespace boost +

The library provides the function template declval to simplify the definition of expressions which occur as unevaluated operands. @@ -142,7 +143,7 @@ Example:

template <class To, class From>
-decltype(static_cast<To>(declval<From>())) convert(From&&);
+decltype(static_cast<To>(declval<From>())) convert(From&&);
 

Declares a function template convert which only participates in overloading @@ -153,21 +154,22 @@

-

- - boost 1.50 +

+ + boost + 1.50

Fixes:

-
  • +
    • #6570 Adding noexcept to boost::declval.
- +

Last revised: May 28, 2012 at 18:59:06 GMT

Last revised: November 23, 2013 at 14:11:12 GMT


diff --git a/doc/html/explicit_operator_bool.html b/doc/html/explicit_operator_bool.html new file mode 100644 index 0000000..78a844f --- /dev/null +++ b/doc/html/explicit_operator_bool.html @@ -0,0 +1,115 @@ + + + +BOOST_EXPLICIT_OPERATOR_BOOL and BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+
+
+
+

+BOOST_EXPLICIT_OPERATOR_BOOL and BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL

+

+Andrey Semashev +

+
+
+

+ Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +

+
+
+
+
+
+

Table of Contents

+
+
Overview
+
Examples
+
History
+
+
+
+ +

+ BOOST_EXPLICIT_OPERATOR_BOOL() and BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL() are compatibility helper macros that expand + to an explicit conversion operator to bool. + For compilers not supporting explicit conversion operators introduced in C++11 + the macros expand to a conversion operator that implements the safe + bool idiom. In case if the compiler is not able to handle safe bool + idiom well the macros expand to a regular conversion operator to bool. +

+
+
+ +

+ Both macros are intended to be placed within a user's class definition. The + generated conversion operators will be implemented in terms of operator!() + that should be defined by user in this class. In case of BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL() the generated conversion operator will be + declared constexpr which requires + the corresponding operator!() + to also be constexpr. +

+
template< typename T >
+class my_ptr
+{
+    T* m_p;
+
+public:
+    BOOST_EXPLICIT_OPERATOR_BOOL()
+
+    bool operator!() const
+    {
+        return !m_p;
+    }
+};
+
+

+ Now my_ptr can be used in conditional + expressions, similarly to a regular pointer: +

+
my_ptr< int > p;
+if (p)
+    std::cout << "true" << std::endl;
+
+
+
+ +

+ + boost + 1.55 +

+
  • + The macro was extracted from Boost.Log. +
+
+
+ + + +

Last revised: November 17, 2013 at 17:08:52 GMT

+
+
+ + diff --git a/doc/html/string_ref.html b/doc/html/string_ref.html index 3b6ae8d..3352614 100644 --- a/doc/html/string_ref.html +++ b/doc/html/string_ref.html @@ -3,7 +3,7 @@ String_Ref - + @@ -37,7 +37,7 @@

Table of Contents

-
+
Overview
Examples
Reference
@@ -262,16 +262,16 @@

- boost + boost 1.53

-
- +

Last revised: October 27, 2013 at 21:01:34 GMT

Last revised: November 23, 2013 at 14:12:56 GMT


diff --git a/enable_if.html b/enable_if.html index 8ea33bb..9988f3a 100644 --- a/enable_if.html +++ b/enable_if.html @@ -201,7 +201,7 @@ extra template parameter. -

3.1  Enabling function templates in C++0x

+

3.1  Enabling function templates in C++0x

In a compiler which supports C++0x default arguments for function template parameters, you can enable and disable function templates by adding an additional template parameter. This approach @@ -416,7 +416,7 @@ subscript operators). -

4  Acknowledgements

+

4  Acknowledgements

We are grateful to Howard Hinnant, Jason Shirk, Paul Mensonides, and Richard Smith whose findings have influenced the library.
diff --git a/index.html b/index.html index 41c8c15..98c82f1 100644 --- a/index.html +++ b/index.html @@ -35,8 +35,8 @@ throw_exception
utility
string_ref
- value_init - BOOST_EXPLICIT_OPERATOR_BOOL and BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL
+ value_init
+ BOOST_EXPLICIT_OPERATOR_BOOL and BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL