From 4ea704e80a1a397c62ea01b47ed5faf6f5c699ce Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Fri, 22 Feb 2019 16:51:33 -0500 Subject: [PATCH] Add use_default to Core --- doc/core.qbk | 1 + doc/use_default.qbk | 47 ++++++++++++++++++++++++++++++ include/boost/core/use_default.hpp | 17 +++++++++++ test/Jamfile.v2 | 2 ++ test/use_default_test.cpp | 15 ++++++++++ 5 files changed, 82 insertions(+) create mode 100644 doc/use_default.qbk create mode 100644 include/boost/core/use_default.hpp create mode 100644 test/use_default_test.cpp diff --git a/doc/core.qbk b/doc/core.qbk index e381264..2a616b8 100644 --- a/doc/core.qbk +++ b/doc/core.qbk @@ -58,3 +58,4 @@ criteria for inclusion is that the utility component be: [include swap.qbk] [include typeinfo.qbk] [include uncaught_exceptions.qbk] +[include use_default.qbk] diff --git a/doc/use_default.qbk b/doc/use_default.qbk new file mode 100644 index 0000000..2149161 --- /dev/null +++ b/doc/use_default.qbk @@ -0,0 +1,47 @@ +[/ +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +] + +[section:use_default use_default] + +[section Overview] + +The header provides the type `boost::use_default` +which is used by other Boost libraries as a sentinel type in a templates to +indicate defaults. + +[endsect] + +[section Example] + +``` +template +class iterator_adaptor; + +template +class node_iterator + : public iterator_adaptor, Value*, + boost::use_default, boost::forward_traversal_tag>; +``` + +[endsect] + +[section Reference] + +``` +namespace boost { + struct use_default { }; +} +``` + +[endsect] + +[endsect] diff --git a/include/boost/core/use_default.hpp b/include/boost/core/use_default.hpp new file mode 100644 index 0000000..9d9be79 --- /dev/null +++ b/include/boost/core/use_default.hpp @@ -0,0 +1,17 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_CORE_USE_DEFAULT_HPP +#define BOOST_CORE_USE_DEFAULT_HPP + +namespace boost { + +struct use_default { }; + +} /* boost */ + +#endif diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 320b0c7..29a5b2d 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -133,6 +133,8 @@ run empty_value_final_test.cpp ; run quick_exit_test.cpp ; run-fail quick_exit_fail.cpp ; +compile use_default_test.cpp ; + lib lib_typeid : lib_typeid.cpp : shared:LIB_TYPEID_DYN_LINK=1 ; run test_lib_typeid.cpp lib_typeid : : : shared : test_lib_typeid_shared ; diff --git a/test/use_default_test.cpp b/test/use_default_test.cpp new file mode 100644 index 0000000..adf1da6 --- /dev/null +++ b/test/use_default_test.cpp @@ -0,0 +1,15 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ + +#include + +template +struct type { }; + +template class type; +template class type;