Compare commits

...

38 Commits

Author SHA1 Message Date
8cb4972256 Add, and update, documentation build targets. 2016-10-10 11:39:51 -05:00
addbcdb81a Merge changes from develop for the 1.58.0 release 2015-04-01 10:30:54 -07:00
b3adfec7ff Merge pull request #2 from apolukhin/develop
C++11 updates for tribool: added noexcepts and constexprs, fixed warnings

Tested on Linux with gcc-4.9.1.
2014-11-02 15:44:13 -07:00
1e220fccf3 Merge pull request #3 from danieljames/metadata
Create metadata file.
2014-09-01 20:33:52 -06:00
6e391684a9 Add metadata file. 2014-08-18 15:00:59 +01:00
e1f476eaba Docs update 2014-07-31 18:11:11 +04:00
bf0907a227 C++11 updates for tribool: added noexcepts and constexprs, fixed warnings 2014-07-31 00:54:51 +04:00
1dab9cd10a Merge pull request #1 from boostorg/develop
Merge to master.
2014-05-16 08:40:43 -06:00
2afd1a9ec6 Create merge base for git. 2014-04-06 14:12:46 +01:00
95baf1910a Logic: Remove obsolete MSVC version check.
[SVN r86041]
2013-09-30 00:22:10 +00:00
9f9a1e7656 Remove obsolete MSVC check from pragma guard
git grep -h -B1 "^#\s*pragma once" | grep -v pragma | sort | uniq

is now clean.

[SVN r85952]
2013-09-26 13:02:51 +00:00
aede53315c Merge root index file, and logic redirect.
[SVN r72210]
2011-05-27 11:53:52 +00:00
31af87e6ae Tribool: add a redirect to the docs.
[SVN r71603]
2011-04-29 11:03:48 +00:00
5ad06c7370 Logic: merge old warning fixes.
- [53429] Fix `gcc -Wshadow` warnings. Fixes #3093.
- [58007] Remove unused parameter. Fixes #3600.


[SVN r70520]
2011-03-24 20:55:46 +00:00
c053ade60f Merge documentation fixes.
* Use `doc/src/*.css` instead of `doc/html/*.css`.
* Remove wiki and people directories.
* Some documentation fixes.
* Left out `minimal.css` changes and boostbook changes because of clashes.


[SVN r63347]
2010-06-26 12:30:09 +00:00
9c4577cce3 Detab some jamfiles.
[SVN r63343]
2010-06-26 12:10:47 +00:00
9e230b17ef Update various libraries' documentation build.
Mostly to use the images and css files under doc/src instead of
doc/html, usually be deleting the settings in order to use the defaults.
Also add 'boost.root' to some builds in order to fix links which rely on
it.

[SVN r63146]
2010-06-20 18:00:48 +00:00
62e9529e09 Removed unused parameter; fixes #3600
[SVN r58007]
2009-11-28 17:05:54 +00:00
6c6cc7dce3 rm cmake from trunk. I'm not entirely sure this is necessary to satisfy the inspect script, but I'm not taking any chances, and it is easy to put back
[SVN r56942]
2009-10-17 02:07:38 +00:00
b86917fe43 rm cmake from the release branch before it goes out broken. Policy dictates that you never commit to release, you commit to trunk and merge to release.
[SVN r56941]
2009-10-17 01:10:45 +00:00
987080a8c7 Fix up logic and date_time Jamfiles so they build needed dependencies.
Fix PDF image paths in fusion Jamfile.v2.
Add fusion to the PDF build.

[SVN r55757]
2009-08-24 10:31:43 +00:00
5aaba307a6 Add depencies on doxygen documentation to standalone documentation targets.
This seems to be needed for building pdfs.

[SVN r55729]
2009-08-23 10:07:25 +00:00
a582587b22 Copyrights on CMakeLists.txt to keep them from clogging up the inspect
reports.  This is essentially the same commit as r55095 on the release
branch.



[SVN r55159]
2009-07-26 00:49:56 +00:00
bd737d03b0 Add basic copyright/license to keep cmake out of the inspection report
[SVN r55095]
2009-07-22 21:51:01 +00:00
246d1ee6df Fix gcc -Wshadow warnings in tribool.
Fixes #3093. 1/2 of the patch provided by Dustin Spicuzza.


[SVN r53429]
2009-05-30 06:36:18 +00:00
58cd700623 Merge PDF build changes from Trunk.
[SVN r51417]
2009-02-23 18:39:32 +00:00
233cfca75c Add PDF generation options to fix external links to point to the web site.
Added a few more Boostbook based libs that were missed first time around.
Fixed PDF naming issues.

[SVN r51284]
2009-02-17 10:05:58 +00:00
951486c794 merge of cmake build files from trunk per beman
[SVN r50756]
2009-01-24 18:57:20 +00:00
44aa483237 Updating dependency information for modularized libraries.
[SVN r49628]
2008-11-07 17:05:27 +00:00
84313760a5 Updating CMake files to latest trunk. Added dependency information for regression tests and a few new macros for internal use.
[SVN r49627]
2008-11-07 17:02:56 +00:00
9df9f3daf6 Continuing merge of CMake build system files into trunk with the encouragement of Doug Gregor
[SVN r49510]
2008-11-01 13:15:41 +00:00
f1d8f513bf Merged from trunk
[SVN r42973]
2008-01-25 21:18:27 +00:00
9db33f9dcf Full merge from trunk at revision 41356 of entire boost-root tree.
[SVN r41370]
2007-11-25 18:38:02 +00:00
02caed268b Full merge from trunk at revision 41356 of entire boost-root tree.
[SVN r41369]
2007-11-25 18:07:19 +00:00
5749fb9ef1 Starting point for releases
[SVN r39706]
2007-10-05 14:25:06 +00:00
03a2600bf5 This commit was manufactured by cvs2svn to create tag
'Version_1_34_1'.

[SVN r38286]
2007-07-24 19:28:14 +00:00
9e9489c7bd Remove obsolete Boost.Build v1 files.
[SVN r35880]
2006-11-06 17:10:46 +00:00
73cce598c7 This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r33417]
2006-03-21 02:26:31 +00:00
7 changed files with 144 additions and 63 deletions

View File

@ -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 ;
@ -6,4 +16,21 @@ doxygen reference : [ glob ../../../boost/logic/tribool.hpp ]
[ glob ../../../boost/logic/tribool_fwd.hpp ]
[ glob ../../../boost/logic/tribool_io.hpp ]
;
boostbook tribool : tribool.boostbook ;
boostbook tribool
:
tribool.boostbook
:
<xsl:param>boost.root=../../../..
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html
<dependency>reference
;
###############################################################################
alias boostdoc
: tribool/<format>docbook
:
:
: ;
explicit boostdoc ;
alias boostrelease ;
explicit boostrelease ;

View File

@ -138,6 +138,18 @@ if (<functionname>indeterminate</functionname>(x)) {
else {
// report success or failure of x
}</programlisting>
<para> All the logical operators and methods of <code><classname>tribool</classname></code> are marked
as <code>constexpr</code> in C++11. It means that <code><classname>tribool</classname></code> can
be used in compile time expressions:</para>
<programlisting>constexpr <classname>tribool</classname> x = (tribool(true) || tribool(indeterminate));
<functionname>static_assert</functionname>(x, "Must be true!");
</programlisting>
<note>Some compilers may have troubles with evaluating <code>tribool::operator safe_bool()</code> at compile time.</note>
</section>
<section>

View File

@ -14,7 +14,7 @@
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#if BOOST_WORKAROUND(_MSC_VER, >= 1200)
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
@ -59,9 +59,9 @@ typedef bool (*indeterminate_keyword_t)(tribool, detail::indeterminate_t);
* \returns <tt>x.value == tribool::indeterminate_value</tt>
* \throws nothrow
*/
inline bool
BOOST_CONSTEXPR inline bool
indeterminate(tribool x,
detail::indeterminate_t dummy = detail::indeterminate_t());
detail::indeterminate_t dummy = detail::indeterminate_t()) BOOST_NOEXCEPT;
/**
* \brief A 3-state boolean type.
@ -85,7 +85,7 @@ public:
*
* \throws nothrow
*/
tribool() : value(false_value) {}
BOOST_CONSTEXPR tribool() BOOST_NOEXCEPT : value(false_value) {}
/**
* Construct a new 3-state boolean value with the given boolean
@ -93,14 +93,14 @@ public:
*
* \throws nothrow
*/
tribool(bool value) : value(value? true_value : false_value) {}
BOOST_CONSTEXPR tribool(bool initial_value) BOOST_NOEXCEPT : value(initial_value? true_value : false_value) {}
/**
* Construct a new 3-state boolean value with an indeterminate value.
*
* \throws nothrow
*/
tribool(indeterminate_keyword_t) : value(indeterminate_value) {}
BOOST_CONSTEXPR tribool(indeterminate_keyword_t) BOOST_NOEXCEPT : value(indeterminate_value) {}
/**
* Use a 3-state boolean in a boolean context. Will evaluate true in a
@ -109,7 +109,7 @@ public:
* \returns true if the 3-state boolean is true, false otherwise
* \throws nothrow
*/
operator safe_bool() const
BOOST_CONSTEXPR operator safe_bool() const BOOST_NOEXCEPT
{
return value == true_value? &dummy::nonnull : 0;
}
@ -123,7 +123,7 @@ public:
// Check if the given tribool has an indeterminate value. Also doubles as a
// keyword for the 'indeterminate' value
inline bool indeterminate(tribool x, detail::indeterminate_t)
BOOST_CONSTEXPR inline bool indeterminate(tribool x, detail::indeterminate_t) BOOST_NOEXCEPT
{
return x.value == tribool::indeterminate_value;
}
@ -156,7 +156,7 @@ inline bool indeterminate(tribool x, detail::indeterminate_t)
* </table>
* \throws nothrow
*/
inline tribool operator!(tribool x)
BOOST_CONSTEXPR inline tribool operator!(tribool x) BOOST_NOEXCEPT
{
return x.value == tribool::false_value? tribool(true)
:x.value == tribool::true_value? tribool(false)
@ -196,38 +196,36 @@ inline tribool operator!(tribool x)
* </table>
* \throws nothrow
*/
inline tribool operator&&(tribool x, tribool y)
BOOST_CONSTEXPR inline tribool operator&&(tribool x, tribool y) BOOST_NOEXCEPT
{
if (static_cast<bool>(!x) || static_cast<bool>(!y))
return false;
else if (static_cast<bool>(x) && static_cast<bool>(y))
return true;
else
return indeterminate;
return (static_cast<bool>(!x) || static_cast<bool>(!y))
? tribool(false)
: ((static_cast<bool>(x) && static_cast<bool>(y)) ? tribool(true) : indeterminate)
;
}
/**
* \overload
*/
inline tribool operator&&(tribool x, bool y)
BOOST_CONSTEXPR inline tribool operator&&(tribool x, bool y) BOOST_NOEXCEPT
{ return y? x : tribool(false); }
/**
* \overload
*/
inline tribool operator&&(bool x, tribool y)
BOOST_CONSTEXPR inline tribool operator&&(bool x, tribool y) BOOST_NOEXCEPT
{ return x? y : tribool(false); }
/**
* \overload
*/
inline tribool operator&&(indeterminate_keyword_t, tribool x)
BOOST_CONSTEXPR inline tribool operator&&(indeterminate_keyword_t, tribool x) BOOST_NOEXCEPT
{ return !x? tribool(false) : tribool(indeterminate); }
/**
* \overload
*/
inline tribool operator&&(tribool x, indeterminate_keyword_t)
BOOST_CONSTEXPR inline tribool operator&&(tribool x, indeterminate_keyword_t) BOOST_NOEXCEPT
{ return !x? tribool(false) : tribool(indeterminate); }
/**
@ -263,38 +261,36 @@ inline tribool operator&&(tribool x, indeterminate_keyword_t)
* </table>
* \throws nothrow
*/
inline tribool operator||(tribool x, tribool y)
BOOST_CONSTEXPR inline tribool operator||(tribool x, tribool y) BOOST_NOEXCEPT
{
if (static_cast<bool>(!x) && static_cast<bool>(!y))
return false;
else if (static_cast<bool>(x) || static_cast<bool>(y))
return true;
else
return indeterminate;
return (static_cast<bool>(!x) && static_cast<bool>(!y))
? tribool(false)
: ((static_cast<bool>(x) || static_cast<bool>(y)) ? tribool(true) : tribool(indeterminate))
;
}
/**
* \overload
*/
inline tribool operator||(tribool x, bool y)
BOOST_CONSTEXPR inline tribool operator||(tribool x, bool y) BOOST_NOEXCEPT
{ return y? tribool(true) : x; }
/**
* \overload
*/
inline tribool operator||(bool x, tribool y)
BOOST_CONSTEXPR inline tribool operator||(bool x, tribool y) BOOST_NOEXCEPT
{ return x? tribool(true) : y; }
/**
* \overload
*/
inline tribool operator||(indeterminate_keyword_t, tribool x)
BOOST_CONSTEXPR inline tribool operator||(indeterminate_keyword_t, tribool x) BOOST_NOEXCEPT
{ return x? tribool(true) : tribool(indeterminate); }
/**
* \overload
*/
inline tribool operator||(tribool x, indeterminate_keyword_t)
BOOST_CONSTEXPR inline tribool operator||(tribool x, indeterminate_keyword_t) BOOST_NOEXCEPT
{ return x? tribool(true) : tribool(indeterminate); }
//@}
@ -331,34 +327,34 @@ inline tribool operator||(tribool x, indeterminate_keyword_t)
* </table>
* \throws nothrow
*/
inline tribool operator==(tribool x, tribool y)
BOOST_CONSTEXPR inline tribool operator==(tribool x, tribool y) BOOST_NOEXCEPT
{
if (indeterminate(x) || indeterminate(y))
return indeterminate;
else
return (x && y) || (!x && !y);
return (indeterminate(x) || indeterminate(y))
? indeterminate
: ((x && y) || (!x && !y))
;
}
/**
* \overload
*/
inline tribool operator==(tribool x, bool y) { return x == tribool(y); }
BOOST_CONSTEXPR inline tribool operator==(tribool x, bool y) BOOST_NOEXCEPT { return x == tribool(y); }
/**
* \overload
*/
inline tribool operator==(bool x, tribool y) { return tribool(x) == y; }
BOOST_CONSTEXPR inline tribool operator==(bool x, tribool y) BOOST_NOEXCEPT { return tribool(x) == y; }
/**
* \overload
*/
inline tribool operator==(indeterminate_keyword_t, tribool x)
BOOST_CONSTEXPR inline tribool operator==(indeterminate_keyword_t, tribool x) BOOST_NOEXCEPT
{ return tribool(indeterminate) == x; }
/**
* \overload
*/
inline tribool operator==(tribool x, indeterminate_keyword_t)
BOOST_CONSTEXPR inline tribool operator==(tribool x, indeterminate_keyword_t) BOOST_NOEXCEPT
{ return tribool(indeterminate) == x; }
/**
@ -394,34 +390,34 @@ inline tribool operator==(tribool x, indeterminate_keyword_t)
* </table>
* \throws nothrow
*/
inline tribool operator!=(tribool x, tribool y)
BOOST_CONSTEXPR inline tribool operator!=(tribool x, tribool y) BOOST_NOEXCEPT
{
if (indeterminate(x) || indeterminate(y))
return indeterminate;
else
return !((x && y) || (!x && !y));
return (indeterminate(x) || indeterminate(y))
? indeterminate
: !((x && y) || (!x && !y))
;
}
/**
* \overload
*/
inline tribool operator!=(tribool x, bool y) { return x != tribool(y); }
BOOST_CONSTEXPR inline tribool operator!=(tribool x, bool y) BOOST_NOEXCEPT { return x != tribool(y); }
/**
* \overload
*/
inline tribool operator!=(bool x, tribool y) { return tribool(x) != y; }
BOOST_CONSTEXPR inline tribool operator!=(bool x, tribool y) BOOST_NOEXCEPT { return tribool(x) != y; }
/**
* \overload
*/
inline tribool operator!=(indeterminate_keyword_t, tribool x)
BOOST_CONSTEXPR inline tribool operator!=(indeterminate_keyword_t, tribool x) BOOST_NOEXCEPT
{ return tribool(indeterminate) != x; }
/**
* \overload
*/
inline tribool operator!=(tribool x, indeterminate_keyword_t)
BOOST_CONSTEXPR inline tribool operator!=(tribool x, indeterminate_keyword_t) BOOST_NOEXCEPT
{ return x != tribool(indeterminate); }
} } // end namespace boost::logic
@ -452,7 +448,7 @@ namespace boost {
#define BOOST_TRIBOOL_THIRD_STATE(Name) \
inline bool \
Name(boost::logic::tribool x, \
boost::logic::detail::indeterminate_t dummy = \
boost::logic::detail::indeterminate_t = \
boost::logic::detail::indeterminate_t()) \
{ return x.value == boost::logic::tribool::indeterminate_value; }

View File

@ -11,7 +11,7 @@
#include <boost/detail/workaround.hpp>
#include <boost/noncopyable.hpp>
#if BOOST_WORKAROUND(_MSC_VER, >= 1200)
#if defined(_MSC_VER)
# pragma once
#endif
@ -104,17 +104,11 @@ template<>
inline std::basic_string<char> get_default_indeterminate_name<char>()
{ return "indeterminate"; }
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
// VC++ 6.0 chokes on the specialization below, so we're stuck without
// wchar_t support. What a pain. TODO: it might just need a the template
// parameter as function parameter...
#else
# ifndef BOOST_NO_WCHAR_T
#ifndef BOOST_NO_WCHAR_T
/// Returns the wide character string L"indeterminate".
template<>
inline std::basic_string<wchar_t> get_default_indeterminate_name<wchar_t>()
{ return L"indeterminate"; }
# endif
#endif
// http://www.cantrip.org/locale.html
@ -140,7 +134,8 @@ public:
indeterminate_name() : name_(get_default_indeterminate_name<CharT>()) {}
/// Construct the facet with the given name for the indeterminate value
explicit indeterminate_name(const string_type& name) : name_(name) {}
explicit indeterminate_name(const string_type& initial_name)
: name_(initial_name) {}
/// Returns the name for the indeterminate value
string_type name() const { return name_; }
@ -284,9 +279,9 @@ operator>>(std::basic_istream<CharT, Traits>& in, tribool& x)
bool falsename_ok = true, truename_ok = true, othername_ok = true;
// Modeled after the code from Library DR 17
while (falsename_ok && pos < falsename.size()
|| truename_ok && pos < truename.size()
|| othername_ok && pos < othername.size()) {
while ((falsename_ok && pos < falsename.size())
|| (truename_ok && pos < truename.size())
|| (othername_ok && pos < othername.size())) {
typename Traits::int_type c = in.get();
if (c == Traits::eof())
return in;

16
index.html Normal file
View File

@ -0,0 +1,16 @@
<!--
Copyright 2011 Daniel James.
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)
-->
<html>
<head>
<meta http-equiv="refresh" content="0; URL=../../doc/html/tribool.html">
</head>
<body>
Automatic redirection failed, please go to
<a href="../../doc/html/tribool.html">../../doc/html/tribool.html</a>
</body>
</html>

15
meta/libraries.json Normal file
View File

@ -0,0 +1,15 @@
{
"key": "logic/tribool",
"name": "Tribool",
"authors": [
"Doug Gregor"
],
"description": "3-state boolean type library.",
"documentation": "/doc/html/tribool.html",
"category": [
"Miscellaneous"
],
"maintainers": [
"Douglas Gregor <dgregor -at- cs.indiana.edu>"
]
}

View File

@ -114,6 +114,26 @@ int test_main(int, char*[])
BOOST_CHECK(false);
}
#ifndef BOOST_NO_CXX11_CONSTEXPR
constexpr bool res_ors = indeterminate(false || tribool(false) || false || indeterminate); // true
BOOST_CHECK(res_ors);
char array_ors[res_ors ? 2 : 3];
BOOST_CHECK(sizeof(array_ors) / sizeof(char) == 2);
constexpr bool res_ands = !indeterminate(!(true && tribool(true) && true && indeterminate)); // false
BOOST_CHECK(!res_ands);
char array_ands[res_ands ? 2 : 3];
BOOST_CHECK(sizeof(array_ands) / sizeof(char) == 3);
// We avoid checking the tribool::operator safe_bool(),
// because GCC-4.8 fails to evaluate it at compile-time.
// 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";
return 0;
}