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

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | msvc_max_1700 | pre-release | y2019 | gcc_min_404 | msvc_min_1599
Files: files | file ages | folders
SHA3-256:deb4709981f729f996387add1948561149ee251f19b5051fc6d5e4c0fd63252e
User & Date: luismachuca 2019-08-26 04:23:00
Context
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
2019-08-22
19:09
Commit 2019-08-22 - A forgotten error in <memory>.
  • config: Updated some changes to documentation.
  • memory: Fixed a wrong argument name in uninitialized_default_construct.
  • system_error: Fixed errc not default-constructing to zero in C++03 like enums do.
  • docgen: Improved documentation for library:tuple, library:typesafe_enum.
check-in: d5fcc075 user: luismachuca tags: trunk, y2019, gcc_min_404, clang_min_302, docgen, openwatcom_min_200
Changes

Changes to cxxomfort/CHANGELOG.txt.




















1
2
3
4
5
6
7



















Commit 2019-08-22 - A forgotten error in <memory>.

  *  config: Updated some changes to documentation.
  *  memory: Fixed a wrong argument name in <tt>uninitialized_default_construct</tt>.
  *  system_error: Fixed <tt>errc</tt>  not default-constructing to zero in C++03 like enums do.
  *  docgen: Improved documentation for library:tuple, library:typesafe_enum.

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







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
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]).
  *  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 <tt>make_integer_sequence</tt> et al, to use C++11 <tt>using... = </tt> where appropriate.
  *  library:array_ref: Made def-ctor trivial in C++11 and do the "right thing" in <C++11.


Commit 2019-08-22 - A forgotten error in <memory>.

  *  config: Updated some changes to documentation.
  *  memory: Fixed a wrong argument name in <tt>uninitialized_default_construct</tt>.
  *  system_error: Fixed <tt>errc</tt>  not default-constructing to zero in C++03 like enums do.
  *  docgen: Improved documentation for library:tuple, library:typesafe_enum.

Changes to cxxomfort/cxxomfort/array.hpp.

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
 *
 */

#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>


#if (CXXOMFORT_CXX_STD<1997 && CXXO_COMPILER_SUPPORT_tr1_array==0)
#include "impl/03-array.hpp"

namespace std {
	using ::cxxomfort::cxxostd::array::array;
}

#elif (CXXOMFORT_CXX_STD < 2011)

	#include <array>
	#if (CXXOFLAG_namespace_tr1>0)


namespace std {
    using tr1::array;
    using tr1::get;
}

	#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,<1600) )
namespace std {
	using tr1::array;
	using tr1::get;
}

	#endif

#else // C++>=2011
	#include <array>
#endif // CXX_STD

#endif







|
|
|
|
|
|
|
|
|
|
|
|
>




<
<
<
<
<
<
<







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
 *
 */

#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>


#if (CXXOMFORT_CXX_STD<1997 && defined CXXO_USE_INTERNAL_TR1)
	// not even C++03
	#include "impl/07-array.hpp"

#elif (CXXOMFORT_CXX_STD < 2011 && CXXOFLAG_tr1 > 0)
	// c++03, with TR1
	#if (CXXOFLAG_directory_tr1>0)
		#include <tr1/array>
	#else 
		#include <array>
	#endif

	#if (CXXOFLAG_namespace_tr1>0)
namespace std {
    using tr1::array;
    using tr1::get;
}







	#endif

#else // C++>=2011
	#include <array>
#endif // CXX_STD

#endif

Changes to cxxomfort/cxxomfort/backports.hpp.

13
14
15
16
17
18
19

20
21
22
23
24
25
26
..
34
35
36
37
38
39
40

41
 * utilities as well as the available backports for the major 
 * standard headers in the library.
 * 
 * */
#include "config.hpp"
#include "base.hpp"


#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 "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...)


#endif







>







 







>

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
35
36
37
38
39
40
41
42
43
 * utilities as well as the available backports for the major 
 * 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 "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

Added cxxomfort/cxxomfort/cerrno.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#ifndef CXXOMFORT_CERRNO_HPP
#define CXXOMFORT_CERRNO_HPP
/**
 * @file
 * @brief Implementations and completion of names tied to <cerrno>.
 * @xrefitem std0cerrno "<cerrno>" ""
 *
 */

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

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

#if (CXXOMFORT_CXX_STD < 2011)

	#if 0
	#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)
		// drawn from the <cerrno> for MSVC 2013
		// section "POSIX supplement"
#ifndef EADDRINUSE
#define EADDRINUSE      100
#endif
#ifndef EADDRNOTAVAIL
#define EADDRNOTAVAIL   101
#endif
#ifndef EAFNOSUPPORT
#define EAFNOSUPPORT    102
#endif
#ifndef EALREADY
#define EALREADY        103
#endif
#ifndef EBADMSG
#define EBADMSG         104
#endif
#ifndef ECANCELED
#define ECANCELED       105
#endif
#ifndef ECONNABORTED
#define ECONNABORTED    106
#endif
#ifndef ECONNREFUSED	
#define ECONNREFUSED    107
#endif
#ifndef ECONNRESET
#define ECONNRESET      108
#endif
#ifndef EDESTADDRREQ
#define EDESTADDRREQ    109
#endif
#ifndef EHOSTUNREACH
#define EHOSTUNREACH    110
#endif
#ifndef EIDRM
#define EIDRM           111
#endif
#ifndef EINPROGRESS
#define EINPROGRESS     112
#endif
#ifndef EISCONN
#define EISCONN         113
#endif
#ifndef ELOOP
#define ELOOP           114
#endif
#ifndef EMSGSIZE
#define EMSGSIZE        115
#endif
#ifndef ENETDOWN
#define ENETDOWN        116
#endif
#ifndef ENETRESET
#define ENETRESET       117
#endif
#ifndef ENETUNREACH
#define ENETUNREACH     118
#endif
#ifndef ENOBUFS
#define ENOBUFS         119
#endif
#ifndef ENODATA
#define ENODATA         120
#endif
#ifndef ENOLINK
#define ENOLINK         121
#endif
#ifndef ENOMSG
#define ENOMSG          122
#endif
#ifndef ENOPROTOOPT
#define ENOPROTOOPT     123
#endif
#ifndef ENOSR
#define ENOSR           124
#endif
#ifndef ENOSTR
#define ENOSTR          125
#endif
#ifndef ENOTCONN
#define ENOTCONN        126
#endif
#ifndef ENOTRECOVERABLE
#define ENOTRECOVERABLE 127
#endif
#ifndef ENOTSOCK
#define ENOTSOCK        128
#endif
#ifndef ENOTSUP
#define ENOTSUP         129
#endif
#ifndef EOPNOTSUPP
#define EOPNOTSUPP      130
#endif
#ifndef EOTHER
#define EOTHER          131
#endif
#ifndef EOVERFLOW
#define EOVERFLOW       132
#endif
#ifndef EOWNERDEAD
#define EOWNERDEAD      133
#endif
#ifndef EPROTO
#define EPROTO          134
#endif
#ifndef EPROTONOSUPPORT
#define EPROTONOSUPPORT 135
#endif
#ifndef EPROTOTYPE
#define EPROTOTYPE      136
#endif
#ifndef ETIME
#define ETIME           137
#endif
#ifndef ETIMEDOUT
#define ETIMEDOUT       138
#endif
#ifndef ETXTBSY
#define ETXTBSY         139
#endif
#ifndef EWOULDBLOCK
#define EWOULDBLOCK     140
#endif


	#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG)
		// drawn from the <cerrno> for GCC 4.9
		#include <errno.h>
		#include <unistd.h>
	#endif
#endif


#endif

Changes to cxxomfort/cxxomfort/config.hpp.

214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
...
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487

488
489
490


491
492
493
494
495
496
497
    #define CXXOMFORT_ARCHITECTURE 0
#endif


/*
 * Opens the namespace where tr1 extensions live
 * */
#if ((CXXOMFORT_CXX_STD < 2011) && (\
    (CXXOMFORT_CXX_EMULATION < 2011 && CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC) || \
    (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG) || \
    (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC && CXXOMFORT_COMPILER_VERSION < 1600) \
) )
	#define CXXOFLAG_namespace_tr1 1
    #define CXXO_namespace_tr1 std::tr1
    #define CXXO_OPEN_STDTR1() namespace std { namespace tr1 {
    #define CXXO_CLOSE_STDTR1() } }
    #if (defined(CXXOMFORT_NOTICES) && CXXOMFORT_NOTICES > 1)
		#pragma message CXXO_NOTICE ("namespace tr1")
	#endif
#else 
	#define CXXOFLAG_namespace_tr1 0
    #define CXXO_namespace_tr1 std
    #define CXXO_OPEN_STDTR1() namespace std { 
    #define CXXO_CLOSE_STDTR1() } 
#endif


//
// ---------------------------------------------------------
//

// Macros to conditionally generate keywords

................................................................................
 * 
 * This section describes the various values that provide information 
 * about cxxomfort and the values they can take.
 * 
 * **Version information**:
 * 
 * * @c CXXOMFORT_DATE - date of release.
 * * @c CXXOMFORT_VERSION - version number.
 * * @c CXXOMFORT_CXX_STD - the year of the C++ Standard running in the compiler.
 * * @c CXXOMFORT_CXX_EMULATION - the year of the standard emulated by the compiler.
 * 
 * **Informative macros**:
 * 
 * * @c CXXOMFORT_NOTICES - enables diagnostic messages.
 * * @c CXXO_namespace_tr1 - has the name of the namespace where TR1 names live.

 * 
 * 
 * **Code Generation**:


 * 
 * See @ref cxxomfort-codegen .
 * 
 */

/**
 * @page cxxomfort-fix







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|






|
>



>
>







214
215
216
217
218
219
220



















221
222
223
224
225
226
227
...
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
    #define CXXOMFORT_ARCHITECTURE 0
#endif


/*
 * Opens the namespace where tr1 extensions live
 * */




















//
// ---------------------------------------------------------
//

// Macros to conditionally generate keywords

................................................................................
 * 
 * This section describes the various values that provide information 
 * about cxxomfort and the values they can take.
 * 
 * **Version information**:
 * 
 * * @c CXXOMFORT_DATE - date of release.
 * * @c CXXOMFORT_VERSION - version number (to be deprecated).
 * * @c CXXOMFORT_CXX_STD - the year of the C++ Standard running in the compiler.
 * * @c CXXOMFORT_CXX_EMULATION - the year of the standard emulated by the compiler.
 * 
 * **Informative macros**:
 * 
 * * @c CXXOMFORT_NOTICES - enables diagnostic messages.
 * * @c CXXO_STDTR1_NAME() - has the name of the namespace where TR1 names live.
 * * @c CXXO_STDTR1_OPEN() , @c CXXO_STDTR1_CLOSE() - open and close the namespace where TR1 things live
 * 
 * 
 * **Code Generation**:
 * 
 * * @c CXXOFLAG_USE_INTERNAL_TR1 - if defined by the user in pre-C++11 mode, attempt to use some baseline TR1 features defined by cxxomfort.
 * 
 * See @ref cxxomfort-codegen .
 * 
 */

/**
 * @page cxxomfort-fix

Changes to cxxomfort/cxxomfort/config/_support.hpp.

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
..
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
...
139
140
141
142
143
144
145




146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166

//! If compiler supports a <tt>__alignof</tt> intrinsic.
#define CXXO_COMPILER_SUPPORT___alignof 0 
//! If compiler supports the type-category intrinsics (is_enum, is_class, is_union).
#define CXXO_COMPILER_SUPPORT_type_intrinsics 0 
//! If compiler provides support for <code>\<functional\></code>'s classic binders.
#define CXXO_COMPILER_SUPPORT_functional_oldstyle (CXXOMFORT_CXX_STD<2017)
//! If compiler includes <array> features in std::tr1
#define CXXO_COMPILER_SUPPORT_tr1_array 0
//! If compiler includes <cstdint> features in std::tr1
#define CXXO_COMPILER_SUPPORT_tr1_cstdint 0
//! If compiler includes <random> features in std::tr1
#define CXXO_COMPILER_SUPPORT_tr1_random 0
//! If compiler includes <tuple> features in std::tr1
#define CXXO_COMPILER_SUPPORT_tr1_tuple 0
//! If compiler includes <type_traits> features in std::tr1
#define CXXO_COMPILER_SUPPORT_tr1_type_traits 0
//! If compiler provides support for @c __typeof__ in C++03.
#define CXXO_COMPILER_SUPPORT_typeof 0
//! If compiler provides support for variadic macros (<code>__VA_ARG__</code>).
#define CXXO_COMPILER_SUPPORT_va_args 0







// c++11 stuff




















//! If compiler provides support for alignment tools (@c alignas , @c aligned_storage , etc).
#define CXXO_COMPILER_SUPPORT_alignment_tools 0
//! If compiler provides support for @c alignof(T) .
#define CXXO_COMPILER_SUPPORT_alignof 0
//! If compiler provides support for <code>[[__attribute__]]</code>.
#define CXXO_COMPILER_SUPPORT_attribute (CXXOMFORT_CXX_STD >= 2011)
//! If compiler supports new (type-deduction) semantics for @c auto .
................................................................................
#define CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF 0
//! If compiler provides support for variadic common_type
#define CXXO_COMPILER_SUPPORT_common_type (CXXOMFORT_CXX_STD>=2011)
//! If compiler provides support for the new C++11 helpers std::enable_if, std::conditional.
#define CXXO_COMPILER_SUPPORT_conditional_enableif (CXXOMFORT_CXX_STD>=2011)
//! If compiler provides support for @c constexpr .
#define CXXO_COMPILER_SUPPORT_constexpr (CXXOMFORT_CXX_STD>=2011)
//! If compiler provides a <cinttypes> header
#define CXXO_COMPILER_SUPPORT_cstd_cinttypes (CXXOMFORT_CXX_STD>=2011)
//! If compiler provides a <cstdint> header
#define CXXO_COMPILER_SUPPORT_cstd_cstdint (CXXOMFORT_CXX_STD>=2011)
//! If compiler supports <cuchar> header.
#define CXXO_COMPILER_SUPPORT_cstd_cuchar (CXXOMFORT_CXX_STD>=2011)
//! If compiler brings <system_error> header.
#define CXXO_COMPILER_SUPPORT_cstd_system_error (CXXOMFORT_CXX_STD>=2011)
//! If compiler brings <typeindex> header.
#define CXXO_COMPILER_SUPPORT_cstd_typeindex (CXXOMFORT_CXX_STD>=2011)
//! If compiler supports @c decltype(expr) .
#define CXXO_COMPILER_SUPPORT_decltype (CXXOMFORT_CXX_STD>=2011)
//! If compiler provides support for <code>=default</code>-ed and <code>=delete</code>-d members.
#define CXXO_COMPILER_SUPPORT_default_delete (CXXOMFORT_CXX_STD>=2011)
//! If compiler provides support for scoped enumerations ie.: <code>enum class...</code>.
#define CXXO_COMPILER_SUPPORT_enum_class (CXXOMFORT_CXX_STD>=2011)
//! If compiler provides support for <code>explicit operator ...</code> casts.
................................................................................
//! If compiler provides support for "integer_sequence".
#define CXXO_COMPILER_SUPPORT_integer_sequence (CXXOMFORT_CXX_STD >= 2014)
//! If compiler provides support for C++14's nonstatic data member init (NSDMI)
#define CXXO_COMPILER_SUPPORT_nsdmi (CXXOMFORT_CXX_STD>=2014)

// c++17 stuff





//! If compiler provides support for C++14's [[nodiscard]]
#define CXXO_COMPILER_SUPPORT_attribute_nodiscard (CXXOMFORT_CXX_STD>=2017)
//! If compiler support static assert with no message (n3928)
#define CXXO_COMPILER_SUPPORT_static_assert_17 (CXXOMFORT_CXX_STD >= 2017)
//! If compiler provides support for C++17's std::byte
#define CXXO_COMPILER_SUPPORT_std_byte (CXXOMFORT_CXX_STD>=2017)
//! If compiler provides support for C++17's void_t and make_void
#define CXXO_COMPILER_SUPPORT_std_voidt (CXXOMFORT_CXX_STD>=2017)


// c++20 stuff

//! If compiler provides support for endianness tag (std::endian)
#define CXXO_COMPILER_SUPPORT_cstd_endian (CXXOMFORT_CXX_STD>=2020)



//------------------------------------------------
/*
 * List of C++ features for documentation
 * 







|

|

|

|

|

|




>
>
>
>
>
>


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







 







<
<
<
<
<
<
<
<
<
<







 







>
>
>
>













|







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
..
92
93
94
95
96
97
98










99
100
101
102
103
104
105
...
154
155
156
157
158
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

//! If compiler supports a <tt>__alignof</tt> intrinsic.
#define CXXO_COMPILER_SUPPORT___alignof 0 
//! If compiler supports the type-category intrinsics (is_enum, is_class, is_union).
#define CXXO_COMPILER_SUPPORT_type_intrinsics 0 
//! If compiler provides support for <code>\<functional\></code>'s classic binders.
#define CXXO_COMPILER_SUPPORT_functional_oldstyle (CXXOMFORT_CXX_STD<2017)
//! If compiler declares std::tr1::array<> et al.
#define CXXO_COMPILER_SUPPORT_tr1_array 0
//! If compiler declares std::tr1::uint16_t et al.
#define CXXO_COMPILER_SUPPORT_tr1_cstdint 0
//! If compiler declares std::tr1::uniform_int_distribution et al.
#define CXXO_COMPILER_SUPPORT_tr1_random 0
//! If compiler declares std::tr1::tuple<> et al.
#define CXXO_COMPILER_SUPPORT_tr1_tuple 0
//! If compiler declares std::tr1::is_const<> et al.
#define CXXO_COMPILER_SUPPORT_tr1_type_traits 0
//! If compiler provides support for @c __typeof__ eg.: in C++03.
#define CXXO_COMPILER_SUPPORT_typeof 0
//! If compiler provides support for variadic macros (<code>__VA_ARG__</code>).
#define CXXO_COMPILER_SUPPORT_va_args 0

#define CXXO_STDTR1_OPEN() STDTR1_OPEN() namespace std  {
#define CXXO_STDTR1_CLOSE()  }
#define CXXO_STDTR1_NAME() std::tr1 
#define CXXOFLAG_directory_tr1 0
#define CXXOFLAG_namespace_tr1 0

// c++11 stuff

//! If compiler provides a <array> header
#define CXXO_CXXSTDHEADER_array (CXXOMFORT_CXX_STD>=2011)
//! If compiler provides a <cinttypes> header
#define CXXO_CXXSTDHEADER_cinttypes (CXXOMFORT_CXX_STD>=2011)
//! If compiler provides a <cstdint> header
#define CXXO_CXXSTDHEADER_cstdint (CXXOMFORT_CXX_STD>=2011)
//! If compiler supports <cuchar> header.
#define CXXO_CXXSTDHEADER_cuchar (CXXOMFORT_CXX_STD>=2011)
//! If compiler brings <random> header.
#define CXXO_CXXSTDHEADER_random (CXXOMFORT_CXX_STD>=2011)
//! If compiler brings <system_error> header.
#define CXXO_CXXSTDHEADER_system_error (CXXOMFORT_CXX_STD>=2011)
//! If compiler brings <tuple> header.
#define CXXO_CXXSTDHEADER_tuple (CXXOMFORT_CXX_STD>=2011)
//! If compiler brings <typeindex> header.
#define CXXO_CXXSTDHEADER_typeindex (CXXOMFORT_CXX_STD>=2011)
//! If compiler brings <type_traits> header.
#define CXXO_CXXSTDHEADER_type_traits (CXXOMFORT_CXX_STD>=2011)

//! If compiler provides support for alignment tools (@c alignas , @c aligned_storage , etc).
#define CXXO_COMPILER_SUPPORT_alignment_tools 0
//! If compiler provides support for @c alignof(T) .
#define CXXO_COMPILER_SUPPORT_alignof 0
//! If compiler provides support for <code>[[__attribute__]]</code>.
#define CXXO_COMPILER_SUPPORT_attribute (CXXOMFORT_CXX_STD >= 2011)
//! If compiler supports new (type-deduction) semantics for @c auto .
................................................................................
#define CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF 0
//! If compiler provides support for variadic common_type
#define CXXO_COMPILER_SUPPORT_common_type (CXXOMFORT_CXX_STD>=2011)
//! If compiler provides support for the new C++11 helpers std::enable_if, std::conditional.
#define CXXO_COMPILER_SUPPORT_conditional_enableif (CXXOMFORT_CXX_STD>=2011)
//! If compiler provides support for @c constexpr .
#define CXXO_COMPILER_SUPPORT_constexpr (CXXOMFORT_CXX_STD>=2011)










//! If compiler supports @c decltype(expr) .
#define CXXO_COMPILER_SUPPORT_decltype (CXXOMFORT_CXX_STD>=2011)
//! If compiler provides support for <code>=default</code>-ed and <code>=delete</code>-d members.
#define CXXO_COMPILER_SUPPORT_default_delete (CXXOMFORT_CXX_STD>=2011)
//! If compiler provides support for scoped enumerations ie.: <code>enum class...</code>.
#define CXXO_COMPILER_SUPPORT_enum_class (CXXOMFORT_CXX_STD>=2011)
//! If compiler provides support for <code>explicit operator ...</code> casts.
................................................................................
//! If compiler provides support for "integer_sequence".
#define CXXO_COMPILER_SUPPORT_integer_sequence (CXXOMFORT_CXX_STD >= 2014)
//! If compiler provides support for C++14's nonstatic data member init (NSDMI)
#define CXXO_COMPILER_SUPPORT_nsdmi (CXXOMFORT_CXX_STD>=2014)

// c++17 stuff

//! If compiler provides a <charconv> header
#define CXXO_CXXSTDHEADER_charconv (CXXOMFORT_CXX_STD>=2017)
//! If compiler provides a <string_view> header
#define CXXO_CXXSTDHEADER_string_view (CXXOMFORT_CXX_STD>=2017)
//! If compiler provides support for C++14's [[nodiscard]]
#define CXXO_COMPILER_SUPPORT_attribute_nodiscard (CXXOMFORT_CXX_STD>=2017)
//! If compiler support static assert with no message (n3928)
#define CXXO_COMPILER_SUPPORT_static_assert_17 (CXXOMFORT_CXX_STD >= 2017)
//! If compiler provides support for C++17's std::byte
#define CXXO_COMPILER_SUPPORT_std_byte (CXXOMFORT_CXX_STD>=2017)
//! If compiler provides support for C++17's void_t and make_void
#define CXXO_COMPILER_SUPPORT_std_voidt (CXXOMFORT_CXX_STD>=2017)


// c++20 stuff

//! If compiler provides support for endianness tag (std::endian)
#define CXXO_CXXSTDHEADER_endian (CXXOMFORT_CXX_STD>=2020)



//------------------------------------------------
/*
 * List of C++ features for documentation
 * 

Changes to cxxomfort/cxxomfort/config/clang.hpp.

132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148



// -- TODO -- get my claws on clang >= 3.2
// -- NEW TODO -- get my claws on clang >= 5.0 (2019-01)

#if (CXXOMFORT_COMPILER_VERSION > 300 && CXXOMFORT_COMPILER_VERSION < 400)
	#if (CXXO_COMPILER_SUPPORT_cstd_cuchar)
		#undef  CXXO_COMPILER_SUPPORT_cstd_cuchar
		#define CXXO_COMPILER_SUPPORT_cstd_cuchar 0
	#endif
#endif

// treats ::max_align_t differently depending on stdlib or libc++
#if (CXXOMFORT_CXX_STD<2011)
	#if (defined(_LIBCPP))
	#else







|
|
|







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148



// -- TODO -- get my claws on clang >= 3.2
// -- NEW TODO -- get my claws on clang >= 5.0 (2019-01)

#if (CXXOMFORT_COMPILER_VERSION > 300 && CXXOMFORT_COMPILER_VERSION < 400)
	#if (CXXO_CXXSTDHEADER_cuchar)
		#undef  CXXO_CXXSTDHEADER_cuchar
		#define CXXO_CXXSTDHEADER_cuchar 0
	#endif
#endif

// treats ::max_align_t differently depending on stdlib or libc++
#if (CXXOMFORT_CXX_STD<2011)
	#if (defined(_LIBCPP))
	#else

Changes to cxxomfort/cxxomfort/config/gcc.hpp.

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
...
113
114
115
116
117
118
119
120




121
122
123
124
125
126





127

128
129
130
131
132
133
134
135
136
137




















138
139
140
141
142
143
144
...
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
...
307
308
309
310
311
312
313
314
315
316
317
318
    #define CXXO_WARNING(msg) CXXO_NOTICE_IMPL_( "cxxomfort warning: " msg)
#endif

#if defined(CXXOMFORT_NOTICES)
    #pragma message( CXXO_NOTICE("Found the GNU C++ Compiler."))
#endif

#if defined(_LIBCPP)
	#pragma message CXXO_NOTICE("with libcxx")
#endif

/** GCC old versions define __cplusplus to be 1 but still have 
 * some good C++1997 and C++2003 support.
 * */
#if (CXXOMFORT_COMPILER_VERSION >= 400 && CXXOMFORT_COMPILER_VERSION <= 406 \
................................................................................

#undef  CXXO_COMPILER_SUPPORT___alignof
#define CXXO_COMPILER_SUPPORT___alignof 1
#undef  CXXO_COMPILER_SUPPORT_typeof
#define CXXO_COMPILER_SUPPORT_typeof 1
#undef  CXXO_COMPILER_SUPPORT_va_args
#define CXXO_COMPILER_SUPPORT_va_args 1





#if (CXXOMFORT_CXX_STD >= 1997 && CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011)
	#undef  CXXOFLAG_namespace_tr1 
	#define CXXOFLAG_namespace_tr1 1
#endif

// set up TR1 headers





#if (CXXOFLAG_namespace_tr1>0)

	#undef  CXXO_COMPILER_SUPPORT_tr1_array
	#define CXXO_COMPILER_SUPPORT_tr1_array 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_cstdint
    #define CXXO_COMPILER_SUPPORT_tr1_cstdint 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_random
    #define CXXO_COMPILER_SUPPORT_tr1_random 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_type_traits
    #define CXXO_COMPILER_SUPPORT_tr1_type_traits 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_tuple
    #define CXXO_COMPILER_SUPPORT_tr1_tuple 1




















#endif

// 
// features per version
// 

#if (CXXOMFORT_COMPILER_VERSION >= 403)
................................................................................
#endif
#if (CXXOMFORT_COMPILER_VERSION >= 406)
    #if (CXXOMFORT_CXX_STD< 2011) && (CXXOMFORT_CXX_EMULATION>=2011)
        #undef  CXXO_COMPILER_SUPPORT_alignof
        #define CXXO_COMPILER_SUPPORT_alignof 1
        #undef  CXXO_COMPILER_SUPPORT_auto
        #define CXXO_COMPILER_SUPPORT_auto 1
        #undef  CXXO_COMPILER_SUPPORT_cstd_cstdint
        #define CXXO_COMPILER_SUPPORT_cstd_cstdint 1
        #undef  CXXO_COMPILER_SUPPORT_cstd_system_error
        #define CXXO_COMPILER_SUPPORT_cstd_system_error 1
        #undef  CXXO_COMPILER_SUPPORT_charn_t
        #define CXXO_COMPILER_SUPPORT_charn_t 2 // defined as their own types
        #undef  CXXO_COMPILER_SUPPORT_common_type
        #define CXXO_COMPILER_SUPPORT_common_type 1
        #undef  CXXO_COMPILER_SUPPORT_conditional_enableif 
        #define CXXO_COMPILER_SUPPORT_conditional_enableif 1
        #undef  CXXO_COMPILER_SUPPORT_default_delete
................................................................................
        #undef  CXXO_COMPILER_SUPPORT_std_voidt
        #define CXXO_COMPILER_SUPPORT_std_voidt 1
    #endif
#endif

// detect lack of a <cuchar> header
#if (CXXOMFORT_COMPILER_VERSION < 600)
    #undef  CXXO_COMPILER_SUPPORT_cstd_cuchar
    #define CXXO_COMPILER_SUPPORT_cstd_cuchar 0
#endif

#endif







|







 








>
>
>
>

|
|



>
>
>
>
>
|
>










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







 







|
|
|
|







 







|
|



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
...
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
...
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
...
337
338
339
340
341
342
343
344
345
346
347
348
    #define CXXO_WARNING(msg) CXXO_NOTICE_IMPL_( "cxxomfort warning: " msg)
#endif

#if defined(CXXOMFORT_NOTICES)
    #pragma message( CXXO_NOTICE("Found the GNU C++ Compiler."))
#endif

#if (CXXOMFORT_NOTICES > 1 && defined(_LIBCPP))
	#pragma message CXXO_NOTICE("with libcxx")
#endif

/** GCC old versions define __cplusplus to be 1 but still have 
 * some good C++1997 and C++2003 support.
 * */
#if (CXXOMFORT_COMPILER_VERSION >= 400 && CXXOMFORT_COMPILER_VERSION <= 406 \
................................................................................

#undef  CXXO_COMPILER_SUPPORT___alignof
#define CXXO_COMPILER_SUPPORT___alignof 1
#undef  CXXO_COMPILER_SUPPORT_typeof
#define CXXO_COMPILER_SUPPORT_typeof 1
#undef  CXXO_COMPILER_SUPPORT_va_args
#define CXXO_COMPILER_SUPPORT_va_args 1

// 
// GCC in C++03 mode includes TR1 headers in all its versions, so far.
// 

#if (CXXOMFORT_CXX_STD >= 1997 && CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011)
	#undef  CXXOFLAG_tr1
	#define CXXOFLAG_tr1 1
#endif

// set up TR1 headers
#if (CXXOFLAG_tr1 > 0)
	// TR1 stuff is under directory tr1/
	#undef  CXXOFLAG_directory_tr1
	#define CXXOFLAG_directory_tr1 1
	// TR1 stuff is defined under namespace std::tr1
	#undef  CXXOFLAG_namespace_tr1 
	#define CXXOFLAG_namespace_tr1 1
	#undef  CXXO_COMPILER_SUPPORT_tr1_array
	#define CXXO_COMPILER_SUPPORT_tr1_array 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_cstdint
    #define CXXO_COMPILER_SUPPORT_tr1_cstdint 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_random
    #define CXXO_COMPILER_SUPPORT_tr1_random 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_type_traits
    #define CXXO_COMPILER_SUPPORT_tr1_type_traits 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_tuple
    #define CXXO_COMPILER_SUPPORT_tr1_tuple 1
	#define CXXO_CXXSTDHEADER_tr1_array 1
	#define CXXO_CXXSTDHEADER_tr1_cstdint 1
	#define CXXO_CXXSTDHEADER_tr1_cinttypes 1
	#define CXXO_CXXSTDHEADER_tr1_random 1
	#define CXXO_CXXSTDHEADER_tr1_tuple 1
	#define CXXO_CXXSTDHEADER_tr1_type_traits 1
#endif

#if (CXXOFLAG_tr1  && CXXOMFORT_CXX_EMULATION < 2011)
	#define CXXOFLAG_namespace_tr1 1
	#undef  CXXO_STDTR1_NAME
	#define CXXO_STDTR1_NAME() std::tr1
	#undef  CXXO_STDTR1_OPEN
	#define CXXO_STDTR1_OPEN() namespace std { namespace tr1 {
	#undef  CXXO_STDTR1_CLOSE
	#define CXXO_STDTR1_CLOSE() } }
	#if (defined(CXXOMFORT_NOTICES) && CXXOMFORT_NOTICES > 1)
		#pragma message CXXO_NOTICE ("namespace tr1")
	#endif

#endif

// 
// features per version
// 

#if (CXXOMFORT_COMPILER_VERSION >= 403)
................................................................................
#endif
#if (CXXOMFORT_COMPILER_VERSION >= 406)
    #if (CXXOMFORT_CXX_STD< 2011) && (CXXOMFORT_CXX_EMULATION>=2011)
        #undef  CXXO_COMPILER_SUPPORT_alignof
        #define CXXO_COMPILER_SUPPORT_alignof 1
        #undef  CXXO_COMPILER_SUPPORT_auto
        #define CXXO_COMPILER_SUPPORT_auto 1
        #undef  CXXO_CXXSTDHEADER_cstdint
        #define CXXO_CXXSTDHEADER_cstdint 1
        #undef  CXXO_CXXSTDHEADER_system_error
        #define CXXO_CXXSTDHEADER_system_error 1
        #undef  CXXO_COMPILER_SUPPORT_charn_t
        #define CXXO_COMPILER_SUPPORT_charn_t 2 // defined as their own types
        #undef  CXXO_COMPILER_SUPPORT_common_type
        #define CXXO_COMPILER_SUPPORT_common_type 1
        #undef  CXXO_COMPILER_SUPPORT_conditional_enableif 
        #define CXXO_COMPILER_SUPPORT_conditional_enableif 1
        #undef  CXXO_COMPILER_SUPPORT_default_delete
................................................................................
        #undef  CXXO_COMPILER_SUPPORT_std_voidt
        #define CXXO_COMPILER_SUPPORT_std_voidt 1
    #endif
#endif

// detect lack of a <cuchar> header
#if (CXXOMFORT_COMPILER_VERSION < 600)
    #undef  CXXO_CXXSTDHEADER_cuchar
    #define CXXO_CXXSTDHEADER_cuchar 0
#endif

#endif

Changes to cxxomfort/cxxomfort/config/msc.hpp.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
42
43
44
45
46
47
48


49
50
51
52
53
54
55
..
75
76
77
78
79
80
81

82
83








84
85
86
87
88
89












90
91
92
93
94
95
96
...
101
102
103
104
105
106
107
108

109










110
111
112
113
114
115
116
...
136
137
138
139
140
141
142







143
144
145
146
147
148
149
150
151

152
153




154
155
156
157
158
159
160
...
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#define CXXOMFORT_CONFIG_MSC_HPP

/*
 * 
 * MSVC version history
 * 
 * 14.0 / 2015 (2015-07). Generates telemetry!
 * 12.0 / 2013 (2013-10) **to be tested**
 * 11.0 / 2012 (2012-08) **preferred, Windows 7**
 * 10.0 / 2010 (2010-04)
 * 9.0 / 2008 (2007-11) **preferred**
 * 8.0 (2005-11)
 * 
 * 
 * In VC < 10, there is no such thing as C++11 emulation mode. What's more
 * important, in some versions the implementation of TR1 is broken or, in the
 * case of VC9 Express (2008) it won't install at all. 
 * Meaning that to be usable, this library needs to implement many
................................................................................
#define CXXOMFORT_COMPILER_ID CXXO_COMPILERID_MSC
#define CXXOMFORT_COMPILER_VERSION (_MSC_VER)
#define CXXOMFORT_COMPILER_VERSION_FULL (_MSC_FULL_VER)
// eg.: 120 for VC6 (ugh!), 150 for VC9 (Studio / Express 2008)

#define CXXO_PRAGMA(x) _Pragma (#x)



#if defined(CXXOMFORT_NOTICES)
    #pragma message CXXO_NOTICE("Found the Microsoft C++ Compiler [" CXXO_STRINGIZE(_MSC_VER) "]" )
#endif

#if (CXXOMFORT_CXX_STD < 100)
	#undef CXXOMFORT_CXX_STD
	#define CXXOMFORT_CXX_STD (__cplusplus/100)
................................................................................
// At least VC2005
#if (CXXOMFORT_COMPILER_VERSION > 1300)
#endif


#if (CXXOMFORT_COMPILER_VERSION >= 1500) // VC 2008 or higher
    #if (_MSC_FULL_VER == 150030729) // SP1

        #undef  CXXOMFORT_COMPILER_VERSION
        #define CXXOMFORT_COMPILER_VERSION 1501








		#undef  CXXO_COMPILER_SUPPORT_tr1_array 
		#define CXXO_COMPILER_SUPPORT_tr1_array 1
		#undef  CXXO_COMPILER_SUPPORT_tr1_tuple 
		#define CXXO_COMPILER_SUPPORT_tr1_tuple 1
		#undef  CXXO_COMPILER_SUPPORT_tr1_type_traits
		#define CXXO_COMPILER_SUPPORT_tr1_type_traits 1












    #endif
    #undef  CXXO_COMPILER_SUPPORT_type_intrinsics
    #define CXXO_COMPILER_SUPPORT_type_intrinsics 1
    #undef  CXXO_COMPILER_SUPPORT_va_args
    #define CXXO_COMPILER_SUPPORT_va_args 1
    
#endif
................................................................................
        #undef  CXXOMFORT_COMPILER_VERSION
        #define CXXOMFORT_COMPILER_VERSION 1601
    #endif
    #undef  CXXOMFORT_CXX_EMULATION
    #define CXXOMFORT_CXX_EMULATION 2011
    #undef  CXXO_COMPILER_SUPPORT__Pragma
    #define CXXO_COMPILER_SUPPORT__Pragma 1
    #undef  CXXO_COMPILER_SUPPORT_cstd_system_error

    #define CXXO_COMPILER_SUPPORT_cstd_system_error 1










    #undef  CXXO_COMPILER_SUPPORT_auto
    #define CXXO_COMPILER_SUPPORT_auto 1984
    #undef  CXXO_COMPILER_SUPPORT_charn_t
    #define CXXO_COMPILER_SUPPORT_charn_t 2 // char16_t as typedef in yvals.h
    #undef  CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF
    #define CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF 1
    #undef  CXXO_COMPILER_SUPPORT_conditional_enableif
................................................................................
    #undef  CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers
    #define CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers 1
    #undef  CXXO_COMPILER_SUPPORT_trailing_returns
    #define CXXO_COMPILER_SUPPORT_trailing_returns 1
    #undef  CXXO_COMPILER_SUPPORT_unique_ptr
    #define CXXO_COMPILER_SUPPORT_unique_ptr 1








    
#endif

// -- TODO -- get my claws on a MSVC 2012 / 2013 for actual testing
// -- NEW TODO -- get my claws on the MSVC 2013 and CTP

#if (CXXOMFORT_COMPILER_VERSION >= 1700) // At least VC 2012
    #undef  CXXO_COMPILER_SUPPORT_cstd_cstdint 
    #define CXXO_COMPILER_SUPPORT_cstd_cstdint 1

    #undef  CXXO_COMPILER_SUPPORT_cstd_typeindex
    #define CXXO_COMPILER_SUPPORT_cstd_typeindex 1




    #undef  CXXO_COMPILER_SUPPORT_common_type
    #define CXXO_COMPILER_SUPPORT_common_type 1
    #undef  CXXO_COMPILER_SUPPORT_enum_class
    #define CXXO_COMPILER_SUPPORT_enum_class 1
    #undef  CXXO_COMPILER_SUPPORT_foreach
    #define CXXO_COMPILER_SUPPORT_foreach 1
    #undef  CXXO_COMPILER_SUPPORT_std_common_type
................................................................................
    #undef  CXXO_COMPILER_SUPPORT_std_is_trivially
    #define CXXO_COMPILER_SUPPORT_std_is_trivially 1
    #undef  CXXO_COMPILER_SUPPORT_std_is_constructible_traits
    #define CXXO_COMPILER_SUPPORT_std_is_constructible_traits 1
#endif

// At least VC2013
#if (CXXOMFORT_COMPILER_VERSION >= 1800) // At least VC 2012
	#undef  CXXO_COMPILER_SUPPORT_functional_transparent
	#define CXXO_COMPILER_SUPPORT_functional_transparent 1
#endif

// At least VC2015
#if (CXXOMFORT_COMPILER_VERSION >= 1900) // At least VC 2015
    #undef  CXXO_COMPILER_SUPPORT_alignment_tools







|
|
|
|







 







>
>







 







>
|
|
>
>
>
>
>
>
>
>






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







 







<
>
|
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>







|
|
>
|
<
>
>
>
>







 







|







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
..
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
...
124
125
126
127
128
129
130

131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
...
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
204
...
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#define CXXOMFORT_CONFIG_MSC_HPP

/*
 * 
 * MSVC version history
 * 
 * 14.0 / 2015 (2015-07). Generates telemetry!
 * 12.0 / 2013 (2013-10) - _MSC_VER==1800; **to be tested**
 * 11.0 / 2012 (2012-08) - _MSC_VER==1700; **preferred, Windows 7**
 * 10.0 / 2010 (2010-04) - _MSC_VER==1600;
 * 9.0 / 2008 (2007-11) - _MSC_VER==1500; **preferred**
 * 8.0 (2005-11)
 * 
 * 
 * In VC < 10, there is no such thing as C++11 emulation mode. What's more
 * important, in some versions the implementation of TR1 is broken or, in the
 * case of VC9 Express (2008) it won't install at all. 
 * Meaning that to be usable, this library needs to implement many
................................................................................
#define CXXOMFORT_COMPILER_ID CXXO_COMPILERID_MSC
#define CXXOMFORT_COMPILER_VERSION (_MSC_VER)
#define CXXOMFORT_COMPILER_VERSION_FULL (_MSC_FULL_VER)
// eg.: 120 for VC6 (ugh!), 150 for VC9 (Studio / Express 2008)

#define CXXO_PRAGMA(x) _Pragma (#x)

#undef CXXO_NOTICE
#define CXXO_NOTICE(msg) (msg)
#if defined(CXXOMFORT_NOTICES)
    #pragma message CXXO_NOTICE("Found the Microsoft C++ Compiler [" CXXO_STRINGIZE(_MSC_VER) "]" )
#endif

#if (CXXOMFORT_CXX_STD < 100)
	#undef CXXOMFORT_CXX_STD
	#define CXXOMFORT_CXX_STD (__cplusplus/100)
................................................................................
// At least VC2005
#if (CXXOMFORT_COMPILER_VERSION > 1300)
#endif


#if (CXXOMFORT_COMPILER_VERSION >= 1500) // VC 2008 or higher
    #if (_MSC_FULL_VER == 150030729) // SP1

		#undef  CXXOFLAG_tr1
		#define CXXOFLAG_tr1 1

		#undef  CXXO_CXXSTDHEADER_array
		#define CXXO_CXXSTDHEADER_array 1
		#undef  CXXO_CXXSTDHEADER_random
		#define CXXO_CXXSTDHEADER_random 1
		#undef  CXXO_CXXSTDHEADER_type_traits
		#define CXXO_CXXSTDHEADER_type_traits 1
		
		#undef  CXXO_COMPILER_SUPPORT_tr1_array 
		#define CXXO_COMPILER_SUPPORT_tr1_array 1
		#undef  CXXO_COMPILER_SUPPORT_tr1_tuple 
		#define CXXO_COMPILER_SUPPORT_tr1_tuple 1
		#undef  CXXO_COMPILER_SUPPORT_tr1_type_traits
		#define CXXO_COMPILER_SUPPORT_tr1_type_traits 1

		#define CXXOFLAG_namespace_tr1 1
		#undef  CXXO_STDTR1_NAME
		#define CXXO_STDTR1_NAME() std::tr1
		#undef  CXXO_STDTR1_OPEN
		#define CXXO_STDTR1_OPEN() namespace std { namespace tr1 {
		#undef  CXXO_STDTR1_CLOSE
		#define CXXO_STDTR1_CLOSE() } }
		#if (defined(CXXOMFORT_NOTICES) && CXXOMFORT_NOTICES > 1)
			#pragma message CXXO_NOTICE ("namespace tr1")
		#endif

    #endif
    #undef  CXXO_COMPILER_SUPPORT_type_intrinsics
    #define CXXO_COMPILER_SUPPORT_type_intrinsics 1
    #undef  CXXO_COMPILER_SUPPORT_va_args
    #define CXXO_COMPILER_SUPPORT_va_args 1
    
#endif
................................................................................
        #undef  CXXOMFORT_COMPILER_VERSION
        #define CXXOMFORT_COMPILER_VERSION 1601
    #endif
    #undef  CXXOMFORT_CXX_EMULATION
    #define CXXOMFORT_CXX_EMULATION 2011
    #undef  CXXO_COMPILER_SUPPORT__Pragma
    #define CXXO_COMPILER_SUPPORT__Pragma 1


    #undef  CXXO_CXXSTDHEADER_array
    #define CXXO_CXXSTDHEADER_array 1
    #undef  CXXO_CXXSTDHEADER_random
    #define CXXO_CXXSTDHEADER_random 1
    #undef  CXXO_CXXSTDHEADER_system_error
    #define CXXO_CXXSTDHEADER_system_error 1
    #undef  CXXO_CXXSTDHEADER_typeindex
    #define CXXO_CXXSTDHEADER_typeindex 1
    #undef  CXXO_CXXSTDHEADER_tuple
    #define CXXO_CXXSTDHEADER_tuple 1

    #undef  CXXO_COMPILER_SUPPORT_auto
    #define CXXO_COMPILER_SUPPORT_auto 1984
    #undef  CXXO_COMPILER_SUPPORT_charn_t
    #define CXXO_COMPILER_SUPPORT_charn_t 2 // char16_t as typedef in yvals.h
    #undef  CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF
    #define CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF 1
    #undef  CXXO_COMPILER_SUPPORT_conditional_enableif
................................................................................
    #undef  CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers
    #define CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers 1
    #undef  CXXO_COMPILER_SUPPORT_trailing_returns
    #define CXXO_COMPILER_SUPPORT_trailing_returns 1
    #undef  CXXO_COMPILER_SUPPORT_unique_ptr
    #define CXXO_COMPILER_SUPPORT_unique_ptr 1

	#define CXXOFLAG_namespace_tr1 0
	#undef  CXXO_STDTR1_NAME
	#define CXXO_STDTR1_NAME() std
	#undef  CXXO_STDTR1_OPEN
	#define CXXO_STDTR1_OPEN() namespace std {
	#undef  CXXO_STDTR1_CLOSE
	#define CXXO_STDTR1_CLOSE() } 
    
#endif

// -- TODO -- get my claws on a MSVC 2012 / 2013 for actual testing
// -- NEW TODO -- get my claws on the MSVC 2013 and CTP

#if (CXXOMFORT_COMPILER_VERSION >= 1700) // At least VC 2012
	#undef  CXXOFLAG_tr1
	#define CXXOFLAG_tr1 1

    #undef  CXXO_CXXSTDHEADER_cstdint 

    #define CXXO_CXXSTDHEADER_cstdint 1
    #undef  CXXO_CXXSTDHEADER_typeindex
    #define CXXO_CXXSTDHEADER_typeindex 1

    #undef  CXXO_COMPILER_SUPPORT_common_type
    #define CXXO_COMPILER_SUPPORT_common_type 1
    #undef  CXXO_COMPILER_SUPPORT_enum_class
    #define CXXO_COMPILER_SUPPORT_enum_class 1
    #undef  CXXO_COMPILER_SUPPORT_foreach
    #define CXXO_COMPILER_SUPPORT_foreach 1
    #undef  CXXO_COMPILER_SUPPORT_std_common_type
................................................................................
    #undef  CXXO_COMPILER_SUPPORT_std_is_trivially
    #define CXXO_COMPILER_SUPPORT_std_is_trivially 1
    #undef  CXXO_COMPILER_SUPPORT_std_is_constructible_traits
    #define CXXO_COMPILER_SUPPORT_std_is_constructible_traits 1
#endif

// At least VC2013
#if (CXXOMFORT_COMPILER_VERSION >= 1800) 
	#undef  CXXO_COMPILER_SUPPORT_functional_transparent
	#define CXXO_COMPILER_SUPPORT_functional_transparent 1
#endif

// At least VC2015
#if (CXXOMFORT_COMPILER_VERSION >= 1900) // At least VC 2015
    #undef  CXXO_COMPILER_SUPPORT_alignment_tools

Changes to cxxomfort/cxxomfort/config/ow.hpp.

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// integer types are available in native cstdint

// explicit cast... do templates work?

#endif // 9999

#if (__WATCOMC__ >= 1200) // Watcom 1.9 or higher
    #undef  CXXO_COMPILER_SUPPORT_cstd_cstdint
    #define CXXO_COMPILER_SUPPORT_cstd_cstdint 1

#endif

#if (__WATCOMC__ >= 1300) // Watcom 2.0 / OpenWatcom or higher
#endif

#endif







|
|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// integer types are available in native cstdint

// explicit cast... do templates work?

#endif // 9999

#if (__WATCOMC__ >= 1200) // Watcom 1.9 or higher
    #undef  CXXO_CXXSTDHEADER_cstdint
    #define CXXO_CXXSTDHEADER_cstdint 1

#endif

#if (__WATCOMC__ >= 1300) // Watcom 2.0 / OpenWatcom or higher
#endif

#endif

Changes to cxxomfort/cxxomfort/functional.hpp.

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
#include <cxxomfort/base.hpp>
#include CXXO_INCLUDE_SYS(functional)

#if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
    #pragma message CXXO_NOTICE("enabled <functional> support.")
#endif

#if (CXXOFLAG_namespace_tr1>0)



#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG)
	#include <tr1/functional>

namespace std {
    namespace placeholders { using namespace ::std::tr1::placeholders; };
    using tr1::reference_wrapper;
    using tr1::ref;
    using tr1::cref;
    using tr1::hash;
    using tr1::bind;
    using tr1::function;
    using tr1::bad_function_call;
    // using tr1::hash;
}

#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,<1600))



namespace std {
	using tr1::reference_wrapper;
	using tr1::ref;
	using tr1::cref;
	using tr1::mem_fn;
	using tr1::bind;
	using tr1::function;
    using tr1::bad_function_call;
    using tr1::hash;
}





#endif // compiler





#endif // tr1



namespace cxxomfort {
namespace cxxostd {

// 
// std::invoke (C++11-onward only)
//







|
>
>
>
|
|
>











>
|
>
>
>










>
>
>
>
>
|
>
>
>
>
>
|
>
>







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
#include <cxxomfort/base.hpp>
#include CXXO_INCLUDE_SYS(functional)

#if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
    #pragma message CXXO_NOTICE("enabled <functional> support.")
#endif

#if (CXXOMFORT_CXX_STD >= 2011)

#elif (CXXOMFORT_CXX_STD < 2011 && CXXOFLAG_tr1>0)
	// GCC has TR1 files under tr1/ and symbols under std::tr1::
	#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG)
		#include <tr1/functional>

namespace std {
    namespace placeholders { using namespace ::std::tr1::placeholders; };
    using tr1::reference_wrapper;
    using tr1::ref;
    using tr1::cref;
    using tr1::hash;
    using tr1::bind;
    using tr1::function;
    using tr1::bad_function_call;
    // using tr1::hash;
}

	#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,>=1600) )
	// MSC 2010 and ahead don't have a tr1
	#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,<1600) && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,>=1500) )
	// MSC 2008 has tr1 under includepath, symbols under tr1::
namespace std {
	using tr1::reference_wrapper;
	using tr1::ref;
	using tr1::cref;
	using tr1::mem_fn;
	using tr1::bind;
	using tr1::function;
    using tr1::bad_function_call;
    using tr1::hash;
}
	#else
	// MSC 2005 doesn't have a TR1
		#if defined(CXXOFLAG_USE_INTERNAL_TR1)
		#endif

	#endif // compiler
#else
	// before support for TR1
	#if defined(CXXOFLAG_USE_INTERNAL_TR1)
		#include "./impl/07-reference_wrapper.hpp"
		#include "./impl/07-hash.hpp"
	#endif
#endif // c++ pre-11, tr1


namespace cxxomfort {
namespace cxxostd {

// 
// std::invoke (C++11-onward only)
//

Deleted cxxomfort/cxxomfort/impl/03-array.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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
#ifndef CXXOMFORT_IMPL_03_STD_ARRAY_HPP
#define CXXOMFORT_IMPL_03_STD_ARRAY_HPP
/**
 * @file
 * 
 * This file is intended to be included only in circumstances where 
 * cxxomfort detects there is not an <array> or <tr1/array> available 
 * (detection which has yet to be implemented via CXXOFLAG_NO_TR1 )
 */
#include <cxxomfort/base.hpp>
#include <cxxomfort/impl/relationals.hpp>
#include CXXO_INCLUDE_SYS(iterator)
#include CXXO_INCLUDE_SYS(algorithm)
#define CXXOMFORT_IMPLEMENTS_n1479 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_std_array CXXOMFORT_IMPLEMENTS_n1479

namespace cxxomfort {
namespace cxxostd {
namespace array {

namespace detail {
    template <typename T>
    struct add_pointer {
        typedef T* type;
    };
    
} // detail

/**
 * An implementation of C++11's <code>std::array</code> 
 * for compilers in C++03 mode that lack TR1.
 * 
 * Main differences with usual TR1 array:
 * 
 * * does not implement <code>array.at</code>.
 * * does not implement cbegin, cend, crbegin, crend.
 * 
 * @sa https://wg21.link/n1479
 * 
 */
template <typename T, size_t N>
struct array {
    static_assert (N , "array<T,N> with N>0");
    
    typedef T value_type;
    typedef T const           const_value_type;
    enum{ const_size = N};

    typedef size_t            size_type;
    typedef ptrdiff_t         difference_type;

    typedef typename detail::add_pointer<T>::type    pointer;
    typedef typename detail::add_pointer<const_value_type>::type const_pointer;
    
    typedef T&           reference;
    typedef T const&     const_reference;
    
    typedef pointer           iterator;
    typedef const_pointer     const_iterator;
    typedef typename std::reverse_iterator<iterator>::type reverse_iterator;
    typedef typename std::reverse_iterator<const_iterator>::type const_reverse_iterator;
    
    
    pointer         data () CXXO_NOEXCEPTNOTHROW { return elems; }
    const_pointer   data () const CXXO_NOEXCEPTNOTHROW { return elems; }
    size_t     size () const CXXO_NOEXCEPTNOTHROW { return N; }
    size_t     max_size () const CXXO_NOEXCEPTNOTHROW { return N; }
    bool       empty () const CXXO_NOEXCEPTNOTHROW { return false; }
    
    reference       front () CXXO_NOEXCEPTNOTHROW { return elems[0]; }
    const_reference front () const CXXO_NOEXCEPTNOTHROW { return elems[0]; }
    reference       back () CXXO_NOEXCEPTNOTHROW { return elems[N-1]; }
    const_reference back () const CXXO_NOEXCEPTNOTHROW { return elems[N-1]; }
    

    reference       operator[] (size_t i) CXXO_NOEXCEPTNOTHROW { return elems[i]; }
    const_reference operator[] (size_t i) const CXXO_NOEXCEPTNOTHROW { return elems[i]; }
    
    iterator        begin () CXXO_NOEXCEPT { return elems; }
    const_iterator  begin () const CXXO_NOEXCEPT { return elems; }
    iterator        end () CXXO_NOEXCEPT { return elems+N; }
    const_iterator  end () const CXXO_NOEXCEPT { return elems+N; }
    
    void fill (T const& t) {
        std::fill(this->begin(), this->end(), t);
    }
    
    friend bool operator== (array const& a1, array const& a2) {
        return std::equal(a1.begin(), a1.end(), a2.begin());
    }
    friend bool operator< (array const& a1, array const& a2) {
        return std::lexicographical_compare(a1.begin(), a1.end(), a2.begin());
    }

    private:
    T elems[N];
};

#define TARGS T,N
#define TPARAMS typename T, size_t N
CXXO_GENERATE_RELATIONALS_T(array);
#undef TARGS
#undef TPARAMS

template <typename T, size_t N>
void swap (array<T,N>& li, array<T,N>& lr) {
    for (size_t i=0; i < N; ++i) { using std::swap; swap(li.elems[i], lr.elems[i]); }
}

template <size_t I, typename T, size_t N>
T& get (array<T,N>& a) CXXO_NOEXCEPTNOTHROW {
    static_assert(I<N, "invalid get<> in array");
    return a[I];
}

template <size_t I, typename T, size_t N>
T const& get (array<T,N> const& a) CXXO_NOEXCEPTNOTHROW {
    static_assert(I<N, "invalid get<> in array");
    return a[I];
}


} // array
} }



#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































Changes to cxxomfort/cxxomfort/impl/03-random_renames.hpp.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#define CXXOMFORT_IMPL_RANDOM_RENAMES_HPP
/**
 * @file
 * @brief Provides C++11-compliant renames of some utilities in C++03 TR1's "random" that changed names.
 */

#include "../base.hpp"
#include <random>
//#include CXXO_INCLUDE_SYS(random)

// fix renamed functors in <random> between C++03 TR1 and C++11
#if ((CXXOMFORT_CXX_STD < 2011) && (CXXOMFORT_CXX_EMULATION < 2011))
namespace std { namespace tr1 { 
// These are only "good enough to work" fixes.









<
|







2
3
4
5
6
7
8

9
10
11
12
13
14
15
16
#define CXXOMFORT_IMPL_RANDOM_RENAMES_HPP
/**
 * @file
 * @brief Provides C++11-compliant renames of some utilities in C++03 TR1's "random" that changed names.
 */

#include "../base.hpp"

//#include CXXO_INCLUDE_SYS(random) // should already be done at this point

// fix renamed functors in <random> between C++03 TR1 and C++11
#if ((CXXOMFORT_CXX_STD < 2011) && (CXXOMFORT_CXX_EMULATION < 2011))
namespace std { namespace tr1 { 
// These are only "good enough to work" fixes.


Added cxxomfort/cxxomfort/impl/07-array.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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
#ifndef CXXOMFORT_IMPL_03_STD_ARRAY_HPP
#define CXXOMFORT_IMPL_03_STD_ARRAY_HPP
/**
 * @file
 * 
 * This file is intended to be included only in circumstances where 
 * cxxomfort detects there is not an <array> or <tr1/array> available 
 * (detection which has yet to be implemented via CXXOFLAG_NO_TR1 )
 */
#include <cxxomfort/base.hpp>
#include <cxxomfort/impl/relationals.hpp>
#include CXXO_INCLUDE_SYS(iterator)
#include CXXO_INCLUDE_SYS(algorithm)
#define CXXOMFORT_IMPLEMENTS_n1479 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_std_array CXXOMFORT_IMPLEMENTS_n1479

namespace cxxomfort {
namespace cxxostd {
namespace array {

namespace detail {
    template <typename T>
    struct add_pointer {
        typedef T* type;
    };
    
} // detail

/**
 * An implementation of C++11's <code>std::array</code> 
 * for compilers in C++03 mode that lack TR1.
 * 
 * Main differences with usual TR1 array:
 * 
 * * does not implement <code>array.at</code>.
 * * does not implement cbegin, cend, crbegin, crend.
 * 
 * @sa https://wg21.link/n1479
 * 
 */
template <typename T, size_t N>
struct array {
    static_assert (N , "array<T,N> with N>0");
    
    typedef T value_type;
    typedef T const           const_value_type;
    enum{ const_size = N};

    typedef size_t            size_type;
    typedef ptrdiff_t         difference_type;

    typedef typename detail::add_pointer<T>::type    pointer;
    typedef typename detail::add_pointer<const_value_type>::type const_pointer;
    
    typedef T&           reference;
    typedef T const&     const_reference;
    
    typedef pointer           iterator;
    typedef const_pointer     const_iterator;
    typedef typename std::reverse_iterator<iterator>::type reverse_iterator;
    typedef typename std::reverse_iterator<const_iterator>::type const_reverse_iterator;
    
    
    pointer         data () CXXO_NOEXCEPTNOTHROW { return elems; }
    const_pointer   data () const CXXO_NOEXCEPTNOTHROW { return elems; }
    size_t     size () const CXXO_NOEXCEPTNOTHROW { return N; }
    size_t     max_size () const CXXO_NOEXCEPTNOTHROW { return N; }
    bool       empty () const CXXO_NOEXCEPTNOTHROW { return false; }
    
    reference       front () CXXO_NOEXCEPTNOTHROW { return elems[0]; }
    const_reference front () const CXXO_NOEXCEPTNOTHROW { return elems[0]; }
    reference       back () CXXO_NOEXCEPTNOTHROW { return elems[N-1]; }
    const_reference back () const CXXO_NOEXCEPTNOTHROW { return elems[N-1]; }
    

    reference       operator[] (size_t i) CXXO_NOEXCEPTNOTHROW { return elems[i]; }
    const_reference operator[] (size_t i) const CXXO_NOEXCEPTNOTHROW { return elems[i]; }
    
    iterator        begin () CXXO_NOEXCEPT { return elems; }
    const_iterator  begin () const CXXO_NOEXCEPT { return elems; }
    iterator        end () CXXO_NOEXCEPT { return elems+N; }
    const_iterator  end () const CXXO_NOEXCEPT { return elems+N; }
    
    void fill (T const& t) {
        std::fill(this->begin(), this->end(), t);
    }
    
    friend bool operator== (array const& a1, array const& a2) {
        return std::equal(a1.begin(), a1.end(), a2.begin());
    }
    friend bool operator< (array const& a1, array const& a2) {
        return std::lexicographical_compare(a1.begin(), a1.end(), a2.begin());
    }

    private:
    T elems[N];
};

#define TARGS T,N
#define TPARAMS typename T, size_t N
CXXO_GENERATE_RELATIONALS_T(array);
#undef TARGS
#undef TPARAMS

template <typename T, size_t N>
void swap (array<T,N>& li, array<T,N>& lr) {
    for (size_t i=0; i < N; ++i) { using std::swap; swap(li.elems[i], lr.elems[i]); }
}

template <size_t I, typename T, size_t N>
T& get (array<T,N>& a) CXXO_NOEXCEPTNOTHROW {
    static_assert(I<N, "invalid get<> in array");
    return a[I];
}

template <size_t I, typename T, size_t N>
T const& get (array<T,N> const& a) CXXO_NOEXCEPTNOTHROW {
    static_assert(I<N, "invalid get<> in array");
    return a[I];
}


} // array
} }



#endif

Added cxxomfort/cxxomfort/impl/07-hash.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
#ifndef CXXOMFORT_IMPL_03_HASH_HPP
#define CXXOMFORT_IMPL_03_HASH_HPP


#include <cxxomfort/config.hpp>

#if (CXXOFLAG_tr1==0 || CXXOMFORT_CXX_STD < 2011)
/* 
 * Note: 
 * We declare hash in namespace std:: , since 
 * users have to be able to specialize it.
 * */

namespace std {

template <typename t> struct hash {};

#define CXXO_HASH_NATIVE(T) \
template <> struct hash< T > { \
	typedef T argument_type; \
	typedef size_t result_type; \
	result_type operator() (T x) const CXXO_NOEXCEPTNOTHROW { \
		return static_cast<result_type>(x); \
	} \
 \
} \

CXXO_HASH_NATIVE(bool);
CXXO_HASH_NATIVE(char);
CXXO_HASH_NATIVE(signed char);
CXXO_HASH_NATIVE(unsigned char);
CXXO_HASH_NATIVE(signed int);
CXXO_HASH_NATIVE(unsigned int);
CXXO_HASH_NATIVE(signed short);
CXXO_HASH_NATIVE(unsigned short);
CXXO_HASH_NATIVE(signed long);
CXXO_HASH_NATIVE(unsigned long);
CXXO_HASH_NATIVE(signed long long);
CXXO_HASH_NATIVE(unsigned long long);
CXXO_HASH_NATIVE(float);
CXXO_HASH_NATIVE(double);
CXXO_HASH_NATIVE(wchar_t);


#undef CXXO_HASH_NATIVE


// hash for pointer types

template <typename T>
struct hash <T*> {
	typedef T* argument_type; 
	typedef size_t result_type; 
	result_type operator() (T* x) const CXXO_NOEXCEPTNOTHROW { 
		return (static_cast<const char*>(x) - static_cast<const char*>(0));
	} 
};


}

#endif // std

#endif

Added cxxomfort/cxxomfort/impl/07-reference_wrapper.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
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef CXXOMFORT_IMPL_REFERENCE_WRAPPER_HPP
#define CXXOMFORT_IMPL_REFERENCE_WRAPPER_HPP
/**
 * @file
 *
 */

#include "../config.hpp"
#include "11-addressof.hpp"
#define CXXOMFORT_IMPLEMENTS_n1436 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_n1453 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_reference_wrapper CXXOMFORT_IMPLEMENTS_n1453

namespace cxxomfort {
namespace cxxostd {

/**
 * @brief reference_wrapper from C++11.
 * @anchor reference_wrapper
 */
template <typename T>
struct reference_wrapper {
    public:
    typedef T value_type;
    explicit reference_wrapper(T& t) CXXO_NOEXCEPT 
    : v(std::addressof(t)) {}

    // the copy-ctor and assignment are trivial in C++11
	#if (CXXOMFORT_CXX_STD >= 2011)
	constexpr reference_wrapper (reference_wrapper const& ) noexcept = default;
	reference_wrapper& operator= (reference_wrapper const&) noexcept = default;
    reference_wrapper(T&&) = delete;
	#else
	reference_wrapper (reference_wrapper const& R) CXXO_NOEXCEPTNOTHROW
	: :v(R.get()){} 
    reference_wrapper& operator= (reference_wrapper const& R) CXXO_NOEXCEPTNOTHROW {
        v= R.v;
        return *this;
    }
	#endif

    #if (CXXOMFORT_CXX_STD>=2011)
    #endif


    T& get () const CXXO_NOEXCEPTNOTHROW { return v; }
    operator T& () const CXXO_NOEXCEPTNOTHROW { return v; }

    #if (CXXOMFORT_CXX_STD>=2011)
    template< class... ArgTypes >
    typename std::result_of<T&(ArgTypes&&...)>::type
    operator() ( ArgTypes&&... args ) const; {
        return get()(std::forward<ArgTypes>(args)...);
    }
    #elif (CXXO_COMPILER_SUPPORT_typeof)
    __typeof__( std::declval<T>() ) 
    operator() () const {
        return get()();
    }
    template <typename T1>
    __typeof__( std::declval<T>()(std::declval<T1>()) )
    operator() (T1 const& a1) const {
        return get()(a1);
    }
    template <typename T1, typename T2>
    __typeof__( std::declval<T>()(std::declval<T1>(), std::declval<T2>() ) )
    operator() (T1 const& a1, T2 const& a2) const {
        return get()(a1,a2);
    }
    #endif
    
    private:
    T* v;
};

template <typename T>
reference_wrapper<T> ref (T& t) CXXO_NOEXCEPTNOTHROW {
    return reference_wrapper<T>(t);
}

template <typename T>
reference_wrapper<T const> cref (T const& t) CXXO_NOEXCEPTNOTHROW {
    return reference_wrapper<T const>(t);
}


} }

#endif // file

Changes to cxxomfort/cxxomfort/impl/17-make_from_tuple.hpp.

3
4
5
6
7
8
9
10
11
12


13
14
15
16

17
18
19
20
21
22
23
/**
 * @file
 * @brief Implementation of std::make_from_tuple
 */

#include <cxxomfort/base.hpp>
#include <cxxomfort/tuple.hpp> // index_sequence
#include <tuple> // ...duh

#if (CXXOMFORT_CXX_STD>=2011)


#define CXXOMFORT_IMPLEMENTS_p0209 CXXO_IMPLSTATUS_BACKPORT()
#else
#define CXXOMFORT_IMPLEMENTS_p0209 CXXO_IMPLSTATUS_EMULATION()
#endif

#define CXXOMFORT_IMPLEMENTS_make_from_tuple CXXOMFORT_IMPLEMENTS_p0209 

namespace cxxomfort {
namespace cxxostd {

// 
// make_from_tuple







<

|
>
>




>







3
4
5
6
7
8
9

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
 * @file
 * @brief Implementation of std::make_from_tuple
 */

#include <cxxomfort/base.hpp>
#include <cxxomfort/tuple.hpp> // index_sequence


#if (CXXOMFORT_CXX_STD >= 2017)
#define CXXOMFORT_IMPLEMENTS_p0209 CXXO_IMPLSTATUS_NATIVE()
#elf (CXXOMFORT_CXX_STD >= 2011)
#define CXXOMFORT_IMPLEMENTS_p0209 CXXO_IMPLSTATUS_BACKPORT()
#else
#define CXXOMFORT_IMPLEMENTS_p0209 CXXO_IMPLSTATUS_EMULATION()
#endif

#define CXXOMFORT_IMPLEMENTS_make_from_tuple CXXOMFORT_IMPLEMENTS_p0209 

namespace cxxomfort {
namespace cxxostd {

// 
// make_from_tuple

Changes to cxxomfort/cxxomfort/impl/errc-posix.hpp.

71
72
73
74
75
76
77
78
79
80
text_file_busy =ETXTBSY,
timed_out =ETIMEDOUT,
too_many_files_open_in_system =ENFILE,
too_many_files_open =EMFILE,
too_many_links =EMLINK,
too_many_symbolic_link_levels =ELOOP,
value_too_large =EOVERFLOW,
wrong_protocol_type =EPROTOTYPE 









|

<
71
72
73
74
75
76
77
78
79

text_file_busy =ETXTBSY,
timed_out =ETIMEDOUT,
too_many_files_open_in_system =ENFILE,
too_many_files_open =EMFILE,
too_many_links =EMLINK,
too_many_symbolic_link_levels =ELOOP,
value_too_large =EOVERFLOW,
wrong_protocol_type =EPROTOTYPE ,


Added cxxomfort/cxxomfort/impl/errc.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
#ifndef CXXOMFORT_IMPL_ERRC_HPP
#define CXXOMFORT_IMPL_ERRC_HPP

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

namespace cxxomfort { namespace cxxostd {

//
// errc and helpers
//

struct myerrc{ enum type { 

#if 0
#elif defined(_POSIX_VERSION)
    #include "../impl/errc-posix.hpp"
#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_OW)
    #include "../impl/errc-win.hpp"
#else
    // #error "Can not find definitions for std::errc codes."
#endif

};  };


/**
 * @brief Enumerated type that saves the various POSIX error values
 * @see https://en.cppreference.com/w/cpp/error/errc
 */
typedef cxxomfort::impl::typesafe_enum<myerrc,int> errc;

template <typename T> struct is_error_code_enum 
: public std::false_type {};

template<> struct is_error_code_enum <errc> : public std::true_type {};
// Here we need to specialize for myerrc::type as well
// because the constructors for error_condition and error_code below 
// use SFINAE to match the exact type, before conversion.
template<> struct is_error_code_enum<myerrc::type> : public std::true_type {};


} } // namespace

#endif

Changes to cxxomfort/cxxomfort/impl/n3334-array_ref.hpp.

5
6
7
8
9
10
11


12
13
14
15
16
17
18
19
20
21
22
 *  
**/

#include <cxxomfort/base.hpp>
#include <iterator>
#include <stdexcept>
#include <valarray> // maybe do away with this


#include <cxxomfort/array.hpp> // maybe do away with this
#include <cxxomfort/impl/metaprogramming.hpp>
#include <cxxomfort/type_traits.hpp>
#include <cxxomfort/system_error.hpp> // see way to get rid of this

#define CXXOMFORT_IMPLEMENTS_n3334 CXXO_IMPLSTATUS_LIBRARY()
#define CXXOMFORT_IMPLEMENTS_array_ref CXXOMFORT_IMPLEMENTS_n3334

#if (defined(CXXOMFORT_NOTICES) && CXXOMFORT_NOTICES>1)
    #pragma message CXXO_NOTICE("enabled library: array_ref<T> implementation")
#endif







>
>



<







5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
 *  
**/

#include <cxxomfort/base.hpp>
#include <iterator>
#include <stdexcept>
#include <valarray> // maybe do away with this
#include <cxxomfort/cerrno.hpp>
#include <cxxomfort/system_error.hpp> // see way to get rid of this
#include <cxxomfort/array.hpp> // maybe do away with this
#include <cxxomfort/impl/metaprogramming.hpp>
#include <cxxomfort/type_traits.hpp>


#define CXXOMFORT_IMPLEMENTS_n3334 CXXO_IMPLSTATUS_LIBRARY()
#define CXXOMFORT_IMPLEMENTS_array_ref CXXOMFORT_IMPLEMENTS_n3334

#if (defined(CXXOMFORT_NOTICES) && CXXOMFORT_NOTICES>1)
    #pragma message CXXO_NOTICE("enabled library: array_ref<T> implementation")
#endif

Changes to cxxomfort/cxxomfort/random.hpp.

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
..
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
...
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

#include "config.hpp"
#include "base.hpp"
#include <limits>
#include <ctime>
#include <cxxomfort/array.hpp>

#if (CXXOMFORT_CXX_STD>=1997)


#include <random>

// #include <type_traits>

#if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
#pragma message CXXO_NOTICE("enabled <random> support.")
#endif









// Fixes for the C++03 names of utilities in <random>


#include "impl/03-random_renames.hpp"

#if (CXXOFLAG_namespace_tr1>0 ) \
|| (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,<1600))
namespace std {
    using tr1::linear_congruential_engine;
    using tr1::minstd_rand;
    using tr1::minstd_rand0;
    
    using tr1::mersenne_twister;
    using tr1::mt19937;
................................................................................
    using tr1::uniform_int_distribution;
    using tr1::uniform_real_distribution;

    
    using tr1::random_device;
}

#endif


// TBA: Backport discrete_distribution to c++03

// C++03 approach to random_device
// #include "impl/11-random_device.hpp"

namespace cxxomfort {
namespace cxxostd {

/**
 * @brief An adapter that caches and returns results from a generator in a random-ish order.
 * @ingroup cxx11-backports
 * @xrefitem std0random "" ""
 * @anchor shuffle_order_engine
 * 
................................................................................
/*
 * Visual C++ 2010 has a broken shuffle_order_engine that calls the 
 * nonmember min, max of the attached Engine, whereas the same 
 * engines that VC has only have member functions. Here we try to 
 * replace it with our own.
 * 
 * */
#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, >= 1600) && CXXOMFORT_CXX_STD< 2011 && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, < 1700))
    using ::cxxomfort::cxxostd::shuffle_order_engine;
    using ::cxxomfort::cxxostd::knuth_b;
#else
    using cxxostd::shuffle_order_engine;
    using cxxostd::knuth_b;
#endif

#ifdef DOXYGEN_DOC
/**
 * @brief Forwarder for @c std::shuffle_order_engine
 * @ingroup cxxomfort-fix
 * @xrefitem cxxomfort-fix "<random>" "shuffle_order_engine"
 * 







<

>
|

|
>
|
|
|

>
>
>
>
>
>
>
>

>
>
|

|
|







 







|







|
<







 







|
|
|
|
|
|
|







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
..
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

70
71
72
73
74
75
76
...
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165

#include "config.hpp"
#include "base.hpp"
#include <limits>
#include <ctime>
#include <cxxomfort/array.hpp>



#if (CXXOMFORT_CXX_STD >= 2011)
	#include <random>

#elif (CXXOMFORT_CXX_STD>=1997 && CXXOMFORT_CXX_STD < 2011 && CXXOFLAG_tr1)
	// C++03 with TR1
	#if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
		#pragma message CXXO_NOTICE("enabled <random> support.")
	#endif

	#if (CXXOFLAG_directory_tr1>0)
		#include <tr1/random>
	#else 
		#include <random>
	#endif


// 
// Fixes for the C++03 names of utilities in <random>
// 

	#include "impl/03-random_renames.hpp"

	#if (CXXOFLAG_namespace_tr1>0 ) \
	|| (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,<1600))
namespace std {
    using tr1::linear_congruential_engine;
    using tr1::minstd_rand;
    using tr1::minstd_rand0;
    
    using tr1::mersenne_twister;
    using tr1::mt19937;
................................................................................
    using tr1::uniform_int_distribution;
    using tr1::uniform_real_distribution;

    
    using tr1::random_device;
}

	#endif


// TBA: Backport discrete_distribution to c++03

// C++03 approach to random_device
// #include "impl/11-random_device.hpp"

namespace cxxomfort { namespace cxxostd {


/**
 * @brief An adapter that caches and returns results from a generator in a random-ish order.
 * @ingroup cxx11-backports
 * @xrefitem std0random "" ""
 * @anchor shuffle_order_engine
 * 
................................................................................
/*
 * Visual C++ 2010 has a broken shuffle_order_engine that calls the 
 * nonmember min, max of the attached Engine, whereas the same 
 * engines that VC has only have member functions. Here we try to 
 * replace it with our own.
 * 
 * */
	#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, >= 1600) && CXXOMFORT_CXX_STD< 2011 && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, < 1700))
		using ::cxxomfort::cxxostd::shuffle_order_engine;
		using ::cxxomfort::cxxostd::knuth_b;
	#else
		using cxxostd::shuffle_order_engine;
		using cxxostd::knuth_b;
	#endif

#ifdef DOXYGEN_DOC
/**
 * @brief Forwarder for @c std::shuffle_order_engine
 * @ingroup cxxomfort-fix
 * @xrefitem cxxomfort-fix "<random>" "shuffle_order_engine"
 * 

Changes to cxxomfort/cxxomfort/system_error.hpp.

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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
...
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
...
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
...
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
...
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
 * namespace also called errc, making it impossible to 
 * declare variables of type std::errc.
 * 
 * Because of this, in the case of MSVC 2010 specifically, 
 * we probably should be overriding the native <system_error> in config/msc.hpp
 * 
 * */
#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC && defined(_SYSTEM_ERROR_) && !defined(CXXO_MSVC_PATCH_system_error))
//    #error "oopsie! Patch <system_error> or add cxxomfort/config/msc/ to include path"
#endif

#if (CXXO_COMPILER_SUPPORT_cstd_system_error>0)

    #include CXXO_INCLUDE_SYS(system_error)
    #define CXXOMFORT_IMPLEMENTS_header_system_error CXXO_IMPLSTATUS_NATIVE()
#else


#include <cxxomfort/base.hpp>
#include <cxxomfort/base/explicit_cast.hpp>
#include "library/typesafe_enum.hpp"
#include "impl/relationals.hpp"
#include "impl/11-addressof.hpp"
#include "impl/11-to_string.hpp"
#include <stdexcept>
#include <string>
#include <cstring> // strerror
#include <cerrno>
#include <utility> // make_pair, operator<

#if ((CXXOMFORT_CXX_STD < 2011))
// start code for implementation of system_error




#define CXXOMFORT_IMPLEMENTS_header_system_error CXXO_IMPLSTATUS_EMULATION()

#if (CXXOMFORT_COMPILER_ID == CXXO_COMPILERID_MSC)
    #pragma warning (disable:4996) // MSVC: function may be unsafe
#endif

#if defined(__linux__) || defined(__unix__)
    #include <unistd.h> // POSIX
#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_OW)
    #include <errno.h>
    #include "impl/errno-msvc.hpp"
#endif

namespace cxxomfort {
namespace cxxostd {

class error_code;

//
// errc and helpers
//

struct myerrc{ enum type { 

#if 0
#elif defined(_POSIX_VERSION)
    #include "impl/errc-posix.hpp"
#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_OW)
    #include "impl/errc-win.hpp"
#else
    #error "Can not find definitions for std::errc codes."
#endif

};  };


/**
 * @brief Enumerated type that saves the various POSIX error values
 * @see https://en.cppreference.com/w/cpp/error/errc
 */
typedef cxxomfort::library::typesafe_enum<myerrc,int> errc;

template <typename T> struct is_error_code_enum 
: public std::false_type {};

template<> struct is_error_code_enum <errc> : public std::true_type {};
// Here we need to specialize for myerrc::type as well
// because the constructors for error_condition and error_code below 
// use SFINAE to match the exact type, before conversion.
template<> struct is_error_code_enum<myerrc::type> : public std::true_type {};


//
// error_condition and helpers
//

class error_condition;

................................................................................
        p_category= &generic_category();
    }
    
    int        value () const CXXO_NOEXCEPTNOTHROW { return v_error; }
    error_category const& category () const CXXO_NOEXCEPTNOTHROW { return *p_category; }
    std::string message () const;
    
    CXXO_EXPLICIT_OPERATOR(bool) () const CXXO_NOEXCEPT { return v_error; }

    friend bool operator== (error_condition const& l, error_condition const& r) CXXO_NOEXCEPTNOTHROW {
        return (l.p_category == r.p_category && l.v_error == r.v_error);
    }
    friend bool operator< (error_condition const& l, error_condition const& r) CXXO_NOEXCEPTNOTHROW {
        return std::make_pair(l.p_category, l.v_error) < std::make_pair(r.p_category, r.v_error);
    }
................................................................................
    // Checks if the error value is set.
    // operator bool () const { return value() != 0; }
    
    error_condition default_error_condition () const CXXO_NOEXCEPTNOTHROW {
        return category().default_error_condition(value());
    }

    CXXO_EXPLICIT_OPERATOR(bool) () const CXXO_NOEXCEPTNOTHROW { return value(); }
    
    // comparison operators
    
    friend bool operator== (error_code const& vl, error_code const& vr) CXXO_NOEXCEPTNOTHROW {
        return vl.category()==vr.category() && vl.value()==vr.value();
    }
    friend bool operator<  (error_code const& vl, error_code const& vr) CXXO_NOEXCEPTNOTHROW {
................................................................................
#endif // c++11


#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#else

    #if (CXXOMFORT_CXX_STD>=2011)
    #elif (CXXO_COMPILER_SUPPORT_cstd_system_error>0)
    #else
        
        
namespace std {
    
    using cxxomfort::cxxostd::errc;
    using cxxomfort::cxxostd::make_error_code;
................................................................................

/**
 * @brief Creates a value of type @c errc given a numeric error code.
 * @ingroup cxxomfort-fix
 * 
 * */
static inline errc to_errc(int E) {
#if (CXXO_COMPILER_SUPPORT_cstd_system_error==0)
    return static_cast<cxxomfort::cxxostd::myerrc::type>(E);
#else
    return static_cast<errc>(E);
#endif
}

} } // cxxomfort::fix







<
<
<

<
>







|






<



|

>
>
>
|

|
|
|

|
|
|
|
|
|






<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|







 







|







 







|







 







|







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
...
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
...
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
...
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
...
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
 * namespace also called errc, making it impossible to 
 * declare variables of type std::errc.
 * 
 * Because of this, in the case of MSVC 2010 specifically, 
 * we probably should be overriding the native <system_error> in config/msc.hpp
 * 
 * */





#if (CXXO_CXXSTDHEADER_system_error>0)
    #include CXXO_INCLUDE_SYS(system_error)
    #define CXXOMFORT_IMPLEMENTS_header_system_error CXXO_IMPLSTATUS_NATIVE()
#else


#include <cxxomfort/base.hpp>
#include <cxxomfort/base/explicit_cast.hpp>
#include <cxxomfort/cerrno.hpp>
#include "impl/relationals.hpp"
#include "impl/11-addressof.hpp"
#include "impl/11-to_string.hpp"
#include <stdexcept>
#include <string>
#include <cstring> // strerror

#include <utility> // make_pair, operator<

#if ((CXXOMFORT_CXX_STD < 2011))
	// start code for implementation of system_error

	#include "library/typesafe_enum.hpp"
	#include "impl/errc.hpp"

	#define CXXOMFORT_IMPLEMENTS_header_system_error CXXO_IMPLSTATUS_EMULATION()

	#if (CXXOMFORT_COMPILER_ID == CXXO_COMPILERID_MSC)
		#pragma warning (disable:4996) // MSVC: function may be unsafe
	#endif

	#if defined(__linux__) || defined(__unix__)
		#include <unistd.h> // POSIX
	#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_OW)
		#include <errno.h>
		//#include "impl/errno-msvc.hpp"
	#endif

namespace cxxomfort {
namespace cxxostd {

class error_code;



































//
// error_condition and helpers
//

class error_condition;

................................................................................
        p_category= &generic_category();
    }
    
    int        value () const CXXO_NOEXCEPTNOTHROW { return v_error; }
    error_category const& category () const CXXO_NOEXCEPTNOTHROW { return *p_category; }
    std::string message () const;
    
    CXXO_EXPLICIT_OPERATOR(bool) () const CXXO_NOEXCEPT { return !!v_error; }

    friend bool operator== (error_condition const& l, error_condition const& r) CXXO_NOEXCEPTNOTHROW {
        return (l.p_category == r.p_category && l.v_error == r.v_error);
    }
    friend bool operator< (error_condition const& l, error_condition const& r) CXXO_NOEXCEPTNOTHROW {
        return std::make_pair(l.p_category, l.v_error) < std::make_pair(r.p_category, r.v_error);
    }
................................................................................
    // Checks if the error value is set.
    // operator bool () const { return value() != 0; }
    
    error_condition default_error_condition () const CXXO_NOEXCEPTNOTHROW {
        return category().default_error_condition(value());
    }

    CXXO_EXPLICIT_OPERATOR(bool) () const CXXO_NOEXCEPTNOTHROW { return !!value(); }
    
    // comparison operators
    
    friend bool operator== (error_code const& vl, error_code const& vr) CXXO_NOEXCEPTNOTHROW {
        return vl.category()==vr.category() && vl.value()==vr.value();
    }
    friend bool operator<  (error_code const& vl, error_code const& vr) CXXO_NOEXCEPTNOTHROW {
................................................................................
#endif // c++11


#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#else

    #if (CXXOMFORT_CXX_STD>=2011)
    #elif (CXXO_CXXSTDHEADER_system_error>0)
    #else
        
        
namespace std {
    
    using cxxomfort::cxxostd::errc;
    using cxxomfort::cxxostd::make_error_code;
................................................................................

/**
 * @brief Creates a value of type @c errc given a numeric error code.
 * @ingroup cxxomfort-fix
 * 
 * */
static inline errc to_errc(int E) {
#if (CXXO_CXXSTDHEADER_system_error==0)
    return static_cast<cxxomfort::cxxostd::myerrc::type>(E);
#else
    return static_cast<errc>(E);
#endif
}

} } // cxxomfort::fix

Changes to cxxomfort/cxxomfort/type_traits.hpp.

586
587
588
589
590
591
592





593
594
595
596
597
598
599
600
601
: public remove_cv < typename remove_reference<T>::type > 
{
};

} // std

#else // CXX_STD < 1997





	#include <cxxomfort/util/type_traits.hpp>

namespace std {
	using namespace cxxomfort::traits;
}


#endif // CXX_STD >= 1997








>
>
>
>
>

|







586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
: public remove_cv < typename remove_reference<T>::type > 
{
};

} // std

#else // CXX_STD < 1997

	#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_OW)
		#include <cxxomfort/config/ow/type_traits>
	#endif

	#include <cxxomfort/util/type_traits.hpp>
	
namespace std {
	using namespace cxxomfort::traits;
}


#endif // CXX_STD >= 1997

Changes to cxxomfort/cxxomfort/util/type_traits.hpp.

46
47
48
49
50
51
52




53
54
55
56
57
58
59
...
523
524
525
526
527
528
529




530
531
532
533
534
535
536
...
557
558
559
560
561
562
563
















564
565
566
567
568
569
570
 *
 */

#include "../config.hpp"
#include "../base/nullptr.hpp"
//#include <cstddef>
//#include "meta.hpp"





namespace cxxomfort {
namespace traits {

namespace helper {

    template <bool Cond, typename T1, typename T2> struct conditional        { typedef T2 type; };
................................................................................


/*
 * The traits starting at this point are intended 
 * to require compiler support, so we rely on intrinsics
 */





// is_class
template <typename T> struct is_class
: helper::conditional< __is_class(T), true_type, false_type>::type {};

// is_empty
template <typename T> struct is_empty 
: helper::conditional< __is_empty(T), true_type, false_type>::type {};
................................................................................
: helper::conditional< __is_polymorphic(T), true_type, false_type>::type {};

// is_pod
template <typename T> struct is_pod
: helper::conditional< __is_pod(T), true_type, false_type>::type {};



















/*
 * Advanced type properties
 */

// given the above, it should be possible to 
// implement is_scalar.







>
>
>
>







 







>
>
>
>







 







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







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
...
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
...
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
 *
 */

#include "../config.hpp"
#include "../base/nullptr.hpp"
//#include <cstddef>
//#include "meta.hpp"

#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_OW)
	#include <cxxomfort/config/ow/type_traits>
#endif

namespace cxxomfort {
namespace traits {

namespace helper {

    template <bool Cond, typename T1, typename T2> struct conditional        { typedef T2 type; };
................................................................................


/*
 * The traits starting at this point are intended 
 * to require compiler support, so we rely on intrinsics
 */

// for the following compilers, we just return false unless otherwise specified

#if (CXXOMFORT_CXX_STD >= 1997)

// is_class
template <typename T> struct is_class
: helper::conditional< __is_class(T), true_type, false_type>::type {};

// is_empty
template <typename T> struct is_empty 
: helper::conditional< __is_empty(T), true_type, false_type>::type {};
................................................................................
: helper::conditional< __is_polymorphic(T), true_type, false_type>::type {};

// is_pod
template <typename T> struct is_pod
: helper::conditional< __is_pod(T), true_type, false_type>::type {};


#else

template <typename T>
struct is_enum { enum { value = __is_enum(T) }; };

template <typename T>
struct is_union { enum { value = __is_union(T) }; };

template <typename T>
struct is_class { enum { value = __is_class(T) }; };

template <typename T>
struct is_pod { enum { value = is_arithmetic<T>::value  }; };

#endif


/*
 * Advanced type properties
 */

// given the above, it should be possible to 
// implement is_scalar.