diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 422ea5e..5088a46 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -1,3 +1,13 @@ +# Tribool library + +# Copyright (C) 2002-2003 Douglas Gregor + +# Use, modification and distribution is subject to 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) + +# For more information, see http://www.boost.org/ + project boost-sandbox/utility/doc ; import boostbook ; import doxygen ; diff --git a/doc/tribool.boostbook b/doc/tribool.boostbook index 1fa199a..80da397 100644 --- a/doc/tribool.boostbook +++ b/doc/tribool.boostbook @@ -138,6 +138,18 @@ if (indeterminate(x)) { else { // report success or failure of x } + + All the logical operators and methods of tribool are marked + as constexpr in C++11. It means that tribool can + be used in compile time expressions: + + constexpr tribool x = (tribool(true) || tribool(indeterminate)); +static_assert(x, "Must be true!"); + + + Some compilers may have troubles with evaluating tribool::operator safe_bool() at compile time. + +
diff --git a/test/tribool_test.cpp b/test/tribool_test.cpp index 716914c..be8fd18 100644 --- a/test/tribool_test.cpp +++ b/test/tribool_test.cpp @@ -130,6 +130,8 @@ int test_main(int, char*[]) // Clang compiles well. // // constexpr bool res_safe_bool = tribool(true); // false + // constexpr tribool xxx = (tribool(true) || tribool(indeterminate)); + // static_assert(xxx, "Must be true!"); #endif std::cout << "no errors detected\n";