Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Commit 2019-08-28 - MSVC and the End of <time.h>s as we Know It™
  • config: Fixed namespace placement of ere-TR1 features in MSVC 2010, 2012 (enhances: [70b70d8017]).
  • ctime: Added header with backports for timespec_get.
  • algorithm: Moved copy_if_not out of std and into its proper location in supplement.
  • algorithm: Documentation of algorithms now points to the corresponding cppreference page.
  • ios: Added header, with backport of C++11 io_errc.
  • ios: Added missing left,right manips to ios in OpenWatcom (enhances: [b8ea55b791]).
  • memory: Fixed to_bool of shared_ptr when the latter is unavailable (enhances: [11f57a70cf]).
  • numeric: Added midpoint, from C++20.
  • string_view: Fixed implementation to not use inheritance.
  • string_view: Fixed an issue where it did not include the correct <system_error> implementation.
  • typeindex: Removed a warning of conversion to bool when in MSVC.
  • type_traits: Fixed is_base_of for Clang 2.8, 3.0 (enhances: [1cbdc0b48d]).
  • library:string: ifdef-out the header for pre-C++1997 mode.
  • library:string: Partially extended support for variadic to_string.
  • library:utility: ifdef-out the header for pre-C++1997 mode.
  • library:typesafe_enum: Now default-constructs to 0 to emulate enum class behaviour.
  • tags: Updated with new information on macros.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:44499e7b340bfc68ee192f8d920d65f9dc133a061d116d33f5a4a2af8f0d8377
User & Date: luismachuca 2019-08-28 19:57:45
Context
2019-11-11
04:41
Commit 2019-11-11 - .at() the end of year _or close.
  • cxxomfort: CXXOMFORT_CXX_EMULATION now returns >=2007 for C++98/03 mode with TR1, where possible.
  • cxxomfort: library is now **not** included autimatically. It must be included explicitly even with cxxomfort.hpp.
  • algorithm: Added count, count_if from C++20 (fixes: [ac8af64591]).
  • algorithm: Tentatively marking find, count algorithms as constexpr for C++14.
  • array: Fixed a wrong call to lexicographical_compare in pre-TR1 implementation.
  • iterator: Added contiguous_iterator_tag. Note that pre-C++17 Standard code would not know how to use it.
  • iterator: Added make_reverse_iterator from C++14.
  • random: Fixed a missing cxxomfort::fix in certain compilers in C++11 mode (enhances: [5ba7743db6] Clang-4.x support, GCC-6.x support).
  • string_view: Added .at_or().
  • library:array_ref: Added .at_or().
  • library:fixed_vector: Added .at_or().
  • library:fixed_vector: Made size, empty accessors constexpr.
  • library:tuple: Implemented variadic versions of tuple_shift, tuple_pop.
  • library:utility: Added make_simple_pair.
Leaf check-in: 1dfa7ad4 user: luismachuca tags: trunk, y2019, gcc_min_404, clang_min_302, gcc_max_600
2019-08-28
19:57
Commit 2019-08-28 - MSVC and the End of <time.h>s as we Know It™
  • config: Fixed namespace placement of ere-TR1 features in MSVC 2010, 2012 (enhances: [70b70d8017]).
  • ctime: Added header with backports for timespec_get.
  • algorithm: Moved copy_if_not out of std and into its proper location in supplement.
  • algorithm: Documentation of algorithms now points to the corresponding cppreference page.
  • ios: Added header, with backport of C++11 io_errc.
  • ios: Added missing left,right manips to ios in OpenWatcom (enhances: [b8ea55b791]).
  • memory: Fixed to_bool of shared_ptr when the latter is unavailable (enhances: [11f57a70cf]).
  • numeric: Added midpoint, from C++20.
  • string_view: Fixed implementation to not use inheritance.
  • string_view: Fixed an issue where it did not include the correct <system_error> implementation.
  • typeindex: Removed a warning of conversion to bool when in MSVC.
  • type_traits: Fixed is_base_of for Clang 2.8, 3.0 (enhances: [1cbdc0b48d]).
  • library:string: ifdef-out the header for pre-C++1997 mode.
  • library:string: Partially extended support for variadic to_string.
  • library:utility: ifdef-out the header for pre-C++1997 mode.
  • library:typesafe_enum: Now default-constructs to 0 to emulate enum class behaviour.
  • tags: Updated with new information on macros.
check-in: 44499e7b user: luismachuca tags: trunk
2019-08-26
04:23
Commit 2019-08-25 - Looking for a more independent solution.
  • cxxomfort: Warning: this commit breaks for Clang.
  • cxxomfort: Renamed CXXO_COMPILER_SUPPORT_cstd_... to CXXO_CXXSTDHEADER_... .
  • cxxomfort: Reworked some macros related to TR1 and its headers/namespaces to be more uniform.
  • cxxomfort: Taken the first steps in removing the need for a TR1 forwarder, with <array>.
  • array: Fixed detecting an <array> that is not there in MSVC 2005 (enhances: [11f57a70cf]).
  • array: Testing removal of requirement for a TR1 forwarder in the header.
  • cerrno: Added header, with definitions of some later POSIX error code macros for MSVC (enhances: [11f57a70cf]).
  • functional: Fixed visibility of (tr1::)hash when in GCC/Clang with TR1.
  • functional: Added baseline implementations for reference_wrapper, hash when before C++03.
  • random: Fixed detecting a <random> that is not there in MSVC 2005 (enhances: [11f57a70cf]).
  • random: Testing removal of requirement for a TR1 forwarder in the header.
  • type_traits: Testing ability to fake some intrinsics for is_enum, et al, in OpenWatcom (enhances: [b8ea55b791]).
  • system_error: Removed a warning of conversion to bool when in MSVC.
  • utility: Fixed make_integer_sequence et al, to use C++11 using... = where appropriate.
  • library:array_ref: Made def-ctor trivial in C++11 and do the "right thing" in <C++11.
check-in: deb47099 user: luismachuca tags: trunk, msvc_max_1700, pre-release, y2019, gcc_min_404, msvc_min_1599
Changes

Changes to cxxomfort/CHANGELOG.txt.






















1
2
3
4
5
6
7





















Commit 2019-08-25 - Looking for a more independent solution.

  *  cxxomfort: Warning: this commit breaks for Clang.
  *  cxxomfort: Renamed <tt>CXXO_COMPILER_SUPPORT_cstd_...</tt> to <tt>CXXO_CXXSTDHEADER_...</tt> .
  *  cxxomfort: Reworked some macros related to TR1 and its headers/namespaces to be more uniform.
  *  cxxomfort: Taken the first steps in removing the need for a TR1 forwarder, with <array>.
  *  array: Fixed detecting an <array> that is not there in MSVC 2005 (enhances: [11f57a70cf]).
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Commit 2019-08-28 - MSVC and the End of <time.h>s as we Know It™

  *  config: Fixed namespace placement of ere-TR1 features in MSVC 2010, 2012 (enhances: [70b70d8017]).
  *  ctime: Added header with backports for <tt>timespec_get</tt>.
  *  algorithm: Moved <tt>copy_if_not</tt> out of std and into its proper location in supplement.
  *  algorithm: Documentation of algorithms now points to the corresponding <em>cppreference</em> page.
  *  ios: Added header, with backport of C++11 <tt>io_errc</tt>.
  *  ios: Added missing <tt>left,right</tt> manips to ios in OpenWatcom (enhances: [b8ea55b791]).
  *  memory: Fixed <tt>to_bool</tt> of shared_ptr when the latter is unavailable (enhances: [11f57a70cf]).
  *  numeric: Added <tt>midpoint</tt>, from C++20.
  *  string_view: Fixed implementation to not use inheritance.
  *  string_view: Fixed an issue where it did not include the correct <system_error> implementation.
  *  typeindex: Removed a warning of conversion to bool when in MSVC.
  *  type_traits: Fixed <tt>is_base_of</tt> for Clang 2.8, 3.0 (enhances: [1cbdc0b48d]).
  *  library:string: ifdef-out the header for pre-C++1997 mode.
  *  library:string: Partially extended support for variadic <tt>to_string</tt>.
  *  library:utility: ifdef-out the header for pre-C++1997 mode.
  *  library:typesafe_enum: Now default-constructs to 0 to emulate <tt>enum class</tt> behaviour.
  *  tags: Updated with new information on macros.


Commit 2019-08-25 - Looking for a more independent solution.

  *  cxxomfort: Warning: this commit breaks for Clang.
  *  cxxomfort: Renamed <tt>CXXO_COMPILER_SUPPORT_cstd_...</tt> to <tt>CXXO_CXXSTDHEADER_...</tt> .
  *  cxxomfort: Reworked some macros related to TR1 and its headers/namespaces to be more uniform.
  *  cxxomfort: Taken the first steps in removing the need for a TR1 forwarder, with <array>.
  *  array: Fixed detecting an <array> that is not there in MSVC 2005 (enhances: [11f57a70cf]).

Changes to cxxomfort/cxxomfort/algorithm.hpp.

16
17
18
19
20
21
22

23
24
25
26
27
28
29
..
32
33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

81
82
83
84
85
86
87
..
89
90
91
92
93
94
95
96
97

98
99
100
101
102
103
104
...
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
...
146
147
148
149
150
151
152
153
154

155
156
157
158
159
160
161
...
273
274
275
276
277
278
279

280
281
282
#if (CXXOMFORT_CXX_STD<2011)

/**
 * @brief Copy elements conditionally to @a dest if they fulfill @a f .
 * @return the advanced @a dest iterator.
 * @xrefitem std0algorithm "<algorithm> backports" ""
 * @ingroup cxx11-backports

 * 
 */
template <typename InpI, typename OutI, typename Predicate>
OutI copy_if (InpI ini, InpI fin, OutI dest, Predicate f) {
    if (ini != fin) {
        for (; ini != fin; ++ini) {
            if (f(*ini)) { *dest++= *ini; }
................................................................................
    }
    return dest;
}

/**
 * @brief Copy a given amount of elements to @a dest .
 * @return the iterated @a dest iterator.
 * @xrefitem std0algorithm "" ""
 * @ingroup cxx11-backports

 **/
template <typename InpI, typename Integral, typename OutI>
inline OutI copy_n (InpI ini, Integral n, OutI dest) {
    for (; n --> 0; ++ini, ++dest) {
        *dest= *ini;
    }
    return dest;
}

/**
 * @brief Conditionally copy from sequence <var>[ini,fin)</var> to either sequence starting at @p Dtrue or @p Dfalsef .
 * @return the advanced <code>std::pair</code> (@a Dtrue , @a Dfalse ).
 * @xrefitem std0algorithm "" ""
 * @ingroup cxx11-backports

 **/
template <typename InpI, typename OutI1, typename OutI2, typename Predicate>
std::pair<OutI1,OutI2> partition_copy (InpI ini, InpI const fin, OutI1 Dtrue, OutI2 Dfalse, Predicate f) {
    for (; ini != fin; ++ini) {
        if (f(*ini)) *Dtrue++= *ini; 
        else *Dfalse++= *ini;
    } // end for
    return std::pair<OutI1,OutI2>(Dtrue,Dfalse);
}

/**
 * @brief Copy like @c copy_if with inverted predicate (for symmetry with @c find_if_not ).
 * @xrefitem std0algorithm "" ""
 * @ingroup cxx11-backports
 */
template <typename OutI, typename InpI, typename Pred> inline 
OutI copy_if_not (InpI ini, InpI fin, OutI dest, Pred p) {
    for (; ini != fin; ++ini) { 
        if (!p(*ini)) { *dest= *ini; ++dest; }
    }
}

/**
 * @brief Finds like @c find_if but the predicate is reversed.
 * @xrefitem std0algorithm "" "Search"
 * @ingroup cxx11-backports

 **/
template<class It, class Pred>
It find_if_not(It ini, It fin, Pred f) {
    for (; ini != fin; ++ini) {
        if (!f(*ini)) {
            return ini;
        }
................................................................................
    return fin; // < all the elements fulfill f
}

/**
 * @brief Determines if a sequence is sorted according to a given criteria.
 * @param less Criteria for sorting, a binary function f(x,y) that returns @c true if <code>x<y</code>.
 * @return A bool response about if the sequence is sorted.
 * @xrefitem std0algorithm "" ""
 * @ingroup cxx11-backports

 */
template <typename Iterator, typename Compare>
inline bool is_sorted (Iterator ini, Iterator fin, Compare less) {
    if (ini == fin) return true;
    Iterator prev= ini++;
    for (; ini != fin; ++ini, ++prev) {
        if (!less(*prev,*ini)) return false;
................................................................................
} // detail_algorithm


/**
 * @brief Shuffles a sequence according to a generator call g().
 * @param[in,out] g An object that acts like a (P)RNG and returns a value via <code>operator()</code>.
 * @warning Requires support from <random>.
 * @xrefitem std0algorithm "" ""
 * @ingroup cxx11-backports
 * */
template< class RAIterator, class URNG >
void shuffle( RAIterator ini, RAIterator fin, URNG& g ) {
    typedef typename std::iterator_traits<RAIterator>::difference_type diff_t;
    diff_t n = fin - ini; // guaranteed for RAIterator
    for (diff_t i = n-1; i > 0; --i) {
................................................................................
    }

}

/**
 * @brief Executes a function once for each element in a sequence, using it as an argument.
 * @ingroup cxx17-backports
 * @xrefitem std0algorithm "" ""
 * @param f A function object that is executed as <code>f(i)</code> for each @a i in the sequence.

 * */
template<class II, class Size, class UnaryFunction>
II for_each_n (II first, Size n, UnaryFunction f) {
    for (Size i = 0; i < n; ++first, (void) ++i) {
        f(*first);
    }
    return first;
................................................................................
 * For other examples see the following entries in @c cxxomfort-examples : 
 * 
 * * @c randomly.cpp https://notabug.org/lmachucabezzaza/cxxomfort-examples/src/master/examples/randomly.cpp
 * * @e{ More pending...}
 *
 * @section also See Also
 * 

 * @see @cppref{algorithm} (cppreference) , @ref std0numeric , @ref cxxo-sup-algorithm (supplemental)
 * 
 * */







>







 







|

>












|

>










<
<
<
<
<
<
<
<
<
<
<





>







 







|

>







 







|







 







|

>







 







>



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
..
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67











68
69
70
71
72
73
74
75
76
77
78
79
80
..
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
...
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
...
268
269
270
271
272
273
274
275
276
277
278
#if (CXXOMFORT_CXX_STD<2011)

/**
 * @brief Copy elements conditionally to @a dest if they fulfill @a f .
 * @return the advanced @a dest iterator.
 * @xrefitem std0algorithm "<algorithm> backports" ""
 * @ingroup cxx11-backports
 * @sa @cppref{algorithm/copy}
 * 
 */
template <typename InpI, typename OutI, typename Predicate>
OutI copy_if (InpI ini, InpI fin, OutI dest, Predicate f) {
    if (ini != fin) {
        for (; ini != fin; ++ini) {
            if (f(*ini)) { *dest++= *ini; }
................................................................................
    }
    return dest;
}

/**
 * @brief Copy a given amount of elements to @a dest .
 * @return the iterated @a dest iterator.
 * @xrefitem std0algorithm "<algorithm> backports" ""
 * @ingroup cxx11-backports
 * @sa @cppref{algorithm/copy_n}
 **/
template <typename InpI, typename Integral, typename OutI>
inline OutI copy_n (InpI ini, Integral n, OutI dest) {
    for (; n --> 0; ++ini, ++dest) {
        *dest= *ini;
    }
    return dest;
}

/**
 * @brief Conditionally copy from sequence <var>[ini,fin)</var> to either sequence starting at @p Dtrue or @p Dfalsef .
 * @return the advanced <code>std::pair</code> (@a Dtrue , @a Dfalse ).
 * @xrefitem std0algorithm "<algorithm> backports" ""
 * @ingroup cxx11-backports
 * @sa @cppref{algorithm/partition_copy}
 **/
template <typename InpI, typename OutI1, typename OutI2, typename Predicate>
std::pair<OutI1,OutI2> partition_copy (InpI ini, InpI const fin, OutI1 Dtrue, OutI2 Dfalse, Predicate f) {
    for (; ini != fin; ++ini) {
        if (f(*ini)) *Dtrue++= *ini; 
        else *Dfalse++= *ini;
    } // end for
    return std::pair<OutI1,OutI2>(Dtrue,Dfalse);
}













/**
 * @brief Finds like @c find_if but the predicate is reversed.
 * @xrefitem std0algorithm "" "Search"
 * @ingroup cxx11-backports
 * @sa @cppref{algorithm/find_if}
 **/
template<class It, class Pred>
It find_if_not(It ini, It fin, Pred f) {
    for (; ini != fin; ++ini) {
        if (!f(*ini)) {
            return ini;
        }
................................................................................
    return fin; // < all the elements fulfill f
}

/**
 * @brief Determines if a sequence is sorted according to a given criteria.
 * @param less Criteria for sorting, a binary function f(x,y) that returns @c true if <code>x<y</code>.
 * @return A bool response about if the sequence is sorted.
 * @xrefitem std0algorithm "<algorithm> backports" "Sorting"
 * @ingroup cxx11-backports
 * @sa @cppref{algorithm/is_sorted}
 */
template <typename Iterator, typename Compare>
inline bool is_sorted (Iterator ini, Iterator fin, Compare less) {
    if (ini == fin) return true;
    Iterator prev= ini++;
    for (; ini != fin; ++ini, ++prev) {
        if (!less(*prev,*ini)) return false;
................................................................................
} // detail_algorithm


/**
 * @brief Shuffles a sequence according to a generator call g().
 * @param[in,out] g An object that acts like a (P)RNG and returns a value via <code>operator()</code>.
 * @warning Requires support from <random>.
 * @xrefitem std0algorithm "<algorithm> backports" "Transformation"
 * @ingroup cxx11-backports
 * */
template< class RAIterator, class URNG >
void shuffle( RAIterator ini, RAIterator fin, URNG& g ) {
    typedef typename std::iterator_traits<RAIterator>::difference_type diff_t;
    diff_t n = fin - ini; // guaranteed for RAIterator
    for (diff_t i = n-1; i > 0; --i) {
................................................................................
    }

}

/**
 * @brief Executes a function once for each element in a sequence, using it as an argument.
 * @ingroup cxx17-backports
 * @xrefitem std0algorithm "<algorithm> backports" ""
 * @param f A function object that is executed as <code>f(i)</code> for each @a i in the sequence.
 * @sa @cppref{algorithm/for_each}
 * */
template<class II, class Size, class UnaryFunction>
II for_each_n (II first, Size n, UnaryFunction f) {
    for (Size i = 0; i < n; ++first, (void) ++i) {
        f(*first);
    }
    return first;
................................................................................
 * For other examples see the following entries in @c cxxomfort-examples : 
 * 
 * * @c randomly.cpp https://notabug.org/lmachucabezzaza/cxxomfort-examples/src/master/examples/randomly.cpp
 * * @e{ More pending...}
 *
 * @section also See Also
 * 
 * @see @ref{cxxomfort/algorithm.hpp} (header reference)
 * @see @cppref{algorithm} (cppreference) , @ref std0numeric , @ref cxxo-sup-algorithm (supplemental)
 * 
 * */

Changes to cxxomfort/cxxomfort/backports.hpp.

14
15
16
17
18
19
20
21
22
23




24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 * standard headers in the library.
 * 
 * */
#include "config.hpp"
#include "base.hpp"

#include "cerrno.hpp" // #define s for errno values
#include "algorithm.hpp" // <algorithm> backports (copy_if, minmax, etc...)
#include "cstddef.hpp" // <cstddef> backports (byte, nullptr, etc...)
#include "cstdint.hpp" // <cstdint> backports (integer types)




#include "iterator.hpp" // <iterator> backports (begin, end, size, data, etc...)
#include "string.hpp" // <string> backports (to_string, etc...)
#include "utility.hpp" // <utility> backports (declval, exchange, pair, etc...)

#include "array.hpp" // std::array
#include "cuchar.hpp" // <cuchar> backports: char16_t, char32_t
#include "forward_list.hpp" // std::forward_list
#include "string_view.hpp" // <string_view> backports
#include "typeindex.hpp" // std::type_index

#include "functional.hpp" // <functional> backports (transparent functors, etc...)
#include "memory.hpp" // <memory> backports (pointer_traits, alignof, unique_ptr, etc...)
#include "numeric.hpp" // <numeric> backports (iota, etc...)
#include "random.hpp" // <random> backports (rename fixes, std::random_device, etc...)
#include "system_error.hpp" // <system_error> backports
#include "tuple.hpp" // <tuple> backports (tuple get<type>, etc...)
#include "type_traits.hpp" // <type_traits> backports (common_type, decay, is_literal, is_null_pointer, etc...)

#include "ios.hpp" // <ios> stuff.
#endif







<
|
|
>
>
>
>
|
|
|


<












|

14
15
16
17
18
19
20

21
22
23
24
25
26
27
28
29
30
31

32
33
34
35
36
37
38
39
40
41
42
43
44
45
 * standard headers in the library.
 * 
 * */
#include "config.hpp"
#include "base.hpp"

#include "cerrno.hpp" // #define s for errno values

#include "cstddef.hpp" // <cstddef> and system backports: byte, nullptr, etc...
#include "cstdint.hpp" // <cstdint> backports: integer types
#include "ctime.hpp" // <ctime> backports: timespec_get
#include "cuchar.hpp" // <cuchar> backports: char16_t, char32_t

#include "algorithm.hpp" // <algorithm> backports: copy_if, minmax, etc...
#include "iterator.hpp" // <iterator> backports: global begin/end, etc
#include "string.hpp" // <string> backports: to_string
#include "utility.hpp" // <utility> backports: declval, exchange, pair, etc...

#include "array.hpp" // std::array

#include "forward_list.hpp" // std::forward_list
#include "string_view.hpp" // <string_view> backports
#include "typeindex.hpp" // std::type_index

#include "functional.hpp" // <functional> backports (transparent functors, etc...)
#include "memory.hpp" // <memory> backports (pointer_traits, alignof, unique_ptr, etc...)
#include "numeric.hpp" // <numeric> backports (iota, etc...)
#include "random.hpp" // <random> backports (rename fixes, std::random_device, etc...)
#include "system_error.hpp" // <system_error> backports
#include "tuple.hpp" // <tuple> backports (tuple get<type>, etc...)
#include "type_traits.hpp" // <type_traits> backports (common_type, decay, is_literal, is_null_pointer, etc...)

//#include "ios.hpp" // <ios> stuff.
#endif

Changes to cxxomfort/cxxomfort/cstdint.hpp.

35
36
37
38
39
40
41

42

43
44
45
46
47
48
 * @warning For the definition of these types, cxxomfort assumes that 
 * the native type <code>long long</code> is available, 
 * even in C++03 mode. Using a platform without such a native 
 * type is <b>unsupported</b> but can be tried by defining the 
 * @link cxxomfort-behaviour "Configuration macro" @endlink 
 * <code>CXXOFLAG_WITHOUT_LONGLONG</code>.
 * 

 * 

 * 
 * See also: @ref cstddef.hpp , @ref cxxomfort-base , 
 * <a href="https://en.cppreference.com/w/cpp/header/cstdint">\<cstdint\> \@cppreference</a>.
 * **/

#endif







>

>

<
<



35
36
37
38
39
40
41
42
43
44
45


46
47
48
 * @warning For the definition of these types, cxxomfort assumes that 
 * the native type <code>long long</code> is available, 
 * even in C++03 mode. Using a platform without such a native 
 * type is <b>unsupported</b> but can be tried by defining the 
 * @link cxxomfort-behaviour "Configuration macro" @endlink 
 * <code>CXXOFLAG_WITHOUT_LONGLONG</code>.
 * 
 * @section See Also
 * 
 * @see @cppref{header/cstdint} (cppreference) 
 * 


 * **/

#endif

Added cxxomfort/cxxomfort/ctime.hpp.



























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef CXXOMFORT_CTIME_HPP
#define CXXOMFORT_CTIME_HPP
/**
 * @file
 * @brief Backports for features in <ctime>
 * @xrefitem std0ctime "<ctime>" ""
 *
 */

#include "config.hpp"
#include "base.hpp"
#include CXXO_INCLUDE_SYS(ctime)

// 
// these elements are - in theory - only needed pre-C++17
// 

#if (CXXOMFORT_CXX_STD >= 2017)

#elif (CXXOMFORT_CXX_STD >= 1997)

	#include <time.h>
	// we look for CLOCK_REALTIME to use http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html
	#if !defined(_POSIX_VERSION)

namespace cxxomfort { namespace cxxostd {

struct timespec {
	std::time_t tv_sec;
	long tv_nsec;
};

		#if !defined(TIME_UTC)
		#define TIME_UTC 0
		#endif

static int timespec_get ( struct timespec* ts, int base ) {
	(void)base;
#if defined(_POSIX_VERSION)
	clock_gettime(CLOCK_REALTIME, ts);
#else
	ts->tv_sec = time(0);
	ts->tv_nsec= 0;
#endif
	return 0;
}

} }

namespace std {
	using ::cxxomfort::cxxostd::timespec;
	using ::cxxomfort::cxxostd::timespec_get;
}

	#endif // _POSIX_VERSION

#endif

#endif

/**
 * @page std0ctime <ctime>
 * @brief Backports from @c <ctime> 
 * 
 * Interfaces defined in this section:
 * 
 * * @c timespec_get() - obtain current time information for a system clock.
 * * @c timespec - information datatype for @c timespec_get .
 * 
 *
 *
 * @section also See Also
 * 
 * @see @cppref{header/ctime} (cppreference) 
 * 
 * */

Changes to cxxomfort/cxxomfort/cuchar.hpp.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 */

#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
#include <cwchar>
// uchar is only available in some compilers
#if (CXXOMFORT_CXX_STD>=1997)
#if (CXXO_COMPILER_SUPPORT_cstd_cuchar)
#include <cuchar>
#else
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)
        #include "impl/uchar.hpp"
    #else
        #include <uchar.h>
        #include "impl/uchar.hpp"







|







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 */

#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
#include <cwchar>
// uchar is only available in some compilers
#if (CXXOMFORT_CXX_STD>=1997)
#if (CXXO_CXXSTDHEADER_cuchar)
#include <cuchar>
#else
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)
        #include "impl/uchar.hpp"
    #else
        #include <uchar.h>
        #include "impl/uchar.hpp"

Changes to cxxomfort/cxxomfort/impl/11-typeindex.hpp.

63
64
65
66
67
68
69

70



71
72
73
74
75
76
77
#endif
    }
    
    friend bool     operator== (type_index const& l, type_index const& r) CXXO_NOEXCEPTNOTHROW {
        return l.TR==r.TR;
    }
    friend bool     operator<  (type_index const& l, type_index const& r) CXXO_NOEXCEPTNOTHROW {

        return (l.TR)->before(*r.TR);



    }

    private:
    std::type_info const* TR;
    
};








>
|
>
>
>







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#endif
    }
    
    friend bool     operator== (type_index const& l, type_index const& r) CXXO_NOEXCEPTNOTHROW {
        return l.TR==r.TR;
    }
    friend bool     operator<  (type_index const& l, type_index const& r) CXXO_NOEXCEPTNOTHROW {
#ifdef _MSC_VER
        return ((l.TR)->before(*r.TR) != 0);
#else
        return static_cast<bool>((l.TR)->before(*r.TR));
#endif
    }

    private:
    std::type_info const* TR;
    
};

Changes to cxxomfort/cxxomfort/impl/hash.hpp.

1
2
3
4

5
6


7
8
9
10
11
12
13
..
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
..
41
42
43
44
45
46
47


48
49
50
#ifndef CXXOMFORT_IMPL_HASH_HPP
#define CXXOMFORT_IMPL_HASH_HPP

#include <functional>

#include <cxxomfort/functional.hpp>
#include <cxxomfort/util/type_traits.hpp> // is_enum



/**
 * @file 
 * @ingroup cxx14-backports
 * */
namespace cxxomfort {  namespace fix {

................................................................................
 * @xrefitem std0functional "<functional>" "Non-backport Assists"
 * @see 
 * * Documentation for C++ @c std::hash .
 * 
 */
template <typename T, typename = void >
struct hash
: public CXXO_namespace_tr1::hash<T> {
    enum { uses_std = true };
};

/**
 * @brief Specialization of @c std::hash for @c enum types, as per C++ 14.
 * @note Since pre-C++17 @c hash is not specializable generically, this 
 * is implemented through another facility ( cxxomfort::fix::hash ).
................................................................................
struct hash<E , typename std::enable_if< std::is_enum<E>::value>::type >
: public hash< typename ::std::underlying_type<E>::type> {
    enum { uses_std = false };
};


} }



#endif




|
>


>
>







 







|







 







>
>



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
..
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
..
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef CXXOMFORT_IMPL_HASH_HPP
#define CXXOMFORT_IMPL_HASH_HPP

#include <cxxomfort/config.hpp>
#include CXXO_INCLUDE_SYS(functional)
#include <cxxomfort/functional.hpp>
#include <cxxomfort/util/type_traits.hpp> // is_enum

#if (CXXOMFORT_CXX_STD >= 1997)

/**
 * @file 
 * @ingroup cxx14-backports
 * */
namespace cxxomfort {  namespace fix {

................................................................................
 * @xrefitem std0functional "<functional>" "Non-backport Assists"
 * @see 
 * * Documentation for C++ @c std::hash .
 * 
 */
template <typename T, typename = void >
struct hash
: public CXXO_STDTR1_NAME()::hash<T> {
    enum { uses_std = true };
};

/**
 * @brief Specialization of @c std::hash for @c enum types, as per C++ 14.
 * @note Since pre-C++17 @c hash is not specializable generically, this 
 * is implemented through another facility ( cxxomfort::fix::hash ).
................................................................................
struct hash<E , typename std::enable_if< std::is_enum<E>::value>::type >
: public hash< typename ::std::underlying_type<E>::type> {
    enum { uses_std = false };
};


} }

#endif

#endif

Added cxxomfort/cxxomfort/impl/p0117r0-to_basic_string-variadic.hpp.

Changes to cxxomfort/cxxomfort/impl/to_basic_string_cxx03.hpp.

1
2



3
4
5
6
7
8

9
10
11
12
13
14
15
16
17
18













19
20
21
22
23
24
25
#ifndef CXXOMFORT_IMPL_TO_BASIC_STRING_03_HPP
#define CXXOMFORT_IMPL_TO_BASIC_STRING_03_HPP




namespace cxxomfort { namespace impl {
namespace string {

namespace detail_string {


const struct no_t {
    template <typename Ch, typename Tr, typename Alloc>
    friend std::basic_ostringstream<Ch,Tr,Alloc>& 
    operator<< (std::basic_ostringstream<Ch,Tr,Alloc>& os, no_t const& n) {
        (void)n;
        return os;
}

} noitem = {};















template <typename Stream>
struct streamizer {
    streamizer (Stream& s)
    : stream(s) 
    {
        using namespace std;


>
>
>






>






|



>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef CXXOMFORT_IMPL_TO_BASIC_STRING_03_HPP
#define CXXOMFORT_IMPL_TO_BASIC_STRING_03_HPP

#include <cstring>
#include <sstream>

namespace cxxomfort { namespace impl {
namespace string {

namespace detail_string {

#if (CXXOMFORT_CXX_STD>=1997)
const struct no_t {
    template <typename Ch, typename Tr, typename Alloc>
    friend std::basic_ostringstream<Ch,Tr,Alloc>& 
    operator<< (std::basic_ostringstream<Ch,Tr,Alloc>& os, no_t const& n) {
        (void)n;
        return os;
	}

} noitem = {};

#else

const struct no_t {} noitem;

template <typename Ch, typename Tr, typename Alloc>
std::basic_ostringstream<Ch,Tr,Alloc>& 
operator<< (std::basic_ostringstream<Ch,Tr,Alloc>& os, no_t const& n) {
	(void)n;
	return os;
}

#endif


template <typename Stream>
struct streamizer {
    streamizer (Stream& s)
    : stream(s) 
    {
        using namespace std;

Changes to cxxomfort/cxxomfort/impl/tuplemeta.hpp.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
..
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <cxxomfort/type_traits.hpp>
#include "using_tr1_type_traits.hpp"

namespace cxxomfort { namespace impl {


/**
 * @brief type_traits that defines a @c value @c true if the type T is a @c std::tuple .
 */
template <typename T> struct is_tuple: traits::false_type {};

#if (CXXOMFORT_CXX_STD >= 2011) || \
 (CXXOMFORT_COMPILER_ID == CXXO_COMPILERID_GCC && CXXOMFORT_CXX_EMULATION == 2011) 

//! Inherits from @c true_type  if @p T  is a <code>std::tuple</code>.
template <typename... Args> struct is_tuple< std::tuple<Args...> >
: traits::true_type {};

#else // c++03

................................................................................
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> 
struct is_tuple <std::tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9> >
: traits::true_type {};

#endif

// if compiler supports variadics, we can extend this
#if (CXXO_EMULATION_variadic==1)
template <typename T0, typename T1, typename T2, typename T3, typename T4
        , typename T5, typename T6, typename T7, typename T8, typename T9, typename... TArgs> 
struct is_tuple <std::tr1::tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,TArgs...> >
: traits::true_type {};
#endif // variadic

#endif // c++ standard







|



|
<







 







|







14
15
16
17
18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
..
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <cxxomfort/type_traits.hpp>
#include "using_tr1_type_traits.hpp"

namespace cxxomfort { namespace impl {


/**
 * @brief type_traits that determines if the type T is a @c std::tuple .
 */
template <typename T> struct is_tuple: traits::false_type {};

#if (CXXOMFORT_CXX_STD >= 2011) || (CXXO_COMPILER_SUPPORT_variadic) 


//! Inherits from @c true_type  if @p T  is a <code>std::tuple</code>.
template <typename... Args> struct is_tuple< std::tuple<Args...> >
: traits::true_type {};

#else // c++03

................................................................................
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> 
struct is_tuple <std::tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9> >
: traits::true_type {};

#endif

// if compiler supports variadics, we can extend this
#if (CXXO_COMPILER_SUPPORT_variadic)
template <typename T0, typename T1, typename T2, typename T3, typename T4
        , typename T5, typename T6, typename T7, typename T8, typename T9, typename... TArgs> 
struct is_tuple <std::tr1::tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,TArgs...> >
: traits::true_type {};
#endif // variadic

#endif // c++ standard

Changes to cxxomfort/cxxomfort/impl/typesafe_enum-core.hpp.

41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
    typedef inner inner_type;
    typedef typename std::conditional<
        std::is_enum<inner>::value
        , typename std::underlying_type< /*inner*/ typename def::type >::type , inner
    >::type underlying_type;
 
    public:
    CXXO_DEFAULT_DEFAULT_CONSTRUCTOR(typesafe_enum);


    CXXO_CONSTEXPR typesafe_enum (inner_type e) CXXO_NOEXCEPTNOTHROW 
    : val(e) {}

/*
    typesafe_enum (::cxxomfort::detail::explicit_cast<typesafe_enum> const& e)
    : val (e)







|
>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
    typedef inner inner_type;
    typedef typename std::conditional<
        std::is_enum<inner>::value
        , typename std::underlying_type< /*inner*/ typename def::type >::type , inner
    >::type underlying_type;
 
    public:
    CXXO_CONSTEXPR typesafe_enum () CXXO_NOEXCEPTNOTHROW 
    : val(0) {} // as per standard sections 3.9.9, 8.5.5, 8.5.7 and 8.5.10 together, see https://stackoverflow.com/questions/17630967/user-defined-c11-enum-class-default-constructor

    CXXO_CONSTEXPR typesafe_enum (inner_type e) CXXO_NOEXCEPTNOTHROW 
    : val(e) {}

/*
    typesafe_enum (::cxxomfort::detail::explicit_cast<typesafe_enum> const& e)
    : val (e)

Added cxxomfort/cxxomfort/ios.hpp.



































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef CXXOMFORT_IOS_HPP
#define CXXOMFORT_IOS_HPP
/**
 * @file
 * @brief Implementations and additions tied to Standard Header <ios>.
 * @xrefitem std0ios "<ios>" ""
 *
 */

#include "config.hpp"
#include "base.hpp"
#include <iosfwd>

// 
// io_errc
// is_error_code_enum
// 

#if (CXXOMFORT_CXX_STD >= 1997 && CXXOMFORT_CXX_STD < 2011)

#include <cxxomfort/impl/typesafe_enum-core.hpp>
#include <cxxomfort/impl/errc.hpp>

namespace cxxomfort {
namespace cxxostd {

struct my_io_errc { enum type { stream = 1 }; };

typedef cxxomfort::impl::typesafe_enum<my_io_errc> io_errc;

template<> struct is_error_code_enum<io_errc> 
: std::true_type {};

template<> struct is_error_code_enum< my_io_errc::type> 
: std::true_type {};

} } // cxxomfort::cxxostd

#endif

//
// missing ios stuff in pre-C++97

#if (CXXOMFORT_CXX_STD < 1997)

/*
 * Open Watcom is missing boolalpha, left(), right()
 */


namespace std {

ios& boolalpha (ios& s) {  return s; };
ios& noboolalpha (ios& s) {  return s; };

ios& left (ios& s) { s.setf(ios::left); return s; };
ios& right (ios& s) { s.setf(ios::right); return s; };


} // std

#endif


#endif

Changes to cxxomfort/cxxomfort/library/algorithm.hpp.

20
21
22
23
24
25
26












27
28
29
30
31
32
33

/**
 * @ingroup cxxo-sup-algorithm
 * @{
 */

// copy_leftmost_n is simply copy_n













/**
 * @brief Like @c copy_n in that it copies @e leftmost @a ("starting") n elements from the sequence.
 * @xrefitem cxxo-sup-algorithm "cxxo-sup-algorithm" "Copying"
 * 
 * See also: copy_rightmost_n() .
 * 







>
>
>
>
>
>
>
>
>
>
>
>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

/**
 * @ingroup cxxo-sup-algorithm
 * @{
 */

// copy_leftmost_n is simply copy_n

/**
 * @brief Copy like @c copy_if with inverted predicate (for symmetry with @c find_if_not ).
 * @xrefitem std0algorithm "<algorithm> backports" ""
 * @ingroup cxx11-backports
 */
template <typename OutI, typename InpI, typename Pred> inline 
OutI copy_if_not (InpI ini, InpI fin, OutI dest, Pred p) {
    for (; ini != fin; ++ini) { 
        if (!p(*ini)) { *dest= *ini; ++dest; }
    }
}

/**
 * @brief Like @c copy_n in that it copies @e leftmost @a ("starting") n elements from the sequence.
 * @xrefitem cxxo-sup-algorithm "cxxo-sup-algorithm" "Copying"
 * 
 * See also: copy_rightmost_n() .
 * 

Changes to cxxomfort/cxxomfort/library/iterator.hpp.

4
5
6
7
8
9
10

11
12
13
14
15
16
17
#include <cxxomfort/base.hpp>
#include <iterator>
#include <functional>
//#include <type_traits>


#include <cxxomfort/impl/p1227r0-ssize.hpp> // ssize


/**
 * @file
 * @ingroup cxxo-sup-iterator
 */

namespace cxxomfort { namespace library { 







>







4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <cxxomfort/base.hpp>
#include <iterator>
#include <functional>
//#include <type_traits>


#include <cxxomfort/impl/p1227r0-ssize.hpp> // ssize


/**
 * @file
 * @ingroup cxxo-sup-iterator
 */

namespace cxxomfort { namespace library { 

Changes to cxxomfort/cxxomfort/library/typesafe_enum.hpp.

28
29
30
31
32
33
34
35
36
37
namespace cxxomfort { namespace library {

    using ::cxxomfort::impl::typesafe_enum;
    using ::cxxomfort::impl::is_typesafe_enum;

} }

#define CXXOMFORT_IMPLEMENTS_enum_class CXXO_IMPLSTATUS_EMULATION()

#endif // SAFEENUM.HPP







<
<

28
29
30
31
32
33
34


35
namespace cxxomfort { namespace library {

    using ::cxxomfort::impl::typesafe_enum;
    using ::cxxomfort::impl::is_typesafe_enum;

} }



#endif // SAFEENUM.HPP

Changes to cxxomfort/cxxomfort/library/utility.hpp.

6
7
8
9
10
11
12

13
14
15



16
17
18
19
20
21
22
...
114
115
116
117
118
119
120



121
122
123
124
125
126
127
 * Interfaces defined in this file:
 * 
 * 
 * */
#include <cxxomfort/type_traits.hpp>
#include <cxxomfort/utility.hpp> // pair
#include <cxxomfort/impl/relationals.hpp>


namespace cxxomfort { namespace library { 
namespace utility {




//
// simple_pair
//

/**
 * @brief A reduced version of a pair similar to std::array
................................................................................
        return l==r ? 0 : ( l < r ? -1 : +1 );
    }
    
};

//CXXO_CONSTEXPR14 const operator_LEG_t ⋚ = {};
//CXXO_CONSTEXPR14 const operator_LEG_t \u22da = {};




}
}}

#endif

/**







>



>
>
>







 







>
>
>







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
 * Interfaces defined in this file:
 * 
 * 
 * */
#include <cxxomfort/type_traits.hpp>
#include <cxxomfort/utility.hpp> // pair
#include <cxxomfort/impl/relationals.hpp>


namespace cxxomfort { namespace library { 
namespace utility {

#if (CXXOMFORT_CXX_STD >= 1997)


//
// simple_pair
//

/**
 * @brief A reduced version of a pair similar to std::array
................................................................................
        return l==r ? 0 : ( l < r ? -1 : +1 );
    }
    
};

//CXXO_CONSTEXPR14 const operator_LEG_t ⋚ = {};
//CXXO_CONSTEXPR14 const operator_LEG_t \u22da = {};

#endif // cxx_std


}
}}

#endif

/**

Changes to cxxomfort/cxxomfort/limits.hpp.

91
92
93
94
95
96
97
98
99
100
 * Non-backport interfaces:
 * 
 * * @c @ref integral_limits 
 * 
 *
 * @section also See Also
 * 
 * * @see @cppref{header/limits} 
 *
 * */







|


91
92
93
94
95
96
97
98
99
100
 * Non-backport interfaces:
 * 
 * * @c @ref integral_limits 
 * 
 *
 * @section also See Also
 * 
 * * @see @cppref{header/limits} (cppreference)
 *
 * */

Changes to cxxomfort/cxxomfort/memory.hpp.

17
18
19
20
21
22
23

24
25
26
27
28
29
30
..
66
67
68
69
70
71
72

73
74
75
76

77
78
79
80
81
82
83
...
159
160
161
162
163
164
165



166
167
168
169
170
171
172
173
174





175
176
177
178
179
180
181
182



183
184
185
186
187
188
189
...
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256

257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
...
292
293
294
295
296
297
298
299
300
301
#pragma message CXXO_NOTICE("enabled <memory> support.")
#endif


#if (CXXOFLAG_namespace_tr1>0)
	#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG)
	#include <tr1/memory>

namespace std {
	using tr1::shared_ptr;
	//using tr1::make_shared;
	using tr1::weak_ptr;
}
	#endif
#endif
................................................................................
#else

namespace std {
	template <typename T> struct default_delete {

		default_delete () throw() {}


		template <class U>
		default_delete ( default_delete<U> const&
		, typename std::enable_if<std::is_convertible<U*, T*>::value, void>::type* = 0 )
		{ }


		void operator() (T* ptr) const  CXXO_NOEXCEPTNOTHROW   {
			static_assert (sizeof(T) > 0, "T must be a complete type");
			delete ptr;
		}

	};
................................................................................
#include "impl/p0040-memory_management.hpp"


//
// cxxomfort::fix assist: to_bool
//




// assist
namespace cxxomfort { namespace fix {
template <typename T>
bool to_bool (std::shared_ptr<T> const& p) CXXO_NOEXCEPTNOTHROW {
	return p.get() != nullptr;
}

} } // cxxomfort::fix






// assist
namespace cxxomfort { namespace fix {
template <typename T>
bool to_bool (std::unique_ptr<T> const& p) CXXO_NOEXCEPTNOTHROW {
    return p.get() != nullptr;
}

} } // cxxomfort::fix






#if defined(CXXOMFORT_USING_MEMTOOLS)

// We define alignas, alignof depending on compiler specifics
#if 0
................................................................................
};

} } // cxxomfort::fix::


// -- set up needed things in std::
#if (CXXOMFORT_CXX_STD < 2011 && defined(CXXOMFORT_USING_unique_ptr))
    #if (!defined(CXXOMFORT_NO_TR1) && !defined(NO_TR1))
//
// specialize std::tr1::hash for unique_ptr<>
// (this is allowed)
// define either NO_TR1 or CXXOMFORT_NO_TR1 to disable
// using this TR1 extension in C++03
//
#include <functional> // std::hash, from Tr1

CXXO_OPEN_STDTR1() //namespace std { namespace tr1 {
    template <typename T, typename D>
    struct hash< ::std::unique_ptr<T,D> >
    : private hash< typename unique_ptr<T,D>::pointer > {
        private:
        typedef hash< typename unique_ptr<T,D>::pointer > base_type;
        public:
        typedef unique_ptr<T,D> argument_type;
        typedef size_t result_type;
        size_t operator() (argument_type const& t) const {
            //return static_cast<base_type>(*this).operator()(t.get());
            return static_cast<base_type const*>(this)->operator()(t.get());
        }
    };
CXXO_CLOSE_STDTR1() // } /* tr1 */ }
    #endif
#endif


#endif // file

/**
................................................................................
 *
 * * <tt>to_bool(<std::unique_ptr> const&)</tt> - briefer validity check to @c bool .
 * * <tt>to_bool(<std::shared_ptr> const&)</tt> - briefer validity check to @c bool .
 * * <tt>malloc_deleter</tt>.
 *
 * @section also See Also
 *
 * * @see @cppref{header/memory}
 *
 * */







>







 







>




>







 







>
>
>









>
>
>
>
>








>
>
>







 







|






|
>
|













|







 







|


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
..
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
...
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
...
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
...
307
308
309
310
311
312
313
314
315
316
#pragma message CXXO_NOTICE("enabled <memory> support.")
#endif


#if (CXXOFLAG_namespace_tr1>0)
	#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG)
	#include <tr1/memory>
	#include <tr1/functional> // for hash
namespace std {
	using tr1::shared_ptr;
	//using tr1::make_shared;
	using tr1::weak_ptr;
}
	#endif
#endif
................................................................................
#else

namespace std {
	template <typename T> struct default_delete {

		default_delete () throw() {}

#if (CXXO_COMPILER_SUPPORT_std_is_constructible_traits)
		template <class U>
		default_delete ( default_delete<U> const&
		, typename std::enable_if<std::is_convertible<U*, T*>::value, void>::type* = 0 )
		{ }
#endif

		void operator() (T* ptr) const  CXXO_NOEXCEPTNOTHROW   {
			static_assert (sizeof(T) > 0, "T must be a complete type");
			delete ptr;
		}

	};
................................................................................
#include "impl/p0040-memory_management.hpp"


//
// cxxomfort::fix assist: to_bool
//

#if (CXXOMFORT_CXX_STD>=2011 || CXXOMFORT_CXX_EMULATION>=2011) 
	#if (CXXOFLAG_tr1)

// assist
namespace cxxomfort { namespace fix {
template <typename T>
bool to_bool (std::shared_ptr<T> const& p) CXXO_NOEXCEPTNOTHROW {
	return p.get() != nullptr;
}

} } // cxxomfort::fix

	#endif
#endif

#if defined(CXXOMFORT_USING_unique_ptr)

// assist
namespace cxxomfort { namespace fix {
template <typename T>
bool to_bool (std::unique_ptr<T> const& p) CXXO_NOEXCEPTNOTHROW {
    return p.get() != nullptr;
}

} } // cxxomfort::fix

#endif




#if defined(CXXOMFORT_USING_MEMTOOLS)

// We define alignas, alignof depending on compiler specifics
#if 0
................................................................................
};

} } // cxxomfort::fix::


// -- set up needed things in std::
#if (CXXOMFORT_CXX_STD < 2011 && defined(CXXOMFORT_USING_unique_ptr))
    #if (CXXOFLAG_tr1)
//
// specialize std::tr1::hash for unique_ptr<>
// (this is allowed)
// define either NO_TR1 or CXXOMFORT_NO_TR1 to disable
// using this TR1 extension in C++03
//
#include CXXO_INCLUDE_SYS(functional) // std::hash, from Tr1
//#include <cxxomfort/functional.hpp>
CXXO_STDTR1_OPEN() //namespace std { namespace tr1 {
    template <typename T, typename D>
    struct hash< ::std::unique_ptr<T,D> >
    : private hash< typename unique_ptr<T,D>::pointer > {
        private:
        typedef hash< typename unique_ptr<T,D>::pointer > base_type;
        public:
        typedef unique_ptr<T,D> argument_type;
        typedef size_t result_type;
        size_t operator() (argument_type const& t) const {
            //return static_cast<base_type>(*this).operator()(t.get());
            return static_cast<base_type const*>(this)->operator()(t.get());
        }
    };
CXXO_STDTR1_CLOSE() // } /* tr1 */ }
    #endif
#endif


#endif // file

/**
................................................................................
 *
 * * <tt>to_bool(<std::unique_ptr> const&)</tt> - briefer validity check to @c bool .
 * * <tt>to_bool(<std::shared_ptr> const&)</tt> - briefer validity check to @c bool .
 * * <tt>malloc_deleter</tt>.
 *
 * @section also See Also
 *
 * * @see @cppref{header/memory} (cppreference)
 *
 * */

Changes to cxxomfort/cxxomfort/numeric.hpp.

50
51
52
53
54
55
56




















57
58
59
60
61
62
63
..
78
79
80
81
82
83
84







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
 * @sa gcd
 */
template <typename IM, typename IN>
CXXO_CONSTEXPR IM lcm (IM m, IN n) CXXO_NOEXCEPT {
    return m / gcd(m,n) * n;
}





















} // numeric
}


#if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
#pragma message CXXO_NOTICE("enabled <numeric> support.")
#endif
................................................................................
    namespace std {
        using ::cxxomfort::cxxostd::gcd;
        using ::cxxomfort::cxxostd::lcm;
    }
    #endif
#endif // no std using








#endif

/**
 * @page std0numeric <numeric>
 * @brief Backports from <numeric>
 * 
 * Interfaces defined in this section:
 * 
 * * @c iota() (C++11) -  generate sequences of increasing values.
 * * @c gcd() , @c lcm() (C++17) - math functions.
 * 
 * @section also See Also
 * 
 * * @see @cppref{header/numeric} 
 * * @see @ref std0algorithm
 * * @ref cxxo-sup-numeric (supplemental).
 */







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>













|



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
 * @sa gcd
 */
template <typename IM, typename IN>
CXXO_CONSTEXPR IM lcm (IM m, IN n) CXXO_NOEXCEPT {
    return m / gcd(m,n) * n;
}


// 
// midpoint, from C++20
// 

#if (CXXOMFORT_CXX_STD < 2020)
	#define CXXOMFORT_USING_midpoint
template <typename Numeric>
CXXO_CONSTEXPR Numeric midpoint (Numeric n1, Numeric n2) CXXO_NOEXCEPTNOTHROW {
	return n1/Numeric(2) + n2/Numeric(2);
}


template <typename T>
CXXO_CONSTEXPR T* midpoint (T* p1, T* p2) CXXO_NOEXCEPTNOTHROW {
	return p1+(p2-p1)/2;
}
#endif

	
} // numeric
}


#if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
#pragma message CXXO_NOTICE("enabled <numeric> support.")
#endif
................................................................................
    namespace std {
        using ::cxxomfort::cxxostd::gcd;
        using ::cxxomfort::cxxostd::lcm;
    }
    #endif
#endif // no std using

#if defined(CXXOMFORT_USING_midpoint)
namespace std {
	using ::cxxomfort::cxxostd::midpoint;
}
	#undef CXXOMFORT_USING_midpoint
#endif

#endif

/**
 * @page std0numeric <numeric>
 * @brief Backports from <numeric>
 * 
 * Interfaces defined in this section:
 * 
 * * @c iota() (C++11) -  generate sequences of increasing values.
 * * @c gcd() , @c lcm() (C++17) - math functions.
 * 
 * @section also See Also
 * 
 * * @see @cppref{header/numeric} (cppreference)
 * * @see @ref std0algorithm
 * * @ref cxxo-sup-numeric (supplemental).
 */

Changes to cxxomfort/cxxomfort/typeindex.hpp.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
..
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 * @see https://en.cppreference.com/w/cpp/header/typeindex
 * 
 */

#include "config.hpp"
#include "base.hpp"   // move, forward

#if (CXXOMFORT_CXX_STD >= 2011 || CXXO_COMPILER_SUPPORT_cstd_typeindex>0)
    #include <typeindex>

#elif (CXXOMFORT_CXX_STD>=1997)

	#include <cxxomfort/impl/11-typeindex.hpp>

    #if (defined( CXXOFLAG_NO_STD_USING ) && CXXOFLAG_NO_STD_USING>0)
................................................................................
    using ::cxxomfort::cxxostd::type_index;
}
	#endif // no_std_using

#endif


#if (CXXOMFORT_CXX_STD >= 2011 || CXXO_COMPILER_SUPPORT_cstd_typeindex>0)
#else
namespace std {
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_CXX_EMULATION==0)
    namespace tr1 {
    #endif
    
    template<>







|







 







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
..
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 * @see https://en.cppreference.com/w/cpp/header/typeindex
 * 
 */

#include "config.hpp"
#include "base.hpp"   // move, forward

#if (CXXOMFORT_CXX_STD >= 2011 || CXXO_CXXSTDHEADER_typeindex>0)
    #include <typeindex>

#elif (CXXOMFORT_CXX_STD>=1997)

	#include <cxxomfort/impl/11-typeindex.hpp>

    #if (defined( CXXOFLAG_NO_STD_USING ) && CXXOFLAG_NO_STD_USING>0)
................................................................................
    using ::cxxomfort::cxxostd::type_index;
}
	#endif // no_std_using

#endif


#if (CXXOMFORT_CXX_STD >= 2011 || CXXO_CXXSTDHEADER_typeindex>0)
#else
namespace std {
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_CXX_EMULATION==0)
    namespace tr1 {
    #endif
    
    template<>

Changes to cxxomfort/cxxomfort/using.hpp.

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
 * @namespace std
 * @brief Namespace of the Standard C++ Features
 * 
 */
#if (CXXOMFORT_CXX_STD < 2011 /* && CXXOMFORT_CXX_EMULATION < 2011 */)

#include <array>

namespace std { namespace tr1 {} } // ensure that the tr1 name exists
namespace std { 
#if 1


#else








<
<







23
24
25
26
27
28
29


30
31
32
33
34
35
36
/**
 * @namespace std
 * @brief Namespace of the Standard C++ Features
 * 
 */
#if (CXXOMFORT_CXX_STD < 2011 /* && CXXOMFORT_CXX_EMULATION < 2011 */)



namespace std { namespace tr1 {} } // ensure that the tr1 name exists
namespace std { 
#if 1


#else

Changes to cxxomfort/tags/cxxomfort-macros.cpp.tags.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
CXXOMFORT_CXX_EMULATION|unsigned int: yyyy (year of STD)||
CXXOMFORT_NOTICES|int|noticelevel|
CXXO_NOTICE||("message")|
CXXO_WARNING||("warning")|
CXXOFLAG_SHADOW_KEYWORD_constexpr|||
CXXOFLAG_INCLUDE_PATH|||
#code generation
CXXO_COMPILERVERSION_COMPARE|BOOL|(compilerid_,  version_)|
CXXOMFORT_CXX11_CODE|code...|(cxx11onward_code,cxx03upto_code)|
CXXOMFORT_CXX14_CODE|code...|(cxx14onward_code,cxx11upto_code)|
CXXOMFORT_CXX17_CODE|code...|(cxx17onward_code,cxx14upto_code)|
CXXO_AUTO|type?|(name , expression)|
CXXO_I12N_BEG||(Sequence_Type , Variable_Name)|
CXXO_I12N_END||(Sequence_Type , Variable_Name)|
CXXO_I12N_SEQ||(Sequence_Type , Variable_Name , { sequence...})|







|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
CXXOMFORT_CXX_EMULATION|unsigned int: yyyy (year of STD)||
CXXOMFORT_NOTICES|int|noticelevel|
CXXO_NOTICE||("message")|
CXXO_WARNING||("warning")|
CXXOFLAG_SHADOW_KEYWORD_constexpr|||
CXXOFLAG_INCLUDE_PATH|||
#code generation
CXXO_COMPILERVERSION_COMPARE|BOOL|(compilerid_, <=> version_)|
CXXOMFORT_CXX11_CODE|code...|(cxx11onward_code,cxx03upto_code)|
CXXOMFORT_CXX14_CODE|code...|(cxx14onward_code,cxx11upto_code)|
CXXOMFORT_CXX17_CODE|code...|(cxx17onward_code,cxx14upto_code)|
CXXO_AUTO|type?|(name , expression)|
CXXO_I12N_BEG||(Sequence_Type , Variable_Name)|
CXXO_I12N_END||(Sequence_Type , Variable_Name)|
CXXO_I12N_SEQ||(Sequence_Type , Variable_Name , { sequence...})|

Changes to cxxomfort/tags/cxxomfort.cpp.tags.

33
34
35
36
37
38
39

40
41
42
43

44
45

46
47
48
49
50
51
52
ptr_fun|nullary_functor|(Ret(*fn)())|
make_equivalence|equivalent_to<void>|()|
#iterator
ssize|ptrdiff_t|(Object&)|
make_fake_iterator|fake_iterator|(T const& t)|
#memory
to_bool|bool|(unique_ptr<T> const& resource)|

#numeric
to_signed|signed T|(T t)|
to_unsigned|unsigned T|(T t)|
static_minmax|with.[min_value,max_value]|<T... args>|

static_clamp|with.[value]|<T... args>|
#random

random_global_engine|default_random_engine&|()|
reseed|[over default_random_engine]|(Engine::result_type)|
randint|Integer|(Integer from, Integer to)|
lcg_numerical_recipes_rand|lcg_numerical_recipes_rand|()|
MMIX_rand|MMIX_rand|()|
xkcd221_r|xkcd221_r|()|
splitmix64|splitmix64|()|







>




>


>







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
ptr_fun|nullary_functor|(Ret(*fn)())|
make_equivalence|equivalent_to<void>|()|
#iterator
ssize|ptrdiff_t|(Object&)|
make_fake_iterator|fake_iterator|(T const& t)|
#memory
to_bool|bool|(unique_ptr<T> const& resource)|
to_bool|bool|(shared_ptr<T> const& resource)|
#numeric
to_signed|signed T|(T t)|
to_unsigned|unsigned T|(T t)|
static_minmax|with.[min_value,max_value]|<T... args>|
static_log|with.[value]|<T num, T base>|
static_clamp|with.[value]|<T... args>|
#random
randmo|int in [0..mo)|(int mo)|
random_global_engine|default_random_engine&|()|
reseed|[over default_random_engine]|(Engine::result_type)|
randint|Integer|(Integer from, Integer to)|
lcg_numerical_recipes_rand|lcg_numerical_recipes_rand|()|
MMIX_rand|MMIX_rand|()|
xkcd221_r|xkcd221_r|()|
splitmix64|splitmix64|()|