mirror of
https://github.com/boostorg/core.git
synced 2025-05-11 13:13:55 +00:00
Add use_default to Core
This commit is contained in:
parent
266076f83b
commit
4ea704e80a
@ -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]
|
||||
|
47
doc/use_default.qbk
Normal file
47
doc/use_default.qbk
Normal file
@ -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 <boost/core/use_default.hpp> 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 Derived, class Base,
|
||||
class Value = boost::use_default,
|
||||
class CategoryOrTraversal = boost::use_default,
|
||||
class Reference = boost::use_default,
|
||||
class Difference = boost::use_default>
|
||||
class iterator_adaptor;
|
||||
|
||||
template<class Value>
|
||||
class node_iterator
|
||||
: public iterator_adaptor<node_iterator<Value>, Value*,
|
||||
boost::use_default, boost::forward_traversal_tag>;
|
||||
```
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Reference]
|
||||
|
||||
```
|
||||
namespace boost {
|
||||
struct use_default { };
|
||||
}
|
||||
```
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
17
include/boost/core/use_default.hpp
Normal file
17
include/boost/core/use_default.hpp
Normal file
@ -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
|
@ -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 : <link>shared:<define>LIB_TYPEID_DYN_LINK=1 ;
|
||||
|
||||
run test_lib_typeid.cpp lib_typeid : : : <link>shared : test_lib_typeid_shared ;
|
||||
|
15
test/use_default_test.cpp
Normal file
15
test/use_default_test.cpp
Normal file
@ -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 <boost/core/use_default.hpp>
|
||||
|
||||
template<class, class = boost::use_default>
|
||||
struct type { };
|
||||
|
||||
template class type<int>;
|
||||
template class type<void, boost::use_default>;
|
Loading…
x
Reference in New Issue
Block a user