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

Overview
Comment:Commit 2020-06-12 - Not the isolation that kills your commits
  • cxxomfort: Fixed an error with the previous release where cxxomfort's cstdint is ignored and a potentially non-existing stdint.h is included in MSVC < 2010.
  • cxxomfort: Now implements a SD-6 header that tests for and backports some of the SD-6 support macros.
  • cxxomfort: Added cxxo-utils.hpp with some base utilities.
  • cxxomfort: Added outp<T>.
  • cxxomfort: Added CXXO_TYPEOF_OR(), CXXO_AUTO_OR macros.
  • algorithm: Added fix / helper ct_clamp.
  • cerrno: New implementation of errc picks most enumerator values and errno names from the underlying system.
  • system_error: Minor simplifications to the code when in C++<11.
  • library:array_ref: Now supports index types shorter than size_t (via default template parameter), for eg.: small-buffers.
  • library:fixed_vector: Now supports index types shorter than size_t (via allocator), for eg.: short-allocator or small size vectors.
  • library:typesafe_enum: Fixed a missing dependency in C++<11.
  • library:tuple: Fixed implementation of tuple_shift for C++03.
  • library:tuple: Fixed a bug in tuple_pop where the first element of the returned tuple would always be default-constructed.
  • tags: Updated tags.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | release | y2020 | gcc_min_408 | clang_min_400 | geany_tags | msvc_min_1700
Files: files | file ages | folders
SHA3-256:70919e9ef4dc623c8f193bd8da7e64cc5cd1d24a30207806ed44dae317afcb54
User & Date: luismachuca 2020-06-15 04:19:21
Context
2020-06-19
01:38
Commit 2020-06-18 - MSVC compatibility fixes and Geany-tag fixes.

Changes in CHANGELOG.txt. Leaf check-in: 98e4fb9c user: luismachuca tags: trunk, y2020, gcc_min_408, tagfiles, clang_min_400, geany_tags, msvc_min_1600

2020-06-15
04:19
Commit 2020-06-12 - Not the isolation that kills your commits
  • cxxomfort: Fixed an error with the previous release where cxxomfort's cstdint is ignored and a potentially non-existing stdint.h is included in MSVC < 2010.
  • cxxomfort: Now implements a SD-6 header that tests for and backports some of the SD-6 support macros.
  • cxxomfort: Added cxxo-utils.hpp with some base utilities.
  • cxxomfort: Added outp<T>.
  • cxxomfort: Added CXXO_TYPEOF_OR(), CXXO_AUTO_OR macros.
  • algorithm: Added fix / helper ct_clamp.
  • cerrno: New implementation of errc picks most enumerator values and errno names from the underlying system.
  • system_error: Minor simplifications to the code when in C++<11.
  • library:array_ref: Now supports index types shorter than size_t (via default template parameter), for eg.: small-buffers.
  • library:fixed_vector: Now supports index types shorter than size_t (via allocator), for eg.: short-allocator or small size vectors.
  • library:typesafe_enum: Fixed a missing dependency in C++<11.
  • library:tuple: Fixed implementation of tuple_shift for C++03.
  • library:tuple: Fixed a bug in tuple_pop where the first element of the returned tuple would always be default-constructed.
  • tags: Updated tags.
check-in: 70919e9e user: luismachuca tags: trunk, release, y2020, gcc_min_408, clang_min_400, geany_tags, msvc_min_1700
2020-02-28
03:36
Commit 2020-02-27 - The 27F Release [1].
  • cxxomfort: No longer needs or uses a TR1 forwarder. Note this is a breaking change. (Closes: [5a9e81910e]).
  • cxxomfort: Base components now no longer rely on any header inside impl/.
  • cxxomfort: portable stdint header moved to new vendor/ folder.
  • cxxomfort: explicit_cast support now correctly checked in when Clang announces explicit operators as an extension, for compatibility and for avoiding warnings (Enhances: [f245681931]) (See also: [1cbdc0b48d], [5ba7743db6)). * functional: Added missing namespace std connection to <tt>invoke</tt>. * functional: Added partial <tt>invoke</tt> emulation for C++03. * functional: <tt>invoke()</tt> implementation moved to its own file for clarity. * functional: <tt>invoke()</tt> now uses std version when in C++>=17. * ostream: Added, with implementations of <tt><ostream></tt>-dependent functionality in other headers. * string_view: Now works with Open Watcom (Enhances: [b8ea55b791]).
  • tuple: Partial implementation of tuple_cat for C++03.
  • type_traits: Added is_[bounded/unbounded]_array from C++20.
  • type_traits: Added remove_cvref from C++20.
  • type_traits: Added remove_all_extents from C++11.
  • type_traits: Added fix to_bool(), to_integral() for pre-C++11 integral_constant.
  • type_traits: Enabled OpenWatcom to default missing intrinsics to false_type when using cxxomfort's internal TR1 (Enhances: [b8ea55b791]).
  • utility: Changes to integer_sequence implementation to compile better under C++11.
  • utility: integer_sequence now uses std version when in C++>=14.
  • library:algorithm: Add is_clamped from p1440 .
  • library:algorithm: Add clamp_halfopen and is_clamped_halfopen, half-open interval clamping operations complementary to std::clamp.
  • library:tuple: Partial implementation of tuple_pop, tuple_shift for tuples up to 5 elements.
  • library:tuple: Now clearly exposes types for tuple pop, push, shift and unshift operations.
  • impl: Moved type_traits from util to the impl directory.
  • impl: Reworked type_traits.

This is the first "major" release of cxxomfort for 202x and thus it is marked as release and trunk. Users pulling from the default repo should be able to upgrade automagically.

There are a number of major, "shaking" changes starting with this version which feature what could be considered the "final" structure for the project. Among the most important:

* The baseline is now more streamlined. In fact, it is possible from now on to set up a minimal base with only the cxxomfort basics by keeping only these five files and folders:
cxxomfort.hpp, base.hpp, config.hpp, base/, config/. * Starting this version cxxomfort no longer requires a TR1 forwarder (and in fact, might not even work with one) when working with compilers in pre-C++11 mode that require one (see Per-Compiler Notes in the wiki). * Conversely, when needing a TR1 implementation (such as in pre-TR1 compilers), the library now honors the previously unsupported macro CXXOMFORT_USE_INTERNAL_TR1 which enables automatically a minimum TR1 featureset. * The compiler now discerns between a C++98/03 mode with TR1 support available ("C++2007"), normal C++98 mode, and a C++ mode without C++98 support ("pre-1997"). This distinction is mostly relevant for compilers such as MSVC <= 2008 and OpenWatcom. * Some files from external sources are now moved to a vendor directory space. * When on Windows, the library now requires and enforces the value of the __STDC_LIMIT_MACROS macro.

This release has been tested on: GCC 4.6 to 5.5 in C++03 mode; GCC 4.6 to 6.0 in C++11 mode; GCC 6 in C++14 mode; MSVC 2008 SP1; MSVC 2012; MSVC 2013 (partially); clang 3.0 to 3.4 in C++03 mode; clang 3.2 to 4.0 in C++11 mode; clang 4.0 in C++14 mode; Open Watcom CI release (partial).

The autogenerated documentation ( http://ryan.gulix.cl/fossil.cgi/cxxomfort/uv/html/) is updated for this release.

Planned updates for the future:

  • Evaluating in full invoke() for C++03.
  • Backporting shift operations from <algorithm> down to at least C++11.
  • Backporting bind_front() down to at least C++11.
  • Backporting bit_cast() down to at least C++11.
  • A true arithmetic type with sizeof()==1 (à-la signed/unsigned char).
  • p0192 "short floats" (16-bit floating point types for storage only).
  • p1402 "cstring_view" (view of native C++ strings).
  • Refining is_contiguous_sequence.
  • "Moving" accumulate and partial_sum as per p0616.

[1] "27F": The release coincides with the 10th anniversary of the 27F Event or Great Cobquecura Earthquake of 2010 (2010-02-27): see https://en.wikipedia.org/wiki/2010_Chile_earthquake . This is why I say it is a shaking release. check-in: 4dad71eb user: luismachuca tags: trunk, msvc_min_1500, clang_min_302, openwatcom_min_200, release, y2020, gcc_min_406

Changes

Changes to cxxomfort/CHANGELOG.txt.


















1
2
3
4
5
6
7
8
9
10
11
12
13

















Commit 2020-02-27 - The 27F Release [1].

  *  cxxomfort: No longer needs or uses a TR1 forwarder. Note this is a breaking change. (Closes: [5a9e81910e]).
  *  cxxomfort: Base components now no longer rely on any header inside <tt>impl/</tt>.
  *  cxxomfort: portable stdint header moved to new <tt>vendor/</tt> folder.
  *  cxxomfort: <tt>explicit_cast</tt> support now correctly checked in when Clang announces explicit operators as an extension, for compatibility and for avoiding warnings (Enhances: [f245681931]) (See also: [1cbdc0b48d], [5ba7743db6)).
  *  functional: Added missing namespace std connection to <tt>invoke</tt>.
  *  functional: Added partial <tt>invoke</tt> emulation for C++03.
  *  functional: <tt>invoke()</tt> implementation moved to its own file for clarity.
  *  functional: <tt>invoke()</tt> now uses std version when in C++>=17.
  *  ostream: Added, with implementations of <tt><ostream></tt>-dependent functionality in other headers.
  *  string_view: Now works with Open Watcom (Enhances: [b8ea55b791]).
  *  tuple: Partial implementation of <tt>tuple_cat</tt> for C++03.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





|







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
Commit 2020-06-12 - Not the isolation that kills your commits

  *  cxxomfort: Fixed an error with the previous release where cxxomfort's cstdint is ignored and a potentially non-existing stdint.h is included in MSVC < 2010.
  *  cxxomfort: Now implements a SD-6 header that tests for and backports some of the SD-6 support macros.
  *  cxxomfort: Added <tt>cxxo-utils.hpp</tt> with some base utilities.
  *  cxxomfort: Added <tt>outp<T></tt>.
  *  cxxomfort: Added <tt>CXXO_TYPEOF_OR()</tt>, <tt>CXXO_AUTO_OR</tt> macros.
  *  algorithm: Added fix / helper <tt>ct_clamp</tt>.
  *  cerrno: New implementation of <tt>errc</tt> picks most enumerator values and errno names from the underlying system.
  *  system_error: Minor simplifications to the code when in C++<11.
  *  library:array_ref: Now supports index types shorter than <tt>size_t</tt> (via default template parameter), for eg.: small-buffers.
  *  library:fixed_vector: Now supports index types shorter than <tt>size_t</tt> (via allocator), for eg.: short-allocator or small size vectors.
  *  library:typesafe_enum: Fixed a missing dependency in C++<11.
  *  library:tuple: Fixed implementation of <tt>tuple_shift</tt> for C++03.
  *  library:tuple: Fixed a bug in <tt>tuple_pop</tt> where the first element of the returned tuple would always be default-constructed.
  *  tags: Updated tags.

Commit 2020-02-27 - The 27F Release [1].

  *  cxxomfort: No longer needs or uses a TR1 forwarder. Note this is a breaking change. (Closes: [5a9e81910e]).
  *  cxxomfort: Base components now no longer rely on any header inside <tt>impl/</tt>.
  *  cxxomfort: portable stdint header moved to new <tt>vendor/</tt> folder.
  *  cxxomfort: <tt>explicit_cast</tt> support now correctly checked in when Clang announces explicit operators as an extension, for compatibility and for avoiding warnings (Enhances: [f245681931]) (See also: [1cbdc0b48d], [5ba7743db6]).
  *  functional: Added missing namespace std connection to <tt>invoke</tt>.
  *  functional: Added partial <tt>invoke</tt> emulation for C++03.
  *  functional: <tt>invoke()</tt> implementation moved to its own file for clarity.
  *  functional: <tt>invoke()</tt> now uses std version when in C++>=17.
  *  ostream: Added, with implementations of <tt><ostream></tt>-dependent functionality in other headers.
  *  string_view: Now works with Open Watcom (Enhances: [b8ea55b791]).
  *  tuple: Partial implementation of <tt>tuple_cat</tt> for C++03.

Changes to cxxomfort/cxxomfort/algorithm.hpp.

267
268
269
270
271
272
273














274
275
276
277

278
279
280
281
282
283
284
285

286




287
288
289
290
291
292
293
...
333
334
335
336
337
338
339


340
341
342
343
344
345
346
347
...
349
350
351
352
353
354
355
356
357

358

359
360


361
362
363
364
365
366
367
...
392
393
394
395
396
397
398
399

400
401
    return first;
}


#endif // _STD
} } //~namespace cxxomfort::cxxostd

















// These are in their own files
// included in c++11 onwards

#include "impl/11-is_xxx_of.hpp"
//! @include{doc} impl/11-is_xxx_of.hpp
#include "impl/11-minmax.hpp"
//! @include{doc} impl/11-minmax.hpp
#include "impl/11-permutations.hpp"
// c++14 onwards
#include "impl/14-algorithm-equal.hpp"
// c++17 onwards

#include "impl/17-clamp.hpp"





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

#if (defined( CXXOFLAG_NO_STD_USING ) && CXXOFLAG_NO_STD_USING>0)
#else
................................................................................
 * 
 * @code
 * #include <cxxomfort/algorithm.hpp>
 * @endcode
 * 
 * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>)
 *


 * Interfaces defined in this section:
 * 
 * * @c all_of(), @c any_of(), @c none_of() (C++11) - check if elements of a sequence fit a predicate.
 * * @c copy_if(), @c copy_n(), @c partition_copy() (C++11) - copy elements from a sequence.
 * * @c find_if_not() (C++11) - check if elements @e don't fit a predicate.
 * * @c is_permutation(), @c next_permutation(), @c prev_permutation() (C++11) - check the sorting status of a sequence.
 * * @c is_sorted() (C++11) - check the sorting status of a sequence.
 * * @c minmax() , @c minmax_element() (C++11) - minimum and maximum elements in a sequence.
................................................................................
 * * @c clamp() (C++17) - constrain values.
 * * @c count() , @c count_if() (C++17) - count elements in a sequence.
 * * @c for_each_n() (C++17) - execute functors across a sequence.
 * 
 * Pending:
 * 
 * * @c shuffle
 * * @c shift_left, @c shift_right
 * 

 * 

 *
 * Algorithm demonstrations:


 * 
 * Copies and prints elements from a list via 
 * @c copy_if() and @c for_each_n() .
 * 
 * @code

struct  {
................................................................................
 * 
 * * @c randomly.cpp https://notabug.org/lmachucabezzaza/cxxomfort-examples/src/master/examples/randomly.cpp
 * * <em>More pending...</em>
 *
 * @section also See Also
 * 
 * @see @ref cxxomfort/algorithm.hpp (header reference)
 * @see @cppref{algorithm} (cppreference) , @ref std0numeric , @ref cxxo-sup-algorithm (supplemental)

 * 
 * */







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




>

|

<




>

>
>
>
>







 







>
>
|







 







|

>

>
|
<
>
>







 







|
>


267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295

296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
...
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
...
370
371
372
373
374
375
376
377
378
379
380
381
382

383
384
385
386
387
388
389
390
391
...
416
417
418
419
420
421
422
423
424
425
426
    return first;
}


#endif // _STD
} } //~namespace cxxomfort::cxxostd

namespace cxxomfort { namespace fix {

template <typename Integer, Integer x, Integer lo, Integer hi>
struct ct_clamp {
	typedef Integer type;
	static CXXO_CONSTEXPR const 
	Integer value = (x < lo) ? lo : ( hi < x ? hi : x);
};

template <size_t x, size_t lo, size_t hi>
struct index_ct_clamp : ct_clamp<size_t, x, lo, hi> {};


}} // cxxomfort::fix


// These are in their own files
// included in c++11 onwards
//! @include{doc} impl/11-is_xxx_of.hpp
#include "impl/11-is_xxx_of.hpp"
//! @include{doc} impl/11-minmax.hpp
#include "impl/11-minmax.hpp"

#include "impl/11-permutations.hpp"
// c++14 onwards
#include "impl/14-algorithm-equal.hpp"
// c++17 onwards
//! @include{doc} impl/17-clamp.hpp
#include "impl/17-clamp.hpp"
// c++20 onwards
// ! @include{doc} impl/20-shift.hpp
//#include "impl/20-shift.hpp"


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

#if (defined( CXXOFLAG_NO_STD_USING ) && CXXOFLAG_NO_STD_USING>0)
#else
................................................................................
 * 
 * @code
 * #include <cxxomfort/algorithm.hpp>
 * @endcode
 * 
 * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>)
 *
 * @section Interfaces 
 * 
 * Backports defined in this section:
 * 
 * * @c all_of(), @c any_of(), @c none_of() (C++11) - check if elements of a sequence fit a predicate.
 * * @c copy_if(), @c copy_n(), @c partition_copy() (C++11) - copy elements from a sequence.
 * * @c find_if_not() (C++11) - check if elements @e don't fit a predicate.
 * * @c is_permutation(), @c next_permutation(), @c prev_permutation() (C++11) - check the sorting status of a sequence.
 * * @c is_sorted() (C++11) - check the sorting status of a sequence.
 * * @c minmax() , @c minmax_element() (C++11) - minimum and maximum elements in a sequence.
................................................................................
 * * @c clamp() (C++17) - constrain values.
 * * @c count() , @c count_if() (C++17) - count elements in a sequence.
 * * @c for_each_n() (C++17) - execute functors across a sequence.
 * 
 * Pending:
 * 
 * * @c shuffle
 * * @c shift_left(), @c shift_right() (C++20)
 * 
 * Non-backport features:
 * 
 * * @c cxxomfort::fix::const_clamp - constrain numeric values as template arguments.
 * 

 *
 * @section demo Demonstration:
 * 
 * Copies and prints elements from a list via 
 * @c copy_if() and @c for_each_n() .
 * 
 * @code

struct  {
................................................................................
 * 
 * * @c randomly.cpp https://notabug.org/lmachucabezzaza/cxxomfort-examples/src/master/examples/randomly.cpp
 * * <em>More pending...</em>
 *
 * @section also See Also
 * 
 * @see @ref cxxomfort/algorithm.hpp (header reference)
 * @see @cppref{algorithm} (cppreference) 
 * @see @ref std0numeric (std numeric algorithms) , @ref cxxo-sup-algorithm (supplemental)
 * 
 * */

Changes to cxxomfort/cxxomfort/array.hpp.

1
2
3
4
5

6
7
8
9
10
11
12
..
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
#ifndef CXXOMFORT_ARRAY_HPP
#define CXXOMFORT_ARRAY_HPP
/**
 * @file
 *

 */

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


#if (CXXOMFORT_CXX_STD<1997)
................................................................................
 * @page std0array <array>
 * @brief Backports related to Standard header <tt><array></tt> 
 * 
 * @code
#include <cxxomfort/array.hpp>
 * @endcode
 * 
 * Including the header brings up @c std::array , accounting for eg.: 
 * location being @c std::tr1::array where set up in C++03.
 * 
 * An @c std::array is much like a native C-array in that it has a 
 * type and size set up at compile time, but it also adds an interface 
 * similar to most of C++'s sequence containers: 
 * it has a <tt>begin/end</tt>, an <tt>iterator</tt> type, and 
 * accepts indexing of elements via the <tt>operator[]</tt>.
 * 
 * Interfaces defined in this section:
 * 
 * * (none)
 * 
 * Interfaces repointed in this section:
 * 
 * * @c std::array (C++11) - C++ type version of a C-array.
 * * @c get() - Get an element from an array by its compile-time index.
 * 
 * 
 * @section See Also 
 * 
 * @see @cppref{header/array} (cppreference)
 * @see @cppref{array}
 * @see @ref{libarrayref,cxxomfort's @c array_ref }
 * 
 * */





|
>







 







|
|
|
|
|
|
|
|











|



|



1
2
3
4
5
6
7
8
9
10
11
12
13
..
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
#ifndef CXXOMFORT_ARRAY_HPP
#define CXXOMFORT_ARRAY_HPP
/**
 * @file
 * @brief Implementations and Backports for Standard header <code>\<array\></code>.
 * @xrefitem std0algorithm "<array>" "Header"
 */

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


#if (CXXOMFORT_CXX_STD<1997)
................................................................................
 * @page std0array <array>
 * @brief Backports related to Standard header <tt><array></tt> 
 * 
 * @code
#include <cxxomfort/array.hpp>
 * @endcode
 * 
 * Including the header brings up @c std::array , accounting for eg.: location being @c std::tr1::array where set up in C++03+TR1.
 * 
 * If no TR1 is found and the user has defined the macro <tt>CXXOMFORT_USE_INTERNAL_TR1</tt>, cxxomfort uses this header to provide its own implementation of <tt>array</tt>.
 * 
 * 
 * An @c std::array is much like a native C-array in that it has a type and size set up at compile time, but it also adds an interface similar to most of C++'s sequence containers: it has a <tt>begin/end</tt>, an <tt>iterator</tt> type, and accepts indexing of elements via the <tt>operator[]</tt>.
 * 
 * @section Interfaces
 * 
 * Interfaces defined in this section:
 * 
 * * (none)
 * 
 * Interfaces repointed in this section:
 * 
 * * @c std::array (C++11) - C++ type version of a C-array.
 * * @c get() - Get an element from an array by its compile-time index.
 * 
 * 
 * @section also See Also 
 * 
 * @see @cppref{header/array} (cppreference)
 * @see @cppref{array}
 * @see @link libarrayref cxxomfort\'s @c array_ref @endlink
 * 
 * */

Changes to cxxomfort/cxxomfort/base/cstdint.hpp.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
..
62
63
64
65
66
67
68
69
70


71
72
73
74
75
76
77
    #endif
    #include <cstdint>
    #define CXXOMFORT_USING_NATIVE_stdint
#else
    #if 0
        #error ("Unreachable.");
    
    #elif (CXXO_COMPILER_SUPPORT_cstd_cstdint > 0)
        #if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1)
            #pragma message CXXO_NOTICE("Including native <cstdint>")
        #endif
        #include <cstdint>
        #define CXXOMFORT_USING_NATIVE_stdint
    #elif (CXXOMFORT_COMPILER_ID == CXXO_COMPILERID_CLANG && !defined(_LIBCPP))
    // GCC and clang have a <stdlib.h>
................................................................................
            #define __STDC_LIMIT_MACROS
            #include <cstdint>
            #define CXXOMFORT_USING_NATIVE_stdint
            #endif
        #else
            //#include <stdint.h>
        #endif
    #else



    #endif
#endif // c++11

#if (!defined(CXXOMFORT_USING_NATIVE_stdint))
    #if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1)
        #pragma message CXXO_NOTICE("cstdint forwarded to portable-stdint")
    #endif







|







 







|
<
>
>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
..
62
63
64
65
66
67
68
69

70
71
72
73
74
75
76
77
78
    #endif
    #include <cstdint>
    #define CXXOMFORT_USING_NATIVE_stdint
#else
    #if 0
        #error ("Unreachable.");
    
    #elif (CXXO_CXXSTDHEADER_cstdint > 0)
        #if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1)
            #pragma message CXXO_NOTICE("Including native <cstdint>")
        #endif
        #include <cstdint>
        #define CXXOMFORT_USING_NATIVE_stdint
    #elif (CXXOMFORT_COMPILER_ID == CXXO_COMPILERID_CLANG && !defined(_LIBCPP))
    // GCC and clang have a <stdlib.h>
................................................................................
            #define __STDC_LIMIT_MACROS
            #include <cstdint>
            #define CXXOMFORT_USING_NATIVE_stdint
            #endif
        #else
            //#include <stdint.h>
        #endif
    #else // other compilers

		#include <stdint.h>
		#include <inttypes.h>
    #endif
#endif // c++11

#if (!defined(CXXOMFORT_USING_NATIVE_stdint))
    #if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1)
        #pragma message CXXO_NOTICE("cstdint forwarded to portable-stdint")
    #endif

Changes to cxxomfort/cxxomfort/base/move.hpp.

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
    #define CXXOMFORT_USING_MOVE_EMULATION 1
#endif

#if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 2)
#pragma message CXXO_NOTICE("enabled rvref and movable object emulation.")
#endif

#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_OW,<9999))
    #include "move-00.hpp" // basically "does-nothing" move

#elif !defined (CXXOMFORT_USING_MOVE_EMULATION)
    #include "move-11.hpp"
    // end c++11
#else
    #include "move-03.hpp"







|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
    #define CXXOMFORT_USING_MOVE_EMULATION 1
#endif

#if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 2)
#pragma message CXXO_NOTICE("enabled rvref and movable object emulation.")
#endif

#if (CXXO_COMPILERREQ(CXXO_COMPILERID_OW,<9999))
    #include "move-00.hpp" // basically "does-nothing" move

#elif !defined (CXXOMFORT_USING_MOVE_EMULATION)
    #include "move-11.hpp"
    // end c++11
#else
    #include "move-03.hpp"

Changes to cxxomfort/cxxomfort/base/static_assert.hpp.

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

#include "../config.hpp"

//#define CXXOMFORT_JOIN(a,b) a##b
//#define CXXOMFORT_JOINX(a,b) CXXOMFORT_JOIN(a,b)


#if (CXXOMFORT_CXX_STD < 2011)
#if (CXXO_COMPILER_SUPPORT_static_assert == 0) // static_assert is not supported
    #define CXXOMFORT_USING_static_assert
#endif
#endif

// implementation
/////////////////

#if defined(CXXOMFORT_USING_static_assert)
    #if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 2)
................................................................................
    #pragma message CXXO_NOTICE("enabled 'static_assert' emulation.")
    #endif

/*
 * This is marked as a system header 
 * as it uses the name of a C++11 reserved word as an identifier.
 */
#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, >= 406))
    //#pragma GCC system_header
#endif


// trick from https://stackoverflow.com/questions/3046889/optional-parameters-with-c-macros 
// for allowing a macro with an optional argument

................................................................................
/**
 * @def static_assert
 * @ingroup cxx11-backports
 * @brief Provides an assertion at compile-time
 * @param test The boolean test to run, must be computable at compile-time
 * @param msg The string literal to provide as a compiler error message if the assertion does not hold
 * @see https://en.cppreference.com/w/cpp/language/static_assert

















 * 
 */
//    #define static_assert(test,msg) enum { CXXO_JOIN(sassert_e_,__COUNTER__) = (int)(msg[0])/(test) }
    #if defined(_MSC_VER)
    #define static_assert(test,msg) typedef void* CXXO_JOIN(sassert_expr_,__COUNTER__)[(test)?1:-1]
    #elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_OW)
    #define static_assert(test,msg) enum { CXXO_JOIN(sassert_expr_,__LINE__) = 1 /(test) }








>

|
|
|







 







|







 







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







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

#include "../config.hpp"

//#define CXXOMFORT_JOIN(a,b) a##b
//#define CXXOMFORT_JOINX(a,b) CXXOMFORT_JOIN(a,b)


#if (CXXOMFORT_CXX_STD < 2011)
	#if (CXXO_COMPILER_SUPPORT_static_assert == 0) // static_assert is not supported
		#define CXXOMFORT_USING_static_assert
	#endif
#endif

// implementation
/////////////////

#if defined(CXXOMFORT_USING_static_assert)
    #if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 2)
................................................................................
    #pragma message CXXO_NOTICE("enabled 'static_assert' emulation.")
    #endif

/*
 * This is marked as a system header 
 * as it uses the name of a C++11 reserved word as an identifier.
 */
#if (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC, >= 406))
    //#pragma GCC system_header
#endif


// trick from https://stackoverflow.com/questions/3046889/optional-parameters-with-c-macros 
// for allowing a macro with an optional argument

................................................................................
/**
 * @def static_assert
 * @ingroup cxx11-backports
 * @brief Provides an assertion at compile-time
 * @param test The boolean test to run, must be computable at compile-time
 * @param msg The string literal to provide as a compiler error message if the assertion does not hold
 * @see https://en.cppreference.com/w/cpp/language/static_assert
 * 
 * Example usage:
 * 
 * @code

// example static_assert
static_assert( is_same<typename std::string::value_type, char>::value, "string?");
// since it is a macro, tests that contain commas must be reformulated
static_assert((sizeof(pair<int,int>) > sizeof(int)), "pair?");
enum foo { ... };
enum { complicated_test = 
	is_same< typename underlying_type<foo>::type, 
		typename decay< map< int, vector<foo> >::value_type >::type
	>::value
};
static_assert (complicated_test, "complicated?");
 * @endcode
 * 
 */
//    #define static_assert(test,msg) enum { CXXO_JOIN(sassert_e_,__COUNTER__) = (int)(msg[0])/(test) }
    #if defined(_MSC_VER)
    #define static_assert(test,msg) typedef void* CXXO_JOIN(sassert_expr_,__COUNTER__)[(test)?1:-1]
    #elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_OW)
    #define static_assert(test,msg) enum { CXXO_JOIN(sassert_expr_,__LINE__) = 1 /(test) }

Changes to cxxomfort/cxxomfort/cerrno.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
#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)




|







1
2
3
4
5
6
7
8
9
10
11
12
#ifndef CXXOMFORT_CERRNO_HPP
#define CXXOMFORT_CERRNO_HPP
/**
 * @file
 * @brief Implementations and completion of names tied to <tt>\<cerrno\></tt>.
 * @xrefitem std0cerrno "<cerrno>" ""
 *
 */

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

Changes to cxxomfort/cxxomfort/config.hpp.

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
#if !defined(CXXOFLAG_INCLUDE_PATH)
#define CXXOFLAG_INCLUDE_PATH() ""
#endif
#define CXXO_INCLUDE_SYS(NAME) <CXXOFLAG_INCLUDE_PATH()NAME>

#endif // doxygen


// #define CXXOFLAG_INCLUDE_PATH() "/usr/include/c++"


#define CXXO_INCLUDE_SYS(NAME) <NAME>


#define CXXO_COMPILERVERSION_COMPARE(com_,ver_) ((CXXOMFORT_COMPILER_ID == com_ && CXXOMFORT_COMPILER_VERSION ver_))

#define CXXO_NOTICE_IMPL_(msg) (msg)

//! Emits a notice at compilation time.
#define CXXO_NOTICE(msg) CXXO_NOTICE_IMPL_(  __FILE__ "(" CXXO_STRINGIZE1(__LINE__) ") : cxxomfort notice: " msg)
//! Emits a warning at compilation time.
#define CXXO_WARNING(msg) CXXO_NOTICE_IMPL_( __FILE__ "(" CXXO_STRINGIZE1(__LINE__) ") : cxxomfort warning: " msg)



/*
 * Detect compilers and apply specific configurations.
 */
#if 0
#elif defined(__clang__)







<
<
<
<


<
|







<







63
64
65
66
67
68
69




70
71

72
73
74
75
76
77
78
79

80
81
82
83
84
85
86
#if !defined(CXXOFLAG_INCLUDE_PATH)
#define CXXOFLAG_INCLUDE_PATH() ""
#endif
#define CXXO_INCLUDE_SYS(NAME) <CXXOFLAG_INCLUDE_PATH()NAME>

#endif // doxygen





#define CXXO_INCLUDE_SYS(NAME) <NAME>


#define CXXO_COMPILERREQ(com_,ver_) ((CXXOMFORT_COMPILER_ID == com_ && CXXOMFORT_COMPILER_VERSION ver_))

#define CXXO_NOTICE_IMPL_(msg) (msg)

//! Emits a notice at compilation time.
#define CXXO_NOTICE(msg) CXXO_NOTICE_IMPL_(  __FILE__ "(" CXXO_STRINGIZE1(__LINE__) ") : cxxomfort notice: " msg)
//! Emits a warning at compilation time.
#define CXXO_WARNING(msg) CXXO_NOTICE_IMPL_( __FILE__ "(" CXXO_STRINGIZE1(__LINE__) ") : cxxomfort warning: " msg)



/*
 * Detect compilers and apply specific configurations.
 */
#if 0
#elif defined(__clang__)

Changes to cxxomfort/cxxomfort/config/_codegen.hpp.

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
    #define CXXO_ENABLEIF_TEMPLATE() 
    #define CXXO_ENABLEIF_FUNCTION() \
    , typename std::enable_if< CXXO_SIGCONDITION >::type * = nullptr 
    
#endif

/* 
 * CXXO_TYPEOF

 * 
 * */
#if (CXXOMFORT_CXX_STD>=2011 || CXXO_COMPILER_SUPPORT_decltype)
	#undef  CXXO_TYPEOF
	#define CXXO_TYPEOF(...) decltype(__VA_ARGS__)
#elif (CXXO_COMPILER_SUPPORT_typeof && !defined(CXXO_TYPEOF))
	#undef  CXXO_TYPEOF
	#define CXXO_TYPEOF(...) __typeof__(__VA_ARGS__)
#elif (!defined(CXXO_TYPEOF))
	// a shot in the dark?
	#define CXXO_TYPEOF(expr) cxxo_typeof_not_available_t 
#endif

































#else
	//
	// documentation section
	//








|
>













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







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
    #define CXXO_ENABLEIF_TEMPLATE() 
    #define CXXO_ENABLEIF_FUNCTION() \
    , typename std::enable_if< CXXO_SIGCONDITION >::type * = nullptr 
    
#endif

/* 
 * @def CXXO_TYPEOF
 * @brief Obtains type of an expression using @c decltype or @c typeof .
 * 
 * */
#if (CXXOMFORT_CXX_STD>=2011 || CXXO_COMPILER_SUPPORT_decltype)
	#undef  CXXO_TYPEOF
	#define CXXO_TYPEOF(...) decltype(__VA_ARGS__)
#elif (CXXO_COMPILER_SUPPORT_typeof && !defined(CXXO_TYPEOF))
	#undef  CXXO_TYPEOF
	#define CXXO_TYPEOF(...) __typeof__(__VA_ARGS__)
#elif (!defined(CXXO_TYPEOF))
	// a shot in the dark?
	#define CXXO_TYPEOF(expr) cxxo_typeof_not_available_t 
#endif

/**
 * @def CXXO_TYPEOF_OR
 * @brief Declared type of an expression, or a hint.
 * */
#if (CXXOMFORT_CXX_STD >= 2011 || CXXO_COMPILER_SUPPORT_decltype || CXXO_COMPILER_SUPPORT_typeof)
	#define CXXO_TYPEOF_OR(T,E) CXXO_TYPEOF(E)
#else
	#define CXXO_TYPEOF_OR(T,E) T
#endif

/**
 * @def CXXO_AUTO
 * */
#if (CXXOMFORT_CXX_STD >= 2011)
	#define CXXO_AUTO(name, ...) auto name = __VA_ARGS__
#else
	#define CXXO_AUTO(name, ...) CXXO_TYPEOF(__VA_ARGS__) name = __VA_ARGS__ 
#endif

/**
 * @def CXXO_AUTO_OR
 * @brief Declares a variable with the type of an expression, or a hinted type.
 * */
#if (CXXOMFORT_CXX_STD >= 2011)
	#define CXXO_AUTO_OR(Name, Expr, T) auto Name = Expr
#elif (CXXO_COMPILER_SUPPORT_decltype || CXXO_COMPILER_SUPPORT_typeof)
	#define CXXO_AUTO_OR(Name, Expr, T) CXXO_TYPEOF(Expr) Name = Expr 
#else
	#define CXXO_AUTO_OR(Name, Expr, T) T Name = Expr 
#endif


#else
	//
	// documentation section
	//

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

285
286
287
288
289
290
291

































292
293
294
295
296
297
298
 * n3928 - static_assert without message
 * p0005r2 - not_fn
 * p0007r1 - as_const
 * 
 
 * 
 */


































#if defined(DOXYGEN_DOC)

/**
 * @page cxxomfort-behaviour Configuration Macros
 * 
 * Listing of a number of macros that can be used to change the behaviour of @a cxxomfort .







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







285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
 * n3928 - static_assert without message
 * p0005r2 - not_fn
 * p0007r1 - as_const
 * 
 
 * 
 */



// backports

#if (CXXO_COMPILER_SUPPORT_decltype)
	#define CXXOMFORT_IMPLEMENTS_n1978 CXXO_IMPLSTATUS_NATIVE()
#elif (CXXO_COMPILER_SUPPORT_typeof)
	#define CXXOMFORT_IMPLEMENTS_n1978 CXXO_IMPLSTATUS_EMULATION()
#else
	#define CXXOMFORT_IMPLEMENTS_n1978 0
#endif
#define CXXOMFORT_IMPLEMENTS_n2343 CXXO_IMPLSTATUS_BACKPORT()

#define CXXOMFORT_IMPLEMENTS_std_array 0
#define CXXOMFORT_IMPLEMENTS_std_reference_wrapper 0
#define CXXOMFORT_IMPLEMENTS_std_remove_cvref 0
#define CXXOMFORT_IMPLEMENTS_string_view 0
#define CXXOMFORT_IMPLEMENTS_decltype CXXOMFORT_IMPLEMENTS_n1978
#define CXXOMFORT_IMPLEMENTS_destroy_at 0
#define CXXOMFORT_IMPLEMENTS_heterogeneous_operator_functors 0
#define CXXOMFORT_IMPLEMENTS_make_unique 0
#define CXXOMFORT_IMPLEMENTS_std_void_t 0
#define CXXOMFORT_IMPLEMENTS_tuple_get_type 0
#define CXXOMFORT_IMPLEMENTS_integral_constant_callable 0
// supplements
#define CXXOMFORT_IMPLEMENTS_array_ref 0
#define CXXOMFORT_IMPLEMENTS_foreach 0
#define CXXOMFORT_IMPLEMENTS_function_ref 0
#define CXXOMFORT_IMPLEMENTS_tuple_operations 0




#if defined(DOXYGEN_DOC)

/**
 * @page cxxomfort-behaviour Configuration Macros
 * 
 * Listing of a number of macros that can be used to change the behaviour of @a cxxomfort .

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

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
	// (pending check against libcpp mode however)
	#undef  CXXOFLAG_tr1
	#define CXXOFLAG_tr1 1
	#undef  CXXOFLAG_directory_tr1
	#define CXXOFLAG_directory_tr1 1
	#undef  CXXOFLAG_namespace_tr1
	#define CXXOFLAG_namespace_tr1 1








#endif

#undef  CXXO_COMPILER_SUPPORT_tr1_array
#define CXXO_COMPILER_SUPPORT_tr1_array (CXXOMFORT_CXX_STD < 2011)
#undef  CXXO_COMPILER_SUPPORT_tr1_tuple
#define CXXO_COMPILER_SUPPORT_tr1_tuple (CXXOMFORT_CXX_STD < 2011)
#undef  CXXO_COMPILER_SUPPORT_tr1_type_traits
#define CXXO_COMPILER_SUPPORT_tr1_type_traits (CXXOMFORT_CXX_STD < 2011)

#if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_COMPILER_VERSION >= 300 && CXXOMFORT_COMPILER_VERSION < 400)
	#undef  CXXOFLAG_tr1
	#define CXXOFLAG_tr1 1
	#ifdef _LIBCPP
		
	#else
		// TR1 stuff is under directory tr1/
		#undef  CXXOFLAG_directory_tr1
		#define CXXOFLAG_directory_tr1 1
		#undef  CXXOFLAG_namespace_tr1 
		#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() } }


	#endif
#endif
// c++11

#undef  CXXO_COMPILER_SUPPORT_alignof
#define CXXO_COMPILER_SUPPORT_alignof (CXXOMFORT_CXX_STD >= 2011 || CXXOMFORT_COMPILER_VERSION>=209)
#undef  CXXO_COMPILER_SUPPORT_alignment_tools
#define CXXO_COMPILER_SUPPORT_alignment_tools __has_extension(cxx_alignas)
#undef  CXXO_COMPILER_SUPPORT_attribute
#define CXXO_COMPILER_SUPPORT_attribute __has_feature(cxx_attributes)
#undef  CXXO_COMPILER_SUPPORT_auto







>
>
>
>
>
>
>
>









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







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
	// (pending check against libcpp mode however)
	#undef  CXXOFLAG_tr1
	#define CXXOFLAG_tr1 1
	#undef  CXXOFLAG_directory_tr1
	#define CXXOFLAG_directory_tr1 1
	#undef  CXXOFLAG_namespace_tr1
	#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() } }

#endif

#undef  CXXO_COMPILER_SUPPORT_tr1_array
#define CXXO_COMPILER_SUPPORT_tr1_array (CXXOMFORT_CXX_STD < 2011)
#undef  CXXO_COMPILER_SUPPORT_tr1_tuple
#define CXXO_COMPILER_SUPPORT_tr1_tuple (CXXOMFORT_CXX_STD < 2011)
#undef  CXXO_COMPILER_SUPPORT_tr1_type_traits
#define CXXO_COMPILER_SUPPORT_tr1_type_traits (CXXOMFORT_CXX_STD < 2011)
























#undef  CXXO_COMPILER_SUPPORT_alignof
#define CXXO_COMPILER_SUPPORT_alignof (CXXOMFORT_CXX_STD >= 2011 || CXXOMFORT_COMPILER_VERSION>=209)
#undef  CXXO_COMPILER_SUPPORT_alignment_tools
#define CXXO_COMPILER_SUPPORT_alignment_tools __has_extension(cxx_alignas)
#undef  CXXO_COMPILER_SUPPORT_attribute
#define CXXO_COMPILER_SUPPORT_attribute __has_feature(cxx_attributes)
#undef  CXXO_COMPILER_SUPPORT_auto

Added cxxomfort/cxxomfort/config/sd.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
#ifndef CXXOMFORT_CONFIG_SD_HPP
#define CXXOMFORT_CONFIG_SD_HPP
/**
 * @file
 * @brief Testing and backport of compiler support (SD-n) macros.
 * 
 * This header complements the tasks in config/_support.hpp and makes available some 
 * macro names defined in SD6 that provide feature-testing for C++.
 * 
 * Interfaces defined in this header:
 * 
 * * @c __cpp_unicode_characters
 * * @c __cpp_range_based_for
 * * @c __cpp_static_assert
 * * @c __cpp_declype
 * * @c __cpp_variadic_templates
 * * @c __cpp_inheriting_constructors
 * 
 * 
 * @see https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
 * 
 */

#include "../config.hpp"
#include "../config/_support.hpp"

// C++ Unicode Characters (C++11 n2249)
#ifdef  __cpp_unicode_characters
	#if __cpp_unicode_characters >= 200704
		#undef  CXXO_COMPILER_SUPPORT_charn_t
		#define CXXO_COMPILER_SUPPORT_charn_t __cpp_unicode_characters
	#endif
#else
	#define __cpp_unicode_characters CXXO_COMPILER_SUPPORT_charn_t
#endif

// C++ Range-based for
#ifdef  __cpp_range_based_for
	#if __cpp_range_based_for >= 200907
		#undef  CXXO_COMPILER_SUPPORT_foreach
		#define CXXO_COMPILER_SUPPORT_foreach __cpp_range_based_for
	#endif
#else
	#define __cpp_range_based_for CXXO_COMPILER_SUPPORT_foreach
#endif

// C++ Static Assert n1720
#ifdef  __cpp_static_assert
	#if __cpp_static_assert >= 200410
		#undef  CXXO_COMPILER_SUPPORT_static_assert
		#define CXXO_COMPILER_SUPPORT_static_assert __cpp_static_assert
	#endif
#else
	#define __cpp_static_assert CXXO_COMPILER_SUPPORT_static_assert
#endif

// C++ Decltype n2343
#ifdef  __cpp_decltype
	#if __cpp_decltype >= 200707
		#undef  CXXO_COMPILER_SUPPORT_decltype
		#define CXXO_COMPILER_SUPPORT_decltype __cpp_decltype
	#endif
#else
	#define __cpp_decltype CXXO_COMPILER_SUPPORT_decltype
#endif

// C++ Variadic Templates n2242
#ifdef  __cpp_variadic_templates
	#if __cpp_variadic_templates >= 200704
		#undef  CXXO_COMPILER_SUPPORT_variadic
		#define CXXO_COMPILER_SUPPORT_variadic __cpp_variadic_templates
	#endif
#else
	#define __cpp_variadic_templates CXXO_COMPILER_SUPPORT_variadic
#endif


// C++ Inheriting Constructors n2540
#ifdef  __cpp_inheriting_constructors
	#if __cpp_inheriting_constructors >= 200704
		#undef  CXXO_COMPILER_SUPPORT_inheriting_constructors
		#define CXXO_COMPILER_SUPPORT_inheriting_constructors __cpp_inheriting_constructors
	#endif
#else
	#define __cpp_inheriting_constructors 0
#endif

// C++ Constexpr
#ifdef  __cpp_constexpr
	#if __cpp_constexpr >= 200704
		#undef  CXXO_COMPILER_SUPPORT_constexpr
		#define CXXO_COMPILER_SUPPORT_constexpr __cpp_constexpr
	#endif
	#if __cpp_constexpr >= 201304 // relaxed
		#undef  CXXO_COMPILER_SUPPORT_constexpr_relaxed
		#define CXXO_COMPILER_SUPPORT_constexpr_relaxed __cpp_constexpr
	#endif
#else
	#define __cpp_constexpr CXXO_COMPILER_SUPPORT_constexpr
#endif

// C++14

// C++ transparent functors (n3421)
#ifdef  __cpp_lib_transparent_operators
	#if __cpp_lib_transparent_operators >= 201210
		#undef  CXXO_COMPILER_SUPPORT_functional_transparent
		#define CXXO_COMPILER_SUPPORT_functional_transparent __cpp_lib_transparent_operators
	#endif
#else
	#define __cpp_lib_transparent_operators CXXO_COMPILER_SUPPORT_functional_transparent
#endif

// C++ integral_constant::operator() (n3545)
#ifdef  __cpp_lib_integral_constant_callable
	#if __cpp_lib_integral_constant_callable >= 201304
		#undef  CXXO_COMPILER_SUPPORT_integral_constant_callable
		#define CXXO_COMPILER_SUPPORT_integral_constant_callable __cpp_lib_integral_constant_callable
	#endif
#else
	#define __cpp_lib_integral_constant_callable CXXO_COMPILER_SUPPORT_integral_constant_callable
#endif

// C++ tuple get<type> (n3670)
#ifdef  __cpp_lib_tuples_by_type
	#if __cpp_lib_tuples_by_type >= 201304
		#undef  CXXO_COMPILER_SUPPORT_integral_constant_callable
		#define CXXO_COMPILER_SUPPORT_integral_constant_callable __cpp_lib_integral_constant_callable
	#endif
#else
	#define __cpp_lib_integral_constant_callable CXXO_COMPILER_SUPPORT_integral_constant_callable
#endif


#endif

Changes to cxxomfort/cxxomfort/cstddef.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
#ifndef CXXOMFORT_CSTDDEF_HPP
#define CXXOMFORT_CSTDDEF_HPP
/**
 * @file
 * @brief Implementations and additions tied to Standard header <tt><cstddef></tt>.
 * @ingroup std0cstddef 
 * 
 */

#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
#include CXXO_INCLUDE_SYS(cstddef)

#if (CXXO_COMPILER_SUPPORT_decltype)
	#define CXXOMFORT_IMPLEMENTS_n1978 CXXO_IMPLSTATUS_NATIVE()
#elif (CXXO_COMPILER_SUPPORT_typeof)
	#define CXXOMFORT_IMPLEMENTS_n1978 CXXO_IMPLSTATUS_EMULATION()
#else
	#define CXXOMFORT_IMPLEMENTS_n1978 0
#endif

#define CXXOMFORT_IMPLEMENTS_decltype CXXOMFORT_IMPLEMENTS_n1978
#define CXXOMFORT_IMPLEMENTS_n2343 CXXO_IMPLSTATUS_BACKPORT()


/**
 * @typedef max_align_t 
 * @brief Alias for the native type with the largest alignment available.
 * @sa https://en.cppreference.com/w/cpp/types/max_align_t
 * @ingroup cxx11-backports




|








<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8
9
10
11
12
13










14
15
16
17
18
19
20
#ifndef CXXOMFORT_CSTDDEF_HPP
#define CXXOMFORT_CSTDDEF_HPP
/**
 * @file
 * @brief Implementations and additions tied to Standard header <tt>\<cstddef\></tt>.
 * @ingroup std0cstddef 
 * 
 */

#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
#include CXXO_INCLUDE_SYS(cstddef)













/**
 * @typedef max_align_t 
 * @brief Alias for the native type with the largest alignment available.
 * @sa https://en.cppreference.com/w/cpp/types/max_align_t
 * @ingroup cxx11-backports

Changes to cxxomfort/cxxomfort/cstdint.hpp.

9
10
11
12
13
14
15

16
17
18
19
20
21
22
#include <cxxomfort/base.hpp>
#if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
#pragma message CXXO_NOTICE("enabled <cstdint> support.")
#endif
#if (CXXOMFORT_CXX_STD>=2011)
#include <cstdint>
#else

#include <cxxomfort/base/cstdint.hpp>
#endif


// 
// tinyint
// (uint8_t as an actual, functional numeric type)







>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <cxxomfort/base.hpp>
#if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
#pragma message CXXO_NOTICE("enabled <cstdint> support.")
#endif
#if (CXXOMFORT_CXX_STD>=2011)
#include <cstdint>
#else
#include <inttypes.h>
#include <cxxomfort/base/cstdint.hpp>
#endif


// 
// tinyint
// (uint8_t as an actual, functional numeric type)

Added cxxomfort/cxxomfort/cxxo-utils.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
#ifndef CXXOMFORT_CXXO_UTILS_HPP
#define CXXOMFORT_CXXO_UTILS_HPP

/**
 * @file
 * @brief Small utilities central to cxxomfort, not categorized under backport headers.
 * 
 * @code
#include <cxxomfort/cxxo-utils.hpp>
 * @endcode
 * 
 * Including this header brings up the base cxxomfort 
 * utilities as well.
 * 
 * Defined here are:
 * 
 * * @c rvoid (regular @c void )
 * * @c noop_fn , noop (noop general function)
 * * @c outp (output parameter wrapper)
 * 
 * */
#include "config.hpp"
#include "base.hpp"


namespace cxxomfort {

/**
 * @brief regular @c void 
 * */
struct rvoid {
#if (CXXOMFORT_CXX_STD >= 2011)
	constexpr explicit rvoid () = default;
#else
	explicit rvoid () CXXO_NOEXCEPTNOTHROW {};
#endif
};

/**
 * @brief noop function 
 * */
struct noop_fn {
	CXXO_CONSTEXPR
	void operator() (...) const CXXO_NOEXCEPTNOTHROW {}
};


/**
 * @brief output-parameter
 * */
template <typename T>
class outp {
	public:
	typedef T value_type;
#if (CXXOMFORT_CXX_STD >= 2011)
	outp () = delete;
	~outp () = default;
#endif
	explicit outp (T& ref) CXXO_NOEXCEPTNOTHROW : t(ref) {}
	T& operator= (T const& v) { return t=v; }
	operator T& () CXXO_NOEXCEPT { return t; }
	operator T const& () const CXXO_NOEXCEPTNOTHROW { return t; }
	
	private:
	T& t;
};


} // cxxomfort 


#endif

Changes to cxxomfort/cxxomfort/functional.hpp.

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
    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 namespace 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;







|

|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
    using tr1::hash;
    using tr1::bind;
    using tr1::function;
    using tr1::bad_function_call;
    using tr1::hash;
}

	#elif (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,>=1600) )
	// MSC 2010 and ahead don't have a namespace tr1
	#elif (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,<1600) && CXXO_COMPILERREQ(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;

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

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 * @file
 * 
 * 
 * Fixes lack of bit_and, bit_or, bit_xor in MSVC 2008.
 */

// fix missing bit_and, bit_or, bit_xor in MSVC 2008
#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, < 1600))
#include CXXO_INCLUDE_SYS(functional)
    #if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 2))
    #pragma message CXXO_NOTICE("supplementing bit_and, etc in MSVC2008.")
    #endif

namespace std {








|







4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 * @file
 * 
 * 
 * Fixes lack of bit_and, bit_or, bit_xor in MSVC 2008.
 */

// fix missing bit_and, bit_or, bit_xor in MSVC 2008
#if (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC, < 1600))
#include CXXO_INCLUDE_SYS(functional)
    #if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 2))
    #pragma message CXXO_NOTICE("supplementing bit_and, etc in MSVC2008.")
    #endif

namespace std {

Changes to cxxomfort/cxxomfort/impl/07-type_traits.hpp.

11
12
13
14
15
16
17

18


19
20
21
22
23
24

25
26
27
28
29
30
31
..
45
46
47
48
49
50
51


52
53
54
55
56
57
58
 * * no TR1 has been found and the user has requested CXXO_USE_INTERNAL_TR1.
 * * when using certain cxxomfort utilities that rely on their own type traits, such as typesafe_enum
 * 
 */


#include <cxxomfort/config.hpp>

#include <cxxomfort/base/nullptr.hpp>


#include <stdint.h>

namespace cxxomfort { namespace traits {

namespace helper {


	template <bool Cond, typename T> struct enable_if;
	template <typename T> struct enable_if<true,T> { typedef T type; };

    template <bool Cond, typename T1, typename T2> struct conditional        { typedef T2 type; };
    template <typename T1, typename T2> struct conditional<true,T1,T2>    { typedef T1 type; };
    
    template <typename T> struct drop_cv { typedef T type; };
................................................................................
	template <> struct integral_of_size<sizeof(char), true> { typedef signed char type; enum { value = sizeof(char) }; };
	template <> struct integral_of_size<sizeof(int16_t), true> { typedef int16_t type; enum { value = sizeof(short) }; };
	template <> struct integral_of_size<sizeof(int32_t), true> { typedef int32_t type; enum { value = sizeof(int) }; };
	template <> struct integral_of_size<sizeof(int64_t), true> { typedef int64_t type; enum { value = sizeof(long) }; };
	

} // helper



/**
 * type_identity
 * */
template <typename T> struct type_identity { typedef T type; };

/**







>

>
>
|





>







 







>
>







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
..
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
 * * no TR1 has been found and the user has requested CXXO_USE_INTERNAL_TR1.
 * * when using certain cxxomfort utilities that rely on their own type traits, such as typesafe_enum
 * 
 */


#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
#include <cxxomfort/base/nullptr.hpp>
#include <cxxomfort/base/cstdint.hpp>
// #include <cxxomfort/base/nullptr.hpp>
//#include <stdint.h> // already handled by base/stdint.h

namespace cxxomfort { namespace traits {

namespace helper {

	
	template <bool Cond, typename T> struct enable_if;
	template <typename T> struct enable_if<true,T> { typedef T type; };

    template <bool Cond, typename T1, typename T2> struct conditional        { typedef T2 type; };
    template <typename T1, typename T2> struct conditional<true,T1,T2>    { typedef T1 type; };
    
    template <typename T> struct drop_cv { typedef T type; };
................................................................................
	template <> struct integral_of_size<sizeof(char), true> { typedef signed char type; enum { value = sizeof(char) }; };
	template <> struct integral_of_size<sizeof(int16_t), true> { typedef int16_t type; enum { value = sizeof(short) }; };
	template <> struct integral_of_size<sizeof(int32_t), true> { typedef int32_t type; enum { value = sizeof(int) }; };
	template <> struct integral_of_size<sizeof(int64_t), true> { typedef int64_t type; enum { value = sizeof(long) }; };
	

} // helper

using helper::integral_of_size;

/**
 * type_identity
 * */
template <typename T> struct type_identity { typedef T type; };

/**

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

354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
 * 
 * A cxxomfort::common_type_2 could be offered as an alternative.
 * 
 */

#if (CXXOMFORT_CXX_STD>=2011)
	using std::common_type;
#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,>=1600) && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,<1700))
	using cxxomfort::cxxostd::common_type;
#elif (CXXOMFORT_CXX_EMULATION==2011)
	using std::common_type;
#else
	using cxxomfort::cxxostd::common_type;
#endif

} } // cxxomfort::fix


// to namespace std

#if (CXXOMFORT_CXX_STD >= 2011 || CXXO_COMPILER_SUPPORT_common_type)
#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,>=1600) && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,<1700))
#else
namespace std {
		using cxxomfort::cxxostd::common_type;
}
#endif









|













|







354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
 * 
 * A cxxomfort::common_type_2 could be offered as an alternative.
 * 
 */

#if (CXXOMFORT_CXX_STD>=2011)
	using std::common_type;
#elif (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,>=1600) && CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,<1700))
	using cxxomfort::cxxostd::common_type;
#elif (CXXOMFORT_CXX_EMULATION==2011)
	using std::common_type;
#else
	using cxxomfort::cxxostd::common_type;
#endif

} } // cxxomfort::fix


// to namespace std

#if (CXXOMFORT_CXX_STD >= 2011 || CXXO_COMPILER_SUPPORT_common_type)
#elif (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,>=1600) && CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,<1700))
#else
namespace std {
		using cxxomfort::cxxostd::common_type;
}
#endif


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

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
..
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
...
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
// #include CXXO_INCLUDE_SYS(type_traits)

#if (CXXOMFORT_CXX_STD < 2011)
    #if (CXXOMFORT_CXX_EMULATION < 2011)
        #define CXXO_is_tn_xble 1
    #elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, < 408) )
        #define CXXO_is_tn_xble 1
    #endif // c++11 emulation
    #if (CXXOMFORT_CXX_EMULATION>=2011)
        #if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, < 408))
            #define CXXO_is_tn_xble 1
        #elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, < 1700))
            #define CXXO_is_tn_xble 1
        #endif
    #endif
#endif // c++11

// 
// These go under namespace std
................................................................................

}

#endif // is_tn_xble


// GCC 407, 408 misses out destructible traits in c++0x mode
#if (  CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, < 408) && CXXOMFORT_CXX_STD==2011)
namespace std {

    template <typename T>
    struct is_trivially_default_constructible
    : std::integral_constant<bool, __has_trivial_constructor(T)> {};

    template <typename T>
................................................................................
}

#endif // GCC 4.7 fix

#if (CXXOMFORT_CXX_STD<2011 && CXXOMFORT_CXX_EMULATION<2011)
    #define CXXO_is_constructible 1
#elif (CXXOMFORT_CXX_EMULATION==2011)
    #if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, < 407))
        #define CXXO_is_constructible 1
    #elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, < 1700))
        #define CXXO_is_constructible 1
    #endif
#endif

#if (defined(CXXO_is_constructible))
namespace std {
    template <typename T>
................................................................................
//
// is_copy_constructible (for c++03)
// is_copy_assignable (for c++03)
//
#if (CXXOMFORT_CXX_STD < 2011)
    #define CXXO_needs_copy_constructible
#endif
#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, >= 500) && 2011==CXXOMFORT_CXX_EMULATION)
    #undef CXXO_needs_copy_constructible
#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, >= 1700))
    #undef CXXO_needs_copy_constructible
#endif

#ifdef CXXO_needs_copy_constructible
namespace std {
    // pending: use is_convertible as an assist
    template <typename T>







|



|

|







 







|







 







|

|







 







|

|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
..
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
...
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
// #include CXXO_INCLUDE_SYS(type_traits)

#if (CXXOMFORT_CXX_STD < 2011)
    #if (CXXOMFORT_CXX_EMULATION < 2011)
        #define CXXO_is_tn_xble 1
    #elif (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC, < 408) )
        #define CXXO_is_tn_xble 1
    #endif // c++11 emulation
    #if (CXXOMFORT_CXX_EMULATION>=2011)
        #if (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC, < 408))
            #define CXXO_is_tn_xble 1
        #elif (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC, < 1700))
            #define CXXO_is_tn_xble 1
        #endif
    #endif
#endif // c++11

// 
// These go under namespace std
................................................................................

}

#endif // is_tn_xble


// GCC 407, 408 misses out destructible traits in c++0x mode
#if (  CXXO_COMPILERREQ(CXXO_COMPILERID_GCC, < 408) && CXXOMFORT_CXX_STD==2011)
namespace std {

    template <typename T>
    struct is_trivially_default_constructible
    : std::integral_constant<bool, __has_trivial_constructor(T)> {};

    template <typename T>
................................................................................
}

#endif // GCC 4.7 fix

#if (CXXOMFORT_CXX_STD<2011 && CXXOMFORT_CXX_EMULATION<2011)
    #define CXXO_is_constructible 1
#elif (CXXOMFORT_CXX_EMULATION==2011)
    #if (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC, < 407))
        #define CXXO_is_constructible 1
    #elif (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC, < 1700))
        #define CXXO_is_constructible 1
    #endif
#endif

#if (defined(CXXO_is_constructible))
namespace std {
    template <typename T>
................................................................................
//
// is_copy_constructible (for c++03)
// is_copy_assignable (for c++03)
//
#if (CXXOMFORT_CXX_STD < 2011)
    #define CXXO_needs_copy_constructible
#endif
#if (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC, >= 500) && 2011==CXXOMFORT_CXX_EMULATION)
    #undef CXXO_needs_copy_constructible
#elif (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC, >= 1700))
    #undef CXXO_needs_copy_constructible
#endif

#ifdef CXXO_needs_copy_constructible
namespace std {
    // pending: use is_convertible as an assist
    template <typename T>

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

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
> {};

} } // cxxomfort::cxxostd

#if (CXXOMFORT_CXX_STD < 2011 )
    #if (CXXOMFORT_CXX_EMULATION < 2011)
        #define CXXO_needs_move_xxxible_traits
    #elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, < 408))
        #define CXXO_needs_move_xxxible_traits
    #elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, < 1700))
        #define CXXO_needs_move_xxxible_traits
    #endif
#endif


#ifdef CXXO_needs_move_xxxible_traits
namespace std {
................................................................................
    using ::cxxomfort::cxxostd::is_trivially_move_constructible;
    using ::cxxomfort::cxxostd::is_nothrow_move_constructible;
    using ::cxxomfort::cxxostd::is_move_constructible;
}
#endif

// GCC 4.7~4.8 announce C++11 mode, but they still lack trivially_move_constructible for some reason
#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, >= 407)) \
    && (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, < 409)) \
    && (CXXOMFORT_CXX_STD == 2011)
namespace std {
    using ::cxxomfort::cxxostd::is_trivially_move_constructible;
}

#endif


#endif









|

|







 







|
|











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
> {};

} } // cxxomfort::cxxostd

#if (CXXOMFORT_CXX_STD < 2011 )
    #if (CXXOMFORT_CXX_EMULATION < 2011)
        #define CXXO_needs_move_xxxible_traits
    #elif (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC, < 408))
        #define CXXO_needs_move_xxxible_traits
    #elif (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC, < 1700))
        #define CXXO_needs_move_xxxible_traits
    #endif
#endif


#ifdef CXXO_needs_move_xxxible_traits
namespace std {
................................................................................
    using ::cxxomfort::cxxostd::is_trivially_move_constructible;
    using ::cxxomfort::cxxostd::is_nothrow_move_constructible;
    using ::cxxomfort::cxxostd::is_move_constructible;
}
#endif

// GCC 4.7~4.8 announce C++11 mode, but they still lack trivially_move_constructible for some reason
#if (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC, >= 407)) \
    && (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC, < 409)) \
    && (CXXOMFORT_CXX_STD == 2011)
namespace std {
    using ::cxxomfort::cxxostd::is_trivially_move_constructible;
}

#endif


#endif


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

4
5
6
7
8
9
10




11
12
13
14
15
16
17
..
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
...
359
360
361
362
363
364
365

366
 * @file
 * @brief Implementation for std::to_string and allies 
 * @xrefitem std0string "<string>"
 *
 */

#include <cxxomfort/base.hpp>




#include <cxxomfort/cstdint.hpp>
#include <cxxomfort/impl/07-type_traits.hpp> // is_arithmetic w/o C++11 dependency
#include <string>
#include <cstdio>
#include <cstdlib>
#include <stdlib.h> // for MSVC?
#include <stdexcept>
................................................................................
#define CXXO_INTEGERDIGITS(T) std::numeric_limits< T >::digits10 + 3
#define CXXO_FLOATDIGITS(T) std::numeric_limits< T >::digits10 + 8

//
// MSVC <= 2010 is missing strtoll, strtoull definitions, but has the 
// functions proper under other names
//
#if ( (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, >= 130) && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,  <= 160) ) )
//namespace std {
    static inline unsigned long long strtoull (const char* np, char ** ep, int b=10) {
        return _strtoui64(np,ep,b);
    }
    static inline signed long long strtoll (const char* np, char ** ep, int b=10) {
        return _strtoi64(np,ep,b);
    }
................................................................................
    using ::cxxomfort::cxxostd::stoul;
    using ::cxxomfort::cxxostd::stol;
    using ::cxxomfort::cxxostd::stoull;
    using ::cxxomfort::cxxostd::stoll;
}
#endif // (c++11)


#endif







>
>
>
>







 







|







 







>

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
...
363
364
365
366
367
368
369
370
371
 * @file
 * @brief Implementation for std::to_string and allies 
 * @xrefitem std0string "<string>"
 *
 */

#include <cxxomfort/base.hpp>
#if (CXXOMFORT_CXX_STD<1997)
	#include "11-to_string.pre97.hpp"
#else

#include <cxxomfort/cstdint.hpp>
#include <cxxomfort/impl/07-type_traits.hpp> // is_arithmetic w/o C++11 dependency
#include <string>
#include <cstdio>
#include <cstdlib>
#include <stdlib.h> // for MSVC?
#include <stdexcept>
................................................................................
#define CXXO_INTEGERDIGITS(T) std::numeric_limits< T >::digits10 + 3
#define CXXO_FLOATDIGITS(T) std::numeric_limits< T >::digits10 + 8

//
// MSVC <= 2010 is missing strtoll, strtoull definitions, but has the 
// functions proper under other names
//
#if ( (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC, >= 130) && CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,  <= 160) ) )
//namespace std {
    static inline unsigned long long strtoull (const char* np, char ** ep, int b=10) {
        return _strtoui64(np,ep,b);
    }
    static inline signed long long strtoll (const char* np, char ** ep, int b=10) {
        return _strtoi64(np,ep,b);
    }
................................................................................
    using ::cxxomfort::cxxostd::stoul;
    using ::cxxomfort::cxxostd::stol;
    using ::cxxomfort::cxxostd::stoull;
    using ::cxxomfort::cxxostd::stoll;
}
#endif // (c++11)

#endif // include
#endif

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

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
    #endif

namespace std {
    

    template< typename TpEnum >
    struct underlying_type {
        typedef typename ::cxxomfort::traits::integral_of_size<sizeof(TpEnum)>::type tsize_t;
        private:
        typedef typename make_signed< tsize_t >::type S;
        typedef typename make_unsigned< tsize_t >::type U;
        public:
        typedef typename std::conditional<
            (TpEnum( -1 ) < TpEnum( 0 )), S, U
            >::type type;







|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
    #endif

namespace std {
    

    template< typename TpEnum >
    struct underlying_type {
        typedef typename cxxomfort::traits::integral_of_size<sizeof(TpEnum)>::type tsize_t;
        private:
        typedef typename make_signed< tsize_t >::type S;
        typedef typename make_unsigned< tsize_t >::type U;
        public:
        typedef typename std::conditional<
            (TpEnum( -1 ) < TpEnum( 0 )), S, U
            >::type type;

Changes to cxxomfort/cxxomfort/impl/14-algorithm-equal.hpp.

2
3
4
5
6
7
8

9
10
11
12
13
14
15
..
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#define CXXOMFORT_IMPL_ALGORITHM_14EQUAL_HPP
/**
 * @file
 * @brief Implementation of C++14's overloads for @c equal(), @c mismatch() .
 * */
#include <cxxomfort/base.hpp>
#include "../algorithm.hpp"

#include "./11-conditional.hpp"
//#include <cxxomfort/type_traits.hpp>
// <algorithm> should have been included already

#define CXXOMFORT_IMPLEMENTS_n3671 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_two_ranges_equal_mismatch CXXOMFORT_IMPLEMENTS_n3671

................................................................................
//
namespace detail_algorithm {
template <typename T1, typename T2> struct heterogenous_equal_to {
    bool operator() (T1 const& t1, T2 const& t2) const { return t1 == t2; }
};

template <typename RangeIt1, typename RangeIt2, typename Compare> inline 
bool equal_impl (RangeIt1 ini1, RangeIt1 fin1, RangeIt2 ini2, RangeIt2 fin2, Compare c, traits::false_type /*iterator_tags are non-random-access*/) {
    for (; ini1 != fin1 && ini2 != fin2 ; ++ini1, ++ini2) {
        if (!c(*ini1, *ini2)) return false;
    }
    if ( (ini1 != fin1)|| (ini2 != fin2) ) return false;
    return true;
}








>







 







|







2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
..
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#define CXXOMFORT_IMPL_ALGORITHM_14EQUAL_HPP
/**
 * @file
 * @brief Implementation of C++14's overloads for @c equal(), @c mismatch() .
 * */
#include <cxxomfort/base.hpp>
#include "../algorithm.hpp"
#include "./07-type_traits.hpp"
#include "./11-conditional.hpp"
//#include <cxxomfort/type_traits.hpp>
// <algorithm> should have been included already

#define CXXOMFORT_IMPLEMENTS_n3671 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_two_ranges_equal_mismatch CXXOMFORT_IMPLEMENTS_n3671

................................................................................
//
namespace detail_algorithm {
template <typename T1, typename T2> struct heterogenous_equal_to {
    bool operator() (T1 const& t1, T2 const& t2) const { return t1 == t2; }
};

template <typename RangeIt1, typename RangeIt2, typename Compare> inline 
bool equal_impl (RangeIt1 ini1, RangeIt1 fin1, RangeIt2 ini2, RangeIt2 fin2, Compare c, cxxomfort::traits::false_type /*iterator_tags are non-random-access*/) {
    for (; ini1 != fin1 && ini2 != fin2 ; ++ini1, ++ini2) {
        if (!c(*ini1, *ini2)) return false;
    }
    if ( (ini1 != fin1)|| (ini2 != fin2) ) return false;
    return true;
}

Changes to cxxomfort/cxxomfort/impl/14-tuple_get_type.hpp.

118
119
120
121
122
123
124

125


126
127
128
129
130
131
132
    return get<N>(t);
}

} // std

#endif


#define CXXOMFORT_IMPLEMENTS_tuple_get_type CXXOMFORT_IMPLEMENTS_n3584



// Implement interface for std::pair

/*
namespace std {

template <typename C, typename T2>







>
|
>
>







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
    return get<N>(t);
}

} // std

#endif

#if !defined(CXXOMFORT_IMPLEMENTS_tuple_get_type)
	#define CXXOMFORT_IMPLEMENTS_tuple_get_type CXXOMFORT_IMPLEMENTS_n3584
#endif


// Implement interface for std::pair

/*
namespace std {

template <typename C, typename T2>

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

12
13
14
15
16
17
18

19

20
21
22
23
24
25
26
#include <cxxomfort/impl/n3334-array_ref.hpp>
#include <cxxomfort/impl/07-type_traits.hpp>
#include <cxxomfort/impl/relationals.hpp>

#define CXXOMFORT_IMPLEMENTS_n3605 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_n3685 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_n3762 CXXO_IMPLSTATUS_BACKPORT()

#define CXXOMFORT_IMPLEMENTS_string_view CXXOMFORT_IMPLEMENTS_n3685



namespace cxxomfort { namespace cxxostd {

/**
 * @brief Read-only view of a string or string-like object
 * 







>
|
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <cxxomfort/impl/n3334-array_ref.hpp>
#include <cxxomfort/impl/07-type_traits.hpp>
#include <cxxomfort/impl/relationals.hpp>

#define CXXOMFORT_IMPLEMENTS_n3605 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_n3685 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_n3762 CXXO_IMPLSTATUS_BACKPORT()
#if !defined(CXXOMFORT_IMPLEMENTS_string_view)
	#define CXXOMFORT_IMPLEMENTS_string_view CXXOMFORT_IMPLEMENTS_n3685
#endif


namespace cxxomfort { namespace cxxostd {

/**
 * @brief Read-only view of a string or string-like object
 * 

Changes to cxxomfort/cxxomfort/impl/errc-posix.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

address_family_not_supported =EAFNOSUPPORT,


address_in_use =EADDRINUSE,


address_not_available =EADDRNOTAVAIL,


already_connected =EISCONN,

argument_list_too_long =E2BIG,
argument_out_of_domain =EDOM,
bad_address =EFAULT,
bad_file_descriptor =EBADF,

bad_message =EBADMSG,

broken_pipe =EPIPE,

connection_aborted =ECONNABORTED,


connection_already_in_progress =EALREADY,


connection_refused =ECONNREFUSED,


connection_reset =ECONNRESET,

cross_device_link =EXDEV,

destination_address_required =EDESTADDRREQ,

device_or_resource_busy =EBUSY,
directory_not_empty =ENOTEMPTY,
executable_format_error =ENOEXEC,
file_exists =EEXIST,
file_too_large =EFBIG,
filename_too_long =ENAMETOOLONG,
function_not_supported =ENOSYS,

host_unreachable =EHOSTUNREACH,


identifier_removed =EIDRM,

illegal_byte_sequence =EILSEQ,
inappropriate_io_control_operation =ENOTTY,
interrupted =EINTR,
invalid_argument =EINVAL,

invalid_seek =ESPIPE,

io_error =EIO,
is_a_directory =EISDIR,

message_size =EMSGSIZE,


network_down =ENETDOWN,


network_reset =ENETRESET,


network_unreachable =ENETUNREACH,


no_buffer_space =ENOBUFS,

no_child_process =ECHILD,

no_link =ENOLINK,


no_lock_available =ENOLCK,


no_message_available =ENODATA,


no_message =ENOMSG,


no_protocol_option =ENOPROTOOPT,

no_space_on_device =ENOSPC,

no_stream_resources =ENOSR,

no_such_device_or_address =ENXIO,
no_such_device =ENODEV,
no_such_file_or_directory =ENOENT,
no_such_process =ESRCH,

not_a_directory =ENOTDIR,


not_a_socket =ENOTSOCK,


not_a_stream =ENOSTR,


not_connected =ENOTCONN,


not_enough_memory =ENOMEM,


not_supported =ENOTSUP,


operation_canceled =ECANCELED,


operation_in_progress =EINPROGRESS,

operation_not_permitted =EPERM,

operation_not_supported =EOPNOTSUPP,


operation_would_block =EWOULDBLOCK,


owner_dead =EOWNERDEAD,

permission_denied =EACCES,

protocol_error =EPROTO,


protocol_not_supported =EPROTONOSUPPORT,

read_only_file_system =EROFS,
resource_deadlock_would_occur =EDEADLK,
resource_unavailable_try_again =EAGAIN,
result_out_of_range =ERANGE,

state_not_recoverable =ENOTRECOVERABLE,


stream_timeout =ETIME,


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 ,


>

>
>

>
>

>
>

>




>

>

>

>
>

>
>

>
>

>

>

>







>

>
>

>




>

>


>

>
>

>
>

>
>

>
>

>

>

>
>

>
>

>
>

>
>

>

>

>




>

>
>

>
>

>
>

>
>

>
>

>
>

>
>

>

>

>
>

>
>

>

>

>
>

>




>

>
>

>
>

>
>

>



>

>
>

>
>

>

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
158
159
160
161
162
163
164
165
166
167
#ifdef EAFNOSUPPORT
address_family_not_supported =EAFNOSUPPORT,
#endif
#ifdef EADDRINUSE
address_in_use =EADDRINUSE,
#endif
#ifdef EADDRNOTAVAIL
address_not_available =EADDRNOTAVAIL,
#endif
#ifdef EISCONN
already_connected =EISCONN,
#endif
argument_list_too_long =E2BIG,
argument_out_of_domain =EDOM,
bad_address =EFAULT,
bad_file_descriptor =EBADF,
#ifdef EBADMSG
bad_message =EBADMSG,
#endif
broken_pipe =EPIPE,
#ifdef ECONNABORTED
connection_aborted =ECONNABORTED,
#endif
#ifdef EALREADY
connection_already_in_progress =EALREADY,
#endif
#ifdef ECONNREFUSED
connection_refused =ECONNREFUSED,
#endif
#ifdef ECONNRESET
connection_reset =ECONNRESET,
#endif
cross_device_link =EXDEV,
#ifdef EDESTADDRREQ
destination_address_required =EDESTADDRREQ,
#endif
device_or_resource_busy =EBUSY,
directory_not_empty =ENOTEMPTY,
executable_format_error =ENOEXEC,
file_exists =EEXIST,
file_too_large =EFBIG,
filename_too_long =ENAMETOOLONG,
function_not_supported =ENOSYS,
#ifdef EHOSTUNREACH
host_unreachable =EHOSTUNREACH,
#endif
#ifdef EIDRM
identifier_removed =EIDRM,
#endif
illegal_byte_sequence =EILSEQ,
inappropriate_io_control_operation =ENOTTY,
interrupted =EINTR,
invalid_argument =EINVAL,
#ifdef ESPIPE
invalid_seek =ESPIPE,
#endif
io_error =EIO,
is_a_directory =EISDIR,
#ifdef EMSGSIZE
message_size =EMSGSIZE,
#endif
#ifdef ENETDOWN
network_down =ENETDOWN,
#endif
#ifdef ENETRESET
network_reset =ENETRESET,
#endif
#ifdef ENETUNREACH
network_unreachable =ENETUNREACH,
#endif
#ifdef ENOBUFS
no_buffer_space =ENOBUFS,
#endif
no_child_process =ECHILD,
#ifdef ENOLINK
no_link =ENOLINK,
#endif
#ifdef ENOLCK
no_lock_available =ENOLCK,
#endif
#ifdef ENODATA
no_message_available =ENODATA,
#endif
#ifdef ENOMSG
no_message =ENOMSG,
#endif
#ifdef ENOPROTOOPT
no_protocol_option =ENOPROTOOPT,
#endif
no_space_on_device =ENOSPC,
#ifdef ENOSR
no_stream_resources =ENOSR,
#endif
no_such_device_or_address =ENXIO,
no_such_device =ENODEV,
no_such_file_or_directory =ENOENT,
no_such_process =ESRCH,
#ifdef ENOTDIR
not_a_directory =ENOTDIR,
#endif
#ifdef ENOTSOCK
not_a_socket =ENOTSOCK,
#endif
#ifdef ENOSTR
not_a_stream =ENOSTR,
#endif
#ifdef ENOTCONN
not_connected =ENOTCONN,
#endif
#ifdef ENOMEM
not_enough_memory =ENOMEM,
#endif
#ifdef ENOTSUP
not_supported =ENOTSUP,
#endif
#ifdef ECANCELED
operation_canceled =ECANCELED,
#endif
#ifdef EINPROGRESS
operation_in_progress =EINPROGRESS,
#endif
operation_not_permitted =EPERM,
#ifdef EOPNOTSUPP
operation_not_supported =EOPNOTSUPP,
#endif
#ifdef EWOULDBLOCK
operation_would_block =EWOULDBLOCK,
#endif
#ifdef EOWNERDEAD
owner_dead =EOWNERDEAD,
#endif
permission_denied =EACCES,
#ifdef EPROTO
protocol_error =EPROTO,
#endif
#ifdef EPROTONOSUPPORT
protocol_not_supported =EPROTONOSUPPORT,
#endif
read_only_file_system =EROFS,
resource_deadlock_would_occur =EDEADLK,
resource_unavailable_try_again =EAGAIN,
result_out_of_range =ERANGE,
#ifdef ENOTRECOVERABLE
state_not_recoverable =ENOTRECOVERABLE,
#endif
#ifdef ETIME
stream_timeout =ETIME,
#endif
#ifdef ETXTBSY
text_file_busy =ETXTBSY,
#endif
#ifdef ETIMEDOUT
timed_out =ETIMEDOUT,
#endif
too_many_files_open_in_system =ENFILE,
too_many_files_open =EMFILE,
too_many_links =EMLINK,
#ifdef ELOOP
too_many_symbolic_link_levels =ELOOP,
#endif
#ifdef EOVERFLOW
value_too_large =EOVERFLOW,
#endif
#ifdef EPROTOTYPE
wrong_protocol_type =EPROTOTYPE ,
#endif

Changes to 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



>

>
>
>
|

|

|
|
|

|

|
|
|
|
|
|
|
|

|


|
|
|
|
|

|
|

|
|
|
|
|


|

>
>
>

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
#ifndef CXXOMFORT_IMPL_ERRC_HPP
#define CXXOMFORT_IMPL_ERRC_HPP

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

#if (1 || CXXOMFORT_CXX_STD>=1997)

	#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)
		#include "../impl/errc-win.hpp"
	#else
		#include "../impl/errc-posix.hpp" // #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

#else
#endif // CXX_STD

#endif

Changes to cxxomfort/cxxomfort/impl/errno-msvc.hpp.

1
2
3
4
5
6
7
8
9
10
#include <errno.h>

#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, <= 1600)) 
    // mostly copied from the ones in VC2010's errno.h

#define EADDRINUSE      100
#define EADDRNOTAVAIL   101
#define EAFNOSUPPORT    102
#define EALREADY        103
#define EBADMSG         104


|







1
2
3
4
5
6
7
8
9
10
#include <errno.h>

#if (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC, <= 1600)) 
    // mostly copied from the ones in VC2010's errno.h

#define EADDRINUSE      100
#define EADDRNOTAVAIL   101
#define EAFNOSUPPORT    102
#define EALREADY        103
#define EBADMSG         104

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

12
13
14
15
16
17
18

19

20
21
22
23
24
25
26
..
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
..
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
...
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
...
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
...
257
258
259
260
261
262
263
264
265
266
267
268






269
270









271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
...
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413


414
415
416
417
418
419
420
#include <cxxomfort/cerrno.hpp>
#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


namespace cxxomfort {
................................................................................
 * 
 * 
 * See also: <tt>std::array</tt>, <tt>std::vector</tt>, @c seq_ .
 * 
 * Differences from the original proposal:
 * 
 * * Allows for a @c array_ref of non-const objects.

 * * Adds ( @c pointer , @c pointer ) constructor.
 * * Discards @c vector constructor for lower dependency overhead.
 * * Adds member functions @c front , @c back .
 * * Adds member functions @c leftmost , @c rightmost .
 * * Ally functions @c arrayref() and @c carrayref() provided as support.
 * 
 * 
................................................................................
 * 
 * @c array_ref is based in the original publication "n3334" by 
 * Jeffrey Yasskin
 * 
 * @see @wg21{n3334} @cppref{container/span}
 * 
 */
template <typename T>
class array_ref {
    public:
    //! Type of the data contained in the view.
    typedef T       value_type;





#if (CXXOMFORT_CXX_STD>=1997)    
    //! Type of a pointer to a contained value; potentially writable.
    typedef typename ct::compose<T,::std::add_pointer>::type   pointer;
    //! Type of a pointer to a contained value; view-only.
    typedef typename ct::compose<T,::std::add_const, ::std::add_pointer>::type const_pointer;
    typedef typename ct::compose<T,std::add_lvalue_reference>::type   reference;
................................................................................
	public:
	typedef typename std::add_pointer<T>::type pointer;
	typedef typename std::add_pointer<const_type>::type const_pointer;
	typedef T&  reference;
	typedef const_type&  const_reference;
#endif

    //! Type for the distance between pointers or iterators.
    typedef ptrdiff_t    difference_type;
    //! Type for subscript / indexed access (eg.: <code>operator[]</code>).
    typedef size_t       size_type;
    //! Iterator type; potentially writable.
    typedef pointer           iterator;
    //! Iterator type; view-only.
    typedef const_pointer const_iterator;
    //! Reverse iterator type; potentially writable.
    typedef std::reverse_iterator<iterator> reverse_iterator;
    //! Reverse iterator type; view-only.
................................................................................
    
    // 
    // special constructors 
    // 
    
    //! This object refers to a buffer of memory pointed by @a p and of size @a len .
    CXXO_CONSTEXPR 
    array_ref (pointer p, size_t len) CXXO_NOEXCEPTNOTHROW 
    : ptr_(p), len_(len) {}

	//! This object refers to a buffer of memory constrained by two pointers 
	// (not in original n3334)
    CXXO_CONSTEXPR 
    array_ref (std::nullptr_t, const_pointer p, const_pointer q) CXXO_NOEXCEPTNOTHROW 
    : ptr_(p), len_(static_cast<size_t>(q-p)) {}

    //! This object refers to a native C-array.
    template <size_t N>
    CXXO_CONSTEXPR 
    explicit array_ref (T(&arr)[N]) CXXO_NOEXCEPTNOTHROW 
    : ptr_(arr), len_(N) {}
    
................................................................................
#if (CXXOMFORT_CXX_STD >= 2011)
    template <bool B = std::is_const<T>::value, typename std::enable_if<B,int>::type=0 >
    array_ref (array_ref< typename std::remove_const<T>::type > const& av)
    : ptr_(av.ptr_), len_(av.len_) {}
#endif

    //! This object refers to a @c std::array . 
    template <size_t N>
    CXXO_CONSTEXPR 
    array_ref (std::array<T,N> const& arr) CXXO_NOEXCEPTNOTHROW
    : ptr_(arr.data()), len_(arr.size()) {}


    //! Unchecked access to the @a i -th element.
    CXXO_CONSTEXPR14
    reference       operator[] (size_t i) CXXO_NOEXCEPTNOTHROW { return ptr_[i]; }
    //! Unchecked access to the @a i -th element.
    CXXO_CONSTEXPR14 
    const_reference operator[] (size_t i) const CXXO_NOEXCEPTNOTHROW { return ptr_[i]; }

    //! Checked access to the @a i -th element; throw.
    reference       at (size_t i) { check_range(i); return ptr_[i]; }
    //! Checked access to the @a i -th element; throw.
    const_reference at (size_t i) const { check_range(i); return ptr_[i]; }

    //! Checked access to the @a i -th element; nonthrow.
	reference       at_or (size_t i, reference rx) { return i < size() ? ptr_[i] : rx; }
    //! Checked access to the @a i -th element; nonthrow.
	const_reference at_or (size_t i, const_reference rx) const { return i < size() ? ptr_[i] : rx; }

#if (CXXOMFORT_CXX_STD>=2011)
    //! Checked access to i-th element; sets up an @c error_code if the index is out of range.
    const_reference at (size_t i, std::error_code& ec) const { check_range(i,ec); return ptr_[i]; }
#endif
    
    // view info
    
    CXXO_CONSTEXPR  size_t     max_size () const CXXO_NOEXCEPTNOTHROW { return len_; }
    //! @return size of the view as a @c size_t .
    CXXO_CONSTEXPR  size_t     size () const CXXO_NOEXCEPTNOTHROW { return len_; }
    //! @return @c bool .
    CXXO_CONSTEXPR  bool       empty () const CXXO_NOEXCEPTNOTHROW { return size() == 0; }
    //! @return pointer to the view's data.
    CXXO_CONSTEXPR14
    pointer         data () CXXO_NOEXCEPTNOTHROW { return ptr_; }
    //! @return pointer to the view's data.
    CXXO_CONSTEXPR 
    const_pointer   data () const CXXO_NOEXCEPTNOTHROW { return ptr_; }
    //! @return size of the view in bytes.
    CXXO_CONSTEXPR  size_t  	size_bytes () const CXXO_NOEXCEPTNOTHROW { return len_*sizeof(T); }
    
    // iterators

    //! begin
    CXXO_CONSTEXPR
    const_iterator  cbegin () const CXXO_NOEXCEPTNOTHROW { return ptr_; }
    //! end
................................................................................
    //! Returns a view to the rightmost (last) @a n elements.
    array_ref       rightmost (size_type n) const CXXO_NOEXCEPTNOTHROW;
    //! Returns a view of sub-contents from position @a pos which can be negative, ala PHP, JS.
    array_ref       slice (difference_type pos, size_type count) const;
    //! @overload slice 
    array_ref       slice (difference_type pos) const;
    
#if (CXXOMFORT_CXX_STD>=2011)
    template <typename U>
    U          copy_to () const {
        return U(data(), size());
    }






#endif    










    //! Returns a view with the last element removed.
    array_ref  without_back () const;
    //! Returns a view with the first element removed.
    array_ref  without_front () const;
    //! Removes the last @a n elements.
    array_ref  without_back_n (size_type n) const;
    //! Removes the first @a n elements.
    array_ref  without_front_n (size_type n) const;

    private:
    CXXO_CONSTEXPR14 void check_range (size_t i) const {
        if (i>=len_) throw std::out_of_range("array_ref: out of range");
    }
#if (CXXOMFORT_CXX_STD>=1997)
    void check_range (size_t i, std::error_code& ec) const {
        if (i>=len_) ec= std::make_error_code(cxxomfort::fix::errc::invalid_argument /*, std::generic_category() */);
        
    }
#endif

    pointer    ptr_ CXXOMFORT_CXX11_CODE(= 0, ;);
    size_t     len_ CXXOMFORT_CXX11_CODE(= 0, ;);


}; // array_ref


//! Compare <tt>array_ref</tt>s for equality.
template <typename T>
................................................................................
template <typename T, typename U>
array_ref<T const> carrayref (array_ref<U const> const& a) {
	static_assert (sizeof(T)==sizeof(U) , "incompatible sizeof");
	return array_ref<T const>(reinterpret_cast<T const*>(a.data()), a.size());
}


template <typename T>
array_ref<T> array_ref<T>::without_back_n (size_type n) const {
    size_type newlen= (len_>n) ? len_-n : len_;
    return array_ref(ptr_, newlen);
}


template <typename T>
array_ref<T> array_ref<T>::without_back () const {
    return without_back_n(1);
}

template <typename T>
array_ref<T> array_ref<T>::without_front_n (size_type n) const {
    pointer const newbegin = (len_>n) ? ptr_+n : ptr_;
    size_type const newlen= (len_>n) ? len_-n : len_;
    return array_ref(newbegin,newlen);
}

template <typename T>
array_ref<T> array_ref<T>::without_front () const {
    return without_front_n(1);
}

template <typename T>
array_ref<T> array_ref<T>::leftmost (size_type n) const CXXO_NOEXCEPTNOTHROW {
    return (n >= len_) ? *this : array_ref(ptr_,n);
}

template <typename T>
array_ref<T> array_ref<T>::rightmost (size_type n) const CXXO_NOEXCEPTNOTHROW {
    return (n >= len_) ? *this : array_ref(ptr_+len_-n,n);
}

// Returns a view of the substring [pos, pos + rcount), 
// where rcount is the smaller of count and size() - pos
template <typename T>
array_ref<T> array_ref<T>::substr (size_type pos, size_type count) const {
    return (!empty() && (pos < len_) && (count < len_)) 
    ? array_ref(ptr_+pos, std::min(count, len_-pos))
    : array_ref(nullptr,0)
    ;
}


// 
// is_array_ref
// 

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

/**
 * @brief Type trait that identifies types of @c array_ref .
 * */


template <typename T> struct is_array_ref< array_ref<T> >
: std::true_type {};

} } } // cxxomfort::impl::array_ref










>
|
>







 







>







 







|




>
>
>
>







 







<
<
<
<







 







|






|







 







|







|


|


|

|


|

|



|




|

|









|







 







|




>
>
>
>
>
>


>
>
>
>
>
>
>
>
>




<
<
<
<


|



|






|







 







|
<
<
<
<
<
<
<
|



|
|


|


|
|



|
|



|
|





|
|











<
<
<



>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
..
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
..
98
99
100
101
102
103
104




105
106
107
108
109
110
111
...
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
...
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
...
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292




293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
...
366
367
368
369
370
371
372
373







374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414



415
416
417
418
419
420
421
422
423
424
425
426
#include <cxxomfort/cerrno.hpp>
#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()
#if !defined(CXXOMFORT_IMPLEMENTS_array_ref)
	#define CXXOMFORT_IMPLEMENTS_array_ref CXXOMFORT_IMPLEMENTS_n3334
#endif

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


namespace cxxomfort {
................................................................................
 * 
 * 
 * See also: <tt>std::array</tt>, <tt>std::vector</tt>, @c seq_ .
 * 
 * Differences from the original proposal:
 * 
 * * Allows for a @c array_ref of non-const objects.
 * * Allows for an index type shorter than @c size_t (for eg.: short alloc buffers).
 * * Adds ( @c pointer , @c pointer ) constructor.
 * * Discards @c vector constructor for lower dependency overhead.
 * * Adds member functions @c front , @c back .
 * * Adds member functions @c leftmost , @c rightmost .
 * * Ally functions @c arrayref() and @c carrayref() provided as support.
 * 
 * 
................................................................................
 * 
 * @c array_ref is based in the original publication "n3334" by 
 * Jeffrey Yasskin
 * 
 * @see @wg21{n3334} @cppref{container/span}
 * 
 */
template <typename T, typename IdxType = size_t>
class array_ref {
    public:
    //! Type of the data contained in the view.
    typedef T       value_type;
    //! Type for the distance between pointers or iterators.
    typedef ptrdiff_t    difference_type;
    //! Type for subscript / indexed access (eg.: <code>operator[]</code>).
    typedef IdxType      size_type;

#if (CXXOMFORT_CXX_STD>=1997)    
    //! Type of a pointer to a contained value; potentially writable.
    typedef typename ct::compose<T,::std::add_pointer>::type   pointer;
    //! Type of a pointer to a contained value; view-only.
    typedef typename ct::compose<T,::std::add_const, ::std::add_pointer>::type const_pointer;
    typedef typename ct::compose<T,std::add_lvalue_reference>::type   reference;
................................................................................
	public:
	typedef typename std::add_pointer<T>::type pointer;
	typedef typename std::add_pointer<const_type>::type const_pointer;
	typedef T&  reference;
	typedef const_type&  const_reference;
#endif





    //! Iterator type; potentially writable.
    typedef pointer           iterator;
    //! Iterator type; view-only.
    typedef const_pointer const_iterator;
    //! Reverse iterator type; potentially writable.
    typedef std::reverse_iterator<iterator> reverse_iterator;
    //! Reverse iterator type; view-only.
................................................................................
    
    // 
    // special constructors 
    // 
    
    //! This object refers to a buffer of memory pointed by @a p and of size @a len .
    CXXO_CONSTEXPR 
    array_ref (pointer p, size_type len) CXXO_NOEXCEPTNOTHROW 
    : ptr_(p), len_(len) {}

	//! This object refers to a buffer of memory constrained by two pointers 
	// (not in original n3334)
    CXXO_CONSTEXPR 
    array_ref (std::nullptr_t, const_pointer p, const_pointer q) CXXO_NOEXCEPTNOTHROW 
    : ptr_(p), len_(static_cast<size_type>(q-p)) {}

    //! This object refers to a native C-array.
    template <size_t N>
    CXXO_CONSTEXPR 
    explicit array_ref (T(&arr)[N]) CXXO_NOEXCEPTNOTHROW 
    : ptr_(arr), len_(N) {}
    
................................................................................
#if (CXXOMFORT_CXX_STD >= 2011)
    template <bool B = std::is_const<T>::value, typename std::enable_if<B,int>::type=0 >
    array_ref (array_ref< typename std::remove_const<T>::type > const& av)
    : ptr_(av.ptr_), len_(av.len_) {}
#endif

    //! This object refers to a @c std::array . 
    template <size_type N>
    CXXO_CONSTEXPR 
    array_ref (std::array<T,N> const& arr) CXXO_NOEXCEPTNOTHROW
    : ptr_(arr.data()), len_(arr.size()) {}


    //! Unchecked access to the @a i -th element.
    CXXO_CONSTEXPR14
    reference       operator[] (size_type i) CXXO_NOEXCEPTNOTHROW { return ptr_[i]; }
    //! Unchecked access to the @a i -th element.
    CXXO_CONSTEXPR14 
    const_reference operator[] (size_type i) const CXXO_NOEXCEPTNOTHROW { return ptr_[i]; }

    //! Checked access to the @a i -th element; throw.
    reference       at (size_type i) { check_range(i); return ptr_[i]; }
    //! Checked access to the @a i -th element; throw.
    const_reference at (size_type i) const { check_range(i); return ptr_[i]; }

    //! Checked access to the @a i -th element; nonthrow.
	reference       at_or (size_type i, reference rx) { return i < size() ? ptr_[i] : rx; }
    //! Checked access to the @a i -th element; nonthrow.
	const_reference at_or (size_type i, const_reference rx) const { return i < size() ? ptr_[i] : rx; }

#if (CXXOMFORT_CXX_STD>=2011)
    //! Checked access to i-th element; sets up an @c error_code if the index is out of range.
    const_reference at (size_type i, std::error_code& ec) const { check_range(i,ec); return ptr_[i]; }
#endif
    
    // view info
    
    CXXO_CONSTEXPR  size_type     max_size () const CXXO_NOEXCEPTNOTHROW { return len_; }
    //! @return size of the view as a @c size_t .
    CXXO_CONSTEXPR  size_type     size () const CXXO_NOEXCEPTNOTHROW { return len_; }
    //! @return @c bool .
    CXXO_CONSTEXPR  bool       empty () const CXXO_NOEXCEPTNOTHROW { return size() == 0; }
    //! @return pointer to the view's data.
    CXXO_CONSTEXPR14
    pointer         data () CXXO_NOEXCEPTNOTHROW { return ptr_; }
    //! @return pointer to the view's data.
    CXXO_CONSTEXPR 
    const_pointer   data () const CXXO_NOEXCEPTNOTHROW { return ptr_; }
    //! @return size of the view in bytes.
    CXXO_CONSTEXPR  size_type  	size_bytes () const CXXO_NOEXCEPTNOTHROW { return len_*sizeof(T); }
    
    // iterators

    //! begin
    CXXO_CONSTEXPR
    const_iterator  cbegin () const CXXO_NOEXCEPTNOTHROW { return ptr_; }
    //! end
................................................................................
    //! Returns a view to the rightmost (last) @a n elements.
    array_ref       rightmost (size_type n) const CXXO_NOEXCEPTNOTHROW;
    //! Returns a view of sub-contents from position @a pos which can be negative, ala PHP, JS.
    array_ref       slice (difference_type pos, size_type count) const;
    //! @overload slice 
    array_ref       slice (difference_type pos) const;
    
#if (CXXOMFORT_CXX_STD>=1997)
    template <typename U>
    U          copy_to () const {
        return U(data(), size());
    }
    
    template <typename DestIter>
    DestIter  copy_to (DestIter to) const {
		using namespace std;
		return copy_n(begin(), size(), to);
	}
#endif    

    //! Removes the last @a n elements.
    array_ref  without_back_n (size_type n) const {
		size_type newlen= (len_>n) ? len_-n : len_;
		return array_ref<T>(ptr_, newlen);
	}

    //! Removes the first @a n elements.
    array_ref  without_front_n (size_type n) const;

    //! Returns a view with the last element removed.
    array_ref  without_back () const;
    //! Returns a view with the first element removed.
    array_ref  without_front () const;





    private:
    CXXO_CONSTEXPR14 void check_range (size_type i) const {
        if (i>=len_) throw std::out_of_range("array_ref: out of range");
    }
#if (CXXOMFORT_CXX_STD>=1997)
    void check_range (size_type i, std::error_code& ec) const {
        if (i>=len_) ec= std::make_error_code(cxxomfort::fix::errc::invalid_argument /*, std::generic_category() */);
        
    }
#endif

    pointer    ptr_ CXXOMFORT_CXX11_CODE(= 0, ;);
    size_type  len_ CXXOMFORT_CXX11_CODE(= 0, ;);


}; // array_ref


//! Compare <tt>array_ref</tt>s for equality.
template <typename T>
................................................................................
template <typename T, typename U>
array_ref<T const> carrayref (array_ref<U const> const& a) {
	static_assert (sizeof(T)==sizeof(U) , "incompatible sizeof");
	return array_ref<T const>(reinterpret_cast<T const*>(a.data()), a.size());
}


template <typename T, typename Idx>







array_ref<T,Idx> array_ref<T,Idx>::without_back () const {
    return without_back_n(1);
}

template <typename T, typename Idx>
array_ref<T,Idx> array_ref<T,Idx>::without_front_n (typename array_ref<T,Idx>::size_type n) const {
    pointer const newbegin = (len_>n) ? ptr_+n : ptr_;
    size_type const newlen= (len_>n) ? len_-n : len_;
    return array_ref<T,Idx>(newbegin,newlen);
}

template <typename T, typename Idx>
array_ref<T,Idx> array_ref<T,Idx>::without_front () const {
    return without_front_n(1);
}

template <typename T, typename Idx>
array_ref<T,Idx> array_ref<T,Idx>::leftmost (typename array_ref<T,Idx>::size_type n) const CXXO_NOEXCEPTNOTHROW {
    return (n >= len_) ? *this : array_ref(ptr_,n);
}

template <typename T, typename Idx>
array_ref<T,Idx> array_ref<T,Idx>::rightmost (typename array_ref<T,Idx>::size_type n) const CXXO_NOEXCEPTNOTHROW {
    return (n >= len_) ? *this : array_ref(ptr_+len_-n,n);
}

// Returns a view of the substring [pos, pos + rcount), 
// where rcount is the smaller of count and size() - pos
template <typename T, typename Idx>
array_ref<T,Idx> array_ref<T,Idx>::substr (typename array_ref<T,Idx>::size_type pos, typename array_ref<T,Idx>::size_type count) const {
    return (!empty() && (pos < len_) && (count < len_)) 
    ? array_ref(ptr_+pos, std::min(count, len_-pos))
    : array_ref(nullptr,0)
    ;
}


// 
// is_array_ref
// 




/**
 * @brief Type trait that identifies types of @c array_ref .
 * */
template <typename T> struct is_array_ref
: std::false_type {};
template <typename T> struct is_array_ref< array_ref<T> >
: std::true_type {};

} } } // cxxomfort::impl::array_ref



Changes to cxxomfort/cxxomfort/impl/p0040-memory_management.hpp.

4
5
6
7
8
9
10

11
12
13
14
15
16
17
18








19
20
21
22
23
24
25
..
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
..
89
90
91
92
93
94
95




96
97
98
99
100
101
102
 * @file
 * @brief Implementation of std::destroy_at and allies
 * 
 */

#define CXXOMFORT_IMPLEMENTS_p0040r1 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_p0040r2 CXXOMFORT_IMPLEMENTS_p0040r1

#define CXXOMFORT_IMPLEMENTS_destroy_at CXXOMFORT_IMPLEMENTS_p0040r2

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

namespace cxxomfort {
namespace cxxostd {










/**
 * @brief Destructs an object, as if the destructor was invoked via <code>Type::~Type()</code>.
 * @ingroup cxx17-backports
 * @xrefitem std0memory "<memory>" "Memory management"
 * @sa @wg21{p0040r2}
 * */
................................................................................
void destroy_at (T* p) CXXO_NOEXCEPTNOTHROW {
    p->~T();
}

/**
 * @brief Destructs a sequence of objects.
 * @ingroup cxx17-backports

 * @sa http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0040r2.html
 * */
template <typename Iter, typename Iter2>
void destroy (Iter ini, Iter2 fin) {
    using namespace std;
    for (; ini != fin; ++ini) destroy_at(addressof(*ini));
}

/**
 * @brief Destructs a sequence of objects.
 * @ingroup cxx17-backports

 * @sa http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0040r2.html
 * */
template <typename Iter, typename Integer>
void destroy_n (Iter ini, Integer n) {
    using namespace std;
    for (Integer i=0; i < n; ++i, ++ini) destroy_at(addressof(*ini));
}
................................................................................
        }
    }  catch (...) {
        destroy(ini, cur);
        throw;
    }
}





}
} // cxxomfort

#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#else
    #if (CXXOMFORT_CXX_STD < 2017)
namespace std {







>








>
>
>
>
>
>
>
>







 







>











>







 







>
>
>
>







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
..
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
...
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
 * @file
 * @brief Implementation of std::destroy_at and allies
 * 
 */

#define CXXOMFORT_IMPLEMENTS_p0040r1 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_p0040r2 CXXOMFORT_IMPLEMENTS_p0040r1
#undef  CXXOMFORT_IMPLEMENTS_destroy_at
#define CXXOMFORT_IMPLEMENTS_destroy_at CXXOMFORT_IMPLEMENTS_p0040r2

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

namespace cxxomfort {
namespace cxxostd {

/**
 * 
 * @ingroup cxx17-backports
 * @xrefitem std0memory "<memory>" "Memory management"
 * @sa @wg21{p0040r2}
 * @{
 * **/


/**
 * @brief Destructs an object, as if the destructor was invoked via <code>Type::~Type()</code>.
 * @ingroup cxx17-backports
 * @xrefitem std0memory "<memory>" "Memory management"
 * @sa @wg21{p0040r2}
 * */
................................................................................
void destroy_at (T* p) CXXO_NOEXCEPTNOTHROW {
    p->~T();
}

/**
 * @brief Destructs a sequence of objects.
 * @ingroup cxx17-backports
 * @xrefitem std0memory "<memory>" "Memory management"
 * @sa http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0040r2.html
 * */
template <typename Iter, typename Iter2>
void destroy (Iter ini, Iter2 fin) {
    using namespace std;
    for (; ini != fin; ++ini) destroy_at(addressof(*ini));
}

/**
 * @brief Destructs a sequence of objects.
 * @ingroup cxx17-backports
 * @xrefitem std0memory "<memory>" "Memory management"
 * @sa http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0040r2.html
 * */
template <typename Iter, typename Integer>
void destroy_n (Iter ini, Integer n) {
    using namespace std;
    for (Integer i=0; i < n; ++i, ++ini) destroy_at(addressof(*ini));
}
................................................................................
        }
    }  catch (...) {
        destroy(ini, cur);
        throw;
    }
}

/**
 * @}
 * */

}
} // cxxomfort

#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#else
    #if (CXXOMFORT_CXX_STD < 2017)
namespace std {

Changes to cxxomfort/cxxomfort/impl/p0792r0-function_ref.hpp.

4
5
6
7
8
9
10

11
12
13
14
15
16
17
...
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
/**
 * @file
 * @brief Implements part of p0792r0, a proposal for a non-owning reference view on functors.
 * 
 * */

#define CXXOMFORT_IMPLEMENTS_p0792 CXXO_IMPLSTATUS_LIBRARY()

#define CXXOMFORT_IMPLEMENTS_function_ref CXXOMFORT_IMPLEMENTS_p0792


#include <functional> // std::reference_wrapper, etc
#include <utility> // forward, move, etc
#include <cxxomfort/impl/07-type_traits.hpp>
#include <cxxomfort/impl/11-conditional.hpp>
................................................................................
    : fn_(callback_fn<typename cxxomfort::traits::remove_reference<Callable>::type>)
    , ptr_(reinterpret_cast<voidtype*>(&callable)) 
    , tinfo(&typeid(callable))
    {
    }

// MSVC <= 2010 does not generate the assignment operator correctly, needs help
#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,>=1500) && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,<1700))

    function_ref& operator= (Ret(callable)()) CXXO_NOEXCEPTNOTHROW {
        std::cout<< "[assign callable ptr]"<< std::endl;
        typename functiontype<Ret()>::type& f= callable;
        *this= function_ref(f);
        return *this;
    }







>







 







|







4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
/**
 * @file
 * @brief Implements part of p0792r0, a proposal for a non-owning reference view on functors.
 * 
 * */

#define CXXOMFORT_IMPLEMENTS_p0792 CXXO_IMPLSTATUS_LIBRARY()
#undef  CXXOMFORT_IMPLEMENTS_function_ref
#define CXXOMFORT_IMPLEMENTS_function_ref CXXOMFORT_IMPLEMENTS_p0792


#include <functional> // std::reference_wrapper, etc
#include <utility> // forward, move, etc
#include <cxxomfort/impl/07-type_traits.hpp>
#include <cxxomfort/impl/11-conditional.hpp>
................................................................................
    : fn_(callback_fn<typename cxxomfort::traits::remove_reference<Callable>::type>)
    , ptr_(reinterpret_cast<voidtype*>(&callable)) 
    , tinfo(&typeid(callable))
    {
    }

// MSVC <= 2010 does not generate the assignment operator correctly, needs help
#if (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,>=1500) && CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,<1700))

    function_ref& operator= (Ret(callable)()) CXXO_NOEXCEPTNOTHROW {
        std::cout<< "[assign callable ptr]"<< std::endl;
        typename functiontype<Ret()>::type& f= callable;
        *this= function_ref(f);
        return *this;
    }

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

496
497
498
499
500
501
502





503
504
505
506
507





508
509
510
511
512
513
514
		return type( get<1>(tu), get<2>(tu) );
	}
};

template <typename T, typename T1, typename T2, typename T3>
struct tuple_shift_t< std::tuple<T, T1,T2,T3> > {
	typedef std::tuple<T1,T2,T3> type;





};

template <typename T, typename T1, typename T2, typename T3, typename T4>
struct tuple_shift_t< std::tuple<T, T1,T2,T3,T4> > {
	typedef std::tuple<T1,T2,T3,T4> type;





};

	#if defined(_VARIADIC_MAX) && (VARIADIC_MAX < 6)
		#pragma message CXXO_WARNING("_VARIADIC_MAX set too low - C++ TR1 indicates at least = 10")
	#else

template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>







>
>
>
>
>





>
>
>
>
>







496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
		return type( get<1>(tu), get<2>(tu) );
	}
};

template <typename T, typename T1, typename T2, typename T3>
struct tuple_shift_t< std::tuple<T, T1,T2,T3> > {
	typedef std::tuple<T1,T2,T3> type;
	typedef std::tuple<T, T1,T2,T3> argument_type;
	static type call ( argument_type const& tu) {
		using std::get;
		return type( get<1>(tu), get<2>(tu), get<3>(tu) );
	}
};

template <typename T, typename T1, typename T2, typename T3, typename T4>
struct tuple_shift_t< std::tuple<T, T1,T2,T3,T4> > {
	typedef std::tuple<T1,T2,T3,T4> type;
	typedef std::tuple<T, T1,T2,T3,T4> argument_type;
	static type call ( argument_type const& tu) {
		using std::get;
		return type( get<1>(tu), get<2>(tu), get<3>(tu), get<4>(tu) );
	}
};

	#if defined(_VARIADIC_MAX) && (VARIADIC_MAX < 6)
		#pragma message CXXO_WARNING("_VARIADIC_MAX set too low - C++ TR1 indicates at least = 10")
	#else

template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>

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

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
bool is_clamped (T const& value, T const& lo, T const& hi, Compare less) CXXO_NOEXCEPTNOTHROW {
	return !less(value, lo) && !less(hi, value);
}

//! @overload is_clamped()
template <typename T>
CXXO_CONSTEXPR 
bool is_clamped (T const& value, T const& lo, T const& hi, Compare less) CXXO_NOEXCEPTNOTHROW {
	return !(value < lo) && !(hi < value);
}

#define CXXOMFORT_IMPLEMENTS_p1440 CXXO_IMPLSTATUS_LIBRARY()
#define CXXOMFORT_IMPLEMENTS_is_clamped CXXOMFORT_IMPLEMENTS_p1440









|







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
bool is_clamped (T const& value, T const& lo, T const& hi, Compare less) CXXO_NOEXCEPTNOTHROW {
	return !less(value, lo) && !less(hi, value);
}

//! @overload is_clamped()
template <typename T>
CXXO_CONSTEXPR 
bool is_clamped (T const& value, T const& lo, T const& hi) CXXO_NOEXCEPTNOTHROW {
	return !(value < lo) && !(hi < value);
}

#define CXXOMFORT_IMPLEMENTS_p1440 CXXO_IMPLSTATUS_LIBRARY()
#define CXXOMFORT_IMPLEMENTS_is_clamped CXXOMFORT_IMPLEMENTS_p1440


Changes to cxxomfort/cxxomfort/library/limits.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#ifndef CXXOMFORT_CXXO_SUPP_LIMITS_HPP
#define CXXOMFORT_CXXO_SUPP_LIMITS_HPP

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

/**
 * @file cxxomfort/library/limits.hpp
 * 
 */



#endif





|
<
<
<
<
<
<



1
2
3
4
5
6






7
8
9
#ifndef CXXOMFORT_CXXO_SUPP_LIMITS_HPP
#define CXXOMFORT_CXXO_SUPP_LIMITS_HPP

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








#endif

Changes to cxxomfort/cxxomfort/library/tuple.hpp.

444
445
446
447
448
449
450
451
452
453
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
482
std::tuple<TArgs...> 
tuple_pop (std::tuple<TArgs..., TLast> const& tu);

#endif

#if (CXXOMFORT_CXX_STD >= 2011)

template <typename... Args, typename Az, size_t... Indices>
std::tuple<Args...> 
tuple_pop_impl 
(std::tuple<Args...,Az> const& _tuple, std::index_sequence<Indices...> ) {
	using namespace std;
	return make_tuple( get<Indices>(_tuple)...);
}


//! Pops (discards) the rightmost type in a tuple.
//! @ingroup independent-utilities
template <typename...Args>
typename cxxomfort::impl::tuple_pop_t<std::tuple<Args...> >::type
tuple_pop
(std::tuple<Args...> const& _tuple) {
    using namespace std;
    //typedef typename cxxomfort::impl::tuple_pop_t<std::tuple<Args...> >::type return_type;
    typedef make_index_sequence< sizeof...(Args) -1 > IS;
    IS is;



    return cxxomfort::impl::tuple_pop_t< std::tuple<Args...> >::call(_tuple, is);
    //return make_tuple( forward<Args...>(get<Indices + 1>(_tuple)...) );
}


#else
template <typename A0, typename A1>
std::tuple<A0> tuple_pop (std::tuple<A0,A1> const& t) {
    using std::get;
    return std::make_tuple( get<0>(t) );
}
template <typename A0, typename A1, typename A2>
std::tuple<A0,A1> tuple_pop (std::tuple<A0,A1,A2> const& t) {







|
|

|












<


>
>
>
|
|



|







444
445
446
447
448
449
450
451
452
453
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
482
483
484
std::tuple<TArgs...> 
tuple_pop (std::tuple<TArgs..., TLast> const& tu);

#endif

#if (CXXOMFORT_CXX_STD >= 2011)

template <typename... Args, size_t... Indices>
typename cxxomfort::impl::tuple_pop_t<std::tuple<Args...> >::type
tuple_pop_impl 
(std::tuple<Args...> const& _tuple, std::index_sequence<Indices...> ) {
	using namespace std;
	return make_tuple( get<Indices>(_tuple)...);
}


//! Pops (discards) the rightmost type in a tuple.
//! @ingroup independent-utilities
template <typename...Args>
typename cxxomfort::impl::tuple_pop_t<std::tuple<Args...> >::type
tuple_pop
(std::tuple<Args...> const& _tuple) {
    using namespace std;

    typedef make_index_sequence< sizeof...(Args) -1 > IS;
    IS is;
    return tuple_pop_impl(_tuple,is);
	// unused:
    //typedef typename cxxomfort::impl::tuple_pop_t<std::tuple<Args...> >::type return_type;
    //return cxxomfort::impl::tuple_pop_t< std::tuple<Args...> >::call(_tuple, is);
    //return make_tuple( get<is...>(_tuple)... );
}


#else // c++03
template <typename A0, typename A1>
std::tuple<A0> tuple_pop (std::tuple<A0,A1> const& t) {
    using std::get;
    return std::make_tuple( get<0>(t) );
}
template <typename A0, typename A1, typename A2>
std::tuple<A0,A1> tuple_pop (std::tuple<A0,A1,A2> const& t) {

Changes to cxxomfort/cxxomfort/library/type_name.hpp.

107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
	size_t prefixend= 1;
	#endif

    size_t lpos = static_cast<size_t>(S.find("with T = ")+9UL);
    size_t rpos = static_cast<size_t>((S.end() - prefixend) - S.begin());
    S= S.substr(lpos, rpos-lpos);

#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_CLANG,>=302)) // 3.2
	string_view S (__PRETTY_FUNCTION__);
	//std::cout<< S<< std::endl;
	#if (CXXOMFORT_COMPILER_VERSION<500)
		S= S.substr(54, S.size()-54-1);
	#endif
#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_CLANG,<302))
// http://lists.llvm.org/pipermail/cfe-dev/2018-February/056767.html
	string_view S (__PRETTY_FUNCTION__);
	S= S.substr(47, S.size()-47-3);
#else
    string_view S (typeid(T).name());
#endif
    return S;







|





|







107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
	size_t prefixend= 1;
	#endif

    size_t lpos = static_cast<size_t>(S.find("with T = ")+9UL);
    size_t rpos = static_cast<size_t>((S.end() - prefixend) - S.begin());
    S= S.substr(lpos, rpos-lpos);

#elif (CXXO_COMPILERREQ(CXXO_COMPILERID_CLANG,>=302)) // 3.2
	string_view S (__PRETTY_FUNCTION__);
	//std::cout<< S<< std::endl;
	#if (CXXOMFORT_COMPILER_VERSION<500)
		S= S.substr(54, S.size()-54-1);
	#endif
#elif (CXXO_COMPILERREQ(CXXO_COMPILERID_CLANG,<302))
// http://lists.llvm.org/pipermail/cfe-dev/2018-February/056767.html
	string_view S (__PRETTY_FUNCTION__);
	S= S.substr(47, S.size()-47-3);
#else
    string_view S (typeid(T).name());
#endif
    return S;

Changes to cxxomfort/cxxomfort/memory.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
..
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
...
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
...
280
281
282
283
284
285
286





287

288
289
290
291
292
293
294
...
298
299
300
301
302
303
304

305
306
307
308
309
310
311
312
313
314
315
316
317
318

319
320
321
322


323





























324

325
326
327
328
329
330
331
332
333
334
335



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
#ifndef CXXOMFORT_MEMORY_HPP
#define CXXOMFORT_MEMORY_HPP
/**
 * @file
 * @brief Implementations and additions tied to Standard Header <tt><memory></tt>.
 * @xrefitem std0memory "<memory>" ""
 *
 */

#include "config.hpp"
#include "base.hpp"
#include "base/alignof.hpp"
#include CXXO_INCLUDE_SYS(memory)
................................................................................
namespace cxxomfort { namespace cxxostd {
	//! Backport of @c default_delete 
	template <typename T> struct default_delete {};
}}
#endif

#if (CXXOMFORT_CXX_STD>=2011)
#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,>=1600)) // MSVC 2010 already has it
#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_CXX_EMULATION>=2011)
#else

namespace std {
	template <typename T> struct default_delete {

		default_delete () throw() {}
................................................................................
*/
#endif


//
// destroy, uninitialized_default_construct, ...
//

#include "impl/p0040-memory_management.hpp"


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

#ifdef DOXYGEN_DOC
namespace cxxomfort { namespace fix {

/**
 * @brief @c bool validity check for a @c shared_ptr .
 * @returns @c true if the smart pointer is currently engaged.
 * @ingroup cxxomfort-fix
 * 
 * @see shared_ptr's explicit @c bool operator.
 * 
 * */
template <typename T> inline 
bool to_bool (std::shared_ptr<T> const& p) CXXO_NOEXCEPTNOTHROW;

/**
 * @brief @c bool validity check for a @c unique_ptr .
 * @returns @c true if the smart pointer is currently engaged.
 * @ingroup cxxomfort-fix
 * 
 * @see unique_ptr's explicit @c bool operator.
 * 
 * */
template <typename T> inline 
bool to_bool (std::unique_ptr<T> const& p) CXXO_NOEXCEPTNOTHROW;

} }
#endif // DOXYGEN_DOC

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

// assist
namespace cxxomfort { namespace fix {

template <typename T>
................................................................................


//
// assist: malloc_deleter extension
//
namespace cxxomfort { namespace fix {






struct malloc_deleter {

	void operator() (void* ptr) { std::free(ptr); }
};

} } // cxxomfort::fix::


// -- set up needed things in std::
................................................................................
// specialize std::tr1::hash for unique_ptr<>
// (this is allowed)
// define either NO_TR1 or CXXOMFORT_NO_TR1 to disable
// using this TR1 extension in C++03
//
#include CXXO_INCLUDE_SYS(functional) // std::hash, from Tr1
//#include <cxxomfort/functional.hpp>

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

CXXO_STDTR1_CLOSE() // } /* tr1 */ }
    #endif
#endif

































#endif // file



/**
 * @page std0memory <memory>
 * @brief Backports related to Standard Header <tt><memory></tt>
 *
 * @code
 * #include <cxxomfort/memory.hpp>
 * @endcode
 * 
 * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>)



 * Interfaces defined here:
 *
 * * @c alignof() (C++11) (See @e base_features ).
 * * @c addressof() (C++11) - get the memory address of an object.
 * * Pointer traits and Allocator traits (C++11) - tools for assisting in the design of containers.
 * * @link cxxomfort::cxxostd::aligned_storage @c aligned_storage @endlink </code> (C++11) - create an unitialized buffer for storing an object of a given type.
 * * @link cxxomfort::cxxostd::unique_ptr @c unique_ptr @endlink (C++11) - smart pointer that owns and holds a resource.
 * * @c make_unique() (C++14) - assist for creating @c unique_ptr .
 * * @c destroy() , @c destroy_at() (C++17) - memory management by calling destructors.
 *
 * Interfaces repointed here when in TR1:
 * 
 * * @c std::shared_ptr  and related utilities.
 * * @c std::weak_pre  and related utilities.
 * 
 * 
 * Non-backport interfaces (<tt>cxxomfort::fix</tt>):
 *
 * * <tt>to_bool()</tt> overloads:
 *   * <tt>to_bool(std::shared_ptr const&)</tt> - briefer validity check to @c bool .
 *   * <tt>to_bool(std::unique_ptr const&)</tt> - briefer validity check to @c bool .
 * * <tt>#cxxomfort::fix::malloc_deleter</tt>.




|
|







 







|







 







|







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







 







>
>
>
>
>

>







 







>
|













>
|



>
>

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

>











>
>
>







|





|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
..
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
...
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171




























172
173
174
175
176
177
178
...
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
...
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
#ifndef CXXOMFORT_MEMORY_HPP
#define CXXOMFORT_MEMORY_HPP
/**
 * @file
 * @brief Implementations and additions tied to Standard Header <tt>\<memory\></tt>.
 * @xrefitem std0memory "<memory>" "Header"
 *
 */

#include "config.hpp"
#include "base.hpp"
#include "base/alignof.hpp"
#include CXXO_INCLUDE_SYS(memory)
................................................................................
namespace cxxomfort { namespace cxxostd {
	//! Backport of @c default_delete 
	template <typename T> struct default_delete {};
}}
#endif

#if (CXXOMFORT_CXX_STD>=2011)
#elif (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,>=1600)) // MSVC 2010 already has it
#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_CXX_EMULATION>=2011)
#else

namespace std {
	template <typename T> struct default_delete {

		default_delete () throw() {}
................................................................................
*/
#endif


//
// destroy, uninitialized_default_construct, ...
//
//! @include{doc} "impl/p0040-memory_management.hpp"
#include "impl/p0040-memory_management.hpp"


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





























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

// assist
namespace cxxomfort { namespace fix {

template <typename T>
................................................................................


//
// assist: malloc_deleter extension
//
namespace cxxomfort { namespace fix {

/**
 * @brief Deleter operator that uses <tt>free()</tt> for <tt>malloc</tt>-reserved blocks.
 * @ingroup cxxomfort-fix
 * @xrefitem std0memory "<memory>" "Memory Management"
 * */
struct malloc_deleter {
	//! Invokes <tt>free()</tt> on the pointer.
	void operator() (void* ptr) { std::free(ptr); }
};

} } // cxxomfort::fix::


// -- set up needed things in std::
................................................................................
// specialize std::tr1::hash for unique_ptr<>
// (this is allowed)
// define either NO_TR1 or CXXOMFORT_NO_TR1 to disable
// using this TR1 extension in C++03
//
#include CXXO_INCLUDE_SYS(functional) // std::hash, from Tr1
//#include <cxxomfort/functional.hpp>

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

CXXO_STDTR1_CLOSE() 
    #endif
#endif

#ifdef DOXYGEN_DOC
namespace cxxomfort { namespace fix {

/**
 * @brief @c bool validity check for a @c shared_ptr .
 * @returns @c true if the smart pointer is currently engaged.
 * @ingroup cxxomfort-fix
 * @xrefitem std0memory "<memory> "Smart Pointer"
 * 
 * @see shared_ptr's explicit @c bool operator.
 * 
 * */
template <typename T> inline 
bool to_bool (std::shared_ptr<T> const& p) CXXO_NOEXCEPTNOTHROW;

/**
 * @brief @c bool validity check for a @c unique_ptr .
 * @returns @c true if the smart pointer is currently engaged.
 * @ingroup cxxomfort-fix
 * @xrefitem std0memory "<memory> "Smart Pointer"
 * 
 * @see unique_ptr's explicit @c bool operator.
 * 
 * */
template <typename T> inline 
bool to_bool (std::unique_ptr<T> const& p) CXXO_NOEXCEPTNOTHROW;

} }
#endif // DOXYGEN_DOC



#endif // file



/**
 * @page std0memory <memory>
 * @brief Backports related to Standard Header <tt><memory></tt>
 *
 * @code
 * #include <cxxomfort/memory.hpp>
 * @endcode
 * 
 * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>)
 * 
 * @section Interfaces
 * 
 * Interfaces defined here:
 *
 * * @c alignof() (C++11) (See @e base_features ).
 * * @c addressof() (C++11) - get the memory address of an object.
 * * Pointer traits and Allocator traits (C++11) - tools for assisting in the design of containers.
 * * @link cxxomfort::cxxostd::aligned_storage @c aligned_storage @endlink </code> (C++11) - create an unitialized buffer for storing an object of a given type.
 * * @link cxxomfort::cxxostd::unique_ptr @c unique_ptr @endlink (C++11) - smart pointer that owns and holds a resource.
 * * @c @ref make_unique() (C++14) - assist for creating @c unique_ptr .
 * * @c destroy() , @c destroy_at() (C++17) - memory management by calling destructors.
 *
 * Interfaces repointed here when in TR1:
 * 
 * * @c std::shared_ptr  and related utilities.
 * * @c std::weak_ptr  and related utilities.
 * * @c std::default_deleter
 * 
 * Non-backport interfaces (<tt>cxxomfort::fix</tt>):
 *
 * * <tt>to_bool()</tt> overloads:
 *   * <tt>to_bool(std::shared_ptr const&)</tt> - briefer validity check to @c bool .
 *   * <tt>to_bool(std::unique_ptr const&)</tt> - briefer validity check to @c bool .
 * * <tt>#cxxomfort::fix::malloc_deleter</tt>.

Changes to cxxomfort/cxxomfort/random.hpp.

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
...
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
// 
// 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;
................................................................................
/*
 * 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








|







 







|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
...
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
// 
// Fixes for the C++03 names of utilities in <random>
// 

	#include "impl/03-random_renames.hpp"

	#if (CXXOFLAG_namespace_tr1>0 ) \
	|| (CXXO_COMPILERREQ(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;
................................................................................
/*
 * 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_COMPILERREQ(CXXO_COMPILERID_MSC, >= 1600) && CXXOMFORT_CXX_STD< 2011 && CXXO_COMPILERREQ(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

Changes to cxxomfort/cxxomfort/string.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
..
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#ifndef CXXOMFORT_STRING_HPP
#define CXXOMFORT_STRING_HPP
/**
 * @file 
 * @brief Implementations and additions tied to <tt><string></tt>.
 * @xrefitem std0string "" ""
 */

#include "base.hpp"
#include <string>
#include <cstring>

................................................................................
            }
            return r;
        }    
    };
    
}
	// compilers that don't have hash<> 
		#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,<1500))
		#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_OW,<9999))
		#elif (0)    
		#endif // gcc

	#endif // pre-2011


#else // CXX_STD < 1997
................................................................................
			r ^= (static_cast<size_t>(s[i]) * wi);
			if (wi<<2 > MS ) { wi= 1; }
		}
		return r;
	}    
};

		#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG)
} }
		#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)
}
		#else
CXXO_STDTR1_CLOSE()
		#endif

	#else // < 1997
	#endif




|







 







|
|







 







|

|







1
2
3
4
5
6
7
8
9
10
11
12
..
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#ifndef CXXOMFORT_STRING_HPP
#define CXXOMFORT_STRING_HPP
/**
 * @file 
 * @brief Implementations and additions tied to <tt>\<string\></tt>.
 * @xrefitem std0string "" ""
 */

#include "base.hpp"
#include <string>
#include <cstring>

................................................................................
            }
            return r;
        }    
    };
    
}
	// compilers that don't have hash<> 
		#elif (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,<1500))
		#elif (CXXO_COMPILERREQ(CXXO_COMPILERID_OW,<9999))
		#elif (0)    
		#endif // gcc

	#endif // pre-2011


#else // CXX_STD < 1997
................................................................................
			r ^= (static_cast<size_t>(s[i]) * wi);
			if (wi<<2 > MS ) { wi= 1; }
		}
		return r;
	}    
};

		#if (0 && (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG) )
} }
		#elif (0 && CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)
}
		#else
CXXO_STDTR1_CLOSE()
		#endif

	#else // < 1997
	#endif

Changes to cxxomfort/cxxomfort/string_view.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
..
46
47
48
49
50
51
52
53









54
55
56
57
58
59
60
#ifndef CXXOMFORT_STRING_VIEW_HPP
#define CXXOMFORT_STRING_VIEW_HPP

#if (CXXOMFORT_CXX_STD >= 2017)
	#include <string_view>

#elif (1 || CXXOMFORT_CXX_STD >= 1997)
	#include "system_error.hpp"
	#include "impl/17-string_view.hpp"
//#include "impl/17-hash_string_view.hpp"

namespace std {
    using cxxomfort::cxxostd::basic_string_view;
    using cxxomfort::cxxostd::string_view;
    using cxxomfort::cxxostd::wstring_view;
	#if (CXXOMFORT_CXX_STD >= 2011)
    using cxxomfort::cxxostd::u16string_view;
    using cxxomfort::cxxostd::u32string_view;
	#endif
}

	#if (CXXOMFORT_CXX_STD>=1997)
		#include <string>

namespace cxxomfort { namespace fix {

................................................................................
}

} } // cxxomfort::fix

	#endif


#else // 0 && C++<1997









#endif

#endif

/**
 * @page std0string_view <string_view>
 * @brief Backports related to Standard header <tt><string_view></tt> 






|








<
<
<
<







 







|
>
>
>
>
>
>
>
>
>







1
2
3
4
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
58
59
60
61
62
63
64
65
#ifndef CXXOMFORT_STRING_VIEW_HPP
#define CXXOMFORT_STRING_VIEW_HPP

#if (CXXOMFORT_CXX_STD >= 2017)
	#include <string_view>

#elif (CXXOMFORT_CXX_STD >= 1997)
	#include "system_error.hpp"
	#include "impl/17-string_view.hpp"
//#include "impl/17-hash_string_view.hpp"

namespace std {
    using cxxomfort::cxxostd::basic_string_view;
    using cxxomfort::cxxostd::string_view;
    using cxxomfort::cxxostd::wstring_view;




}

	#if (CXXOMFORT_CXX_STD>=1997)
		#include <string>

namespace cxxomfort { namespace fix {

................................................................................
}

} } // cxxomfort::fix

	#endif


#else // C++ pre 97

	#include "impl/17-string_view.hpp"

namespace std {
    using cxxomfort::cxxostd::basic_string_view;
    using cxxomfort::cxxostd::string_view;
    using cxxomfort::cxxostd::wstring_view;
}

#endif

#endif

/**
 * @page std0string_view <string_view>
 * @brief Backports related to Standard header <tt><string_view></tt> 

Changes to cxxomfort/cxxomfort/system_error.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
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
...
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
...
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
...
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
...
530
531
532
533
534
535
536
537














































































538
539
540
541
542
543
544
...
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574



575
576
577
578
579
580
581
582
583
584
585
586
587
#include <cxxomfort/base.hpp>

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


#if (CXXOMFORT_CXX_STD>=2011)


	#include <system_error>

namespace cxxomfort { namespace fix {
	using std::errc;
} }

	#define CXXOMFORT_IMPLEMENTS_header_system_error CXXO_IMPLSTATUS_NATIVE()


#elif (CXXOMFORT_CXX_STD>=1997)



/*
 * MSVC 2010 has a broken <system_error> that defines errc inside a 
 * 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

		#if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
		#pragma message CXXO_NOTICE("enabled <backporting std::errc> support.")
		#endif

		#include <cxxomfort/base.hpp>
		#include <cxxomfort/base/explicit_cast.hpp>
		#include <cxxomfort/cerrno.hpp>
		#include "impl/relationals.hpp"
		#include <cxxomfort/memory.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;


................................................................................
    return os << ec.category().name() << ':' << ec.value();
}

// end namespaces

}}

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

#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;
    using cxxomfort::cxxostd::is_error_code_enum;
................................................................................
    using cxxomfort::cxxostd::is_error_condition_enum;
    
    using cxxomfort::cxxostd::error_code;
    
    using cxxomfort::cxxostd::system_error;
    
}
    #endif // std
    
#endif // using std

#endif // system_error



//
// helper function
................................................................................
 * */
#ifdef DOXYGEN_DOC
enum class errc {};
#endif

#if (CXXOMFORT_CXX_STD>=2011)
using std::errc;
#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,>=1600) && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, <1800))
using ::std::errc::errc;
#else
using std::errc;
#endif


/**
................................................................................
    return static_cast<errc>(E);
#endif
}

} } // cxxomfort::fix


#else // CXXOMFORT_CXX_STD















































































#endif // CXXOMFORT_CXX_STD
#endif

/**
 * @page std0system_error <system_error>
 * 
................................................................................
 * 
 * @code
 * #include <cxxomfort/system_error.hpp>
 * @endcode
 * 
 * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>)
 * 
 * In new C++, <tt><system_error></tt> provides general facilities for 
 * dealing with error codes and categorization of error types 
 * using a schema alternative and complimentary to eg.: exceptions. 
 * 
 * Interfaces defined in this file:
 * 
 * * @link cxxomfort::cxxostd::errc @c errc @endlink - enumerator for error codes.
 * * @c error_category() , @c generic_category() , @c system_category() .
 * * @link cxxomfort::cxxostd::error_condition @c error_condition @endlink .
 * * @c @ref cxxomfort::cxxostd::error_code "error_code" .
 * * @c make_error_code()
 * * POSIX error codes that might be missing in some compilers (eg.: older versions of MSVC).
 * 
 * Non-backport interfaces (<tt>cxxomfort::fix</tt>):
 * 
 * * @link cxxomfort::fix::errc @c errc @endlink - Alias to @c errc::errc in MSVC 2010, normal @c std::errc otherwise.
 * * @c to_errc() - Create an @c errc value from a native integer.
 * 
 * @subsection errc codes
 * 
 * @e Pending 
 * 



 * @subsection Client Code
 * 
 * For sections of cxxomfort making use of these facilities 
 * (even in C++03 mode), see: @link cxxo-sup-iterator @endlink , <tt>at_or</tt>, 
 * @ref fixed_vector , @ref cxxo_array_ref .
 * 
 * @subsection See Also
 * 
 * * @cppref{header/system_error}
 * * @cppref{error/errc} (definition and values of the enumeration type)
 * 
 * 
 * */







|

>






<


|

>











<
<
<
<
<
|
|
|

<
<
|
|
|
|
|
|
|
|
|

<
<
<
|
|

<
<
|
|
|

|
|
|
|
|
|







 







|
|
|

<

<
|
|

|
|
|







 







<

|







 







|







 







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







 







|
|
|



|
|
|
|






|

|

|

>
>
>
|












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
...
437
438
439
440
441
442
443
444
445
446
447

448

449
450
451
452
453
454
455
456
457
458
459
460
461
...
468
469
470
471
472
473
474

475
476
477
478
479
480
481
482
483
...
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
...
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
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
595
596
597
598
599
600
601
602
603
604
605
606
607
608
...
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
#include <cxxomfort/base.hpp>

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


#if (CXXOMFORT_CXX_STD>=2011 || CXXO_CXXSTDHEADER_system_error)

	#define CXXOMFORT_IMPLEMENTS_header_system_error CXXO_IMPLSTATUS_NATIVE()
	#include <system_error>

namespace cxxomfort { namespace fix {
	using std::errc;
} }




#elif (1 || CXXOMFORT_CXX_STD>=1997)

	#define CXXOMFORT_IMPLEMENTS_header_system_error CXXO_IMPLSTATUS_EMULATION()

/*
 * MSVC 2010 has a broken <system_error> that defines errc inside a 
 * 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 (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
		#pragma message CXXO_NOTICE("backporting <system_error> support.")
	#endif



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




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



	#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;


................................................................................
    return os << ec.category().name() << ':' << ec.value();
}

// end namespaces

}}

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




	#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;
    using cxxomfort::cxxostd::is_error_code_enum;
................................................................................
    using cxxomfort::cxxostd::is_error_condition_enum;
    
    using cxxomfort::cxxostd::error_code;
    
    using cxxomfort::cxxostd::system_error;
    
}

    
	#endif // using std

#endif // system_error



//
// helper function
................................................................................
 * */
#ifdef DOXYGEN_DOC
enum class errc {};
#endif

#if (CXXOMFORT_CXX_STD>=2011)
using std::errc;
#elif (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,>=1600) && CXXO_COMPILERREQ(CXXO_COMPILERID_MSC, <1800))
using ::std::errc::errc;
#else
using std::errc;
#endif


/**
................................................................................
    return static_cast<errc>(E);
#endif
}

} } // cxxomfort::fix


#else // CXXOMFORT_CXX_STD < 1997

	#include <cerrno>
	#include <stdexcept>
	#include <string>
	#include <cstring> // strerror
	#include <cstdlib>
	#include <utility> // make_pair, operator<
	#include "impl/errc.hpp"
	
namespace cxxomfort { namespace cxxostd {

class error_code;
class error_condition;
class error_category;

class error_category {

    public:

    error_category () {};
    CXXO_DELETED_COPY_CONSTRUCTOR(error_category);
    virtual ~error_category () {};
    CXXO_DELETED_COPY_ASSIGN(error_category);
    
    //! Deriveds implement a naming schema for the category here.
    virtual const char* name () const CXXO_NOEXCEPTNOTHROW = 0;
    //! Deriveds provide a descriptive message about the error here.
    virtual std::string message (int condition ) const = 0;
    
    virtual error_condition 
    default_error_condition (int code ) const CXXO_NOEXCEPTNOTHROW;

    virtual bool 
    equivalent (int code, error_condition const& condition ) const CXXO_NOEXCEPTNOTHROW;
    
    virtual bool 
    equivalent (error_code const& ec, int condition) const CXXO_NOEXCEPTNOTHROW;

    friend bool operator== (error_category const& vl, error_category const& vr) CXXO_NOEXCEPT {
        return &vl == &vr;
    }
    friend bool operator< (error_category const& vl, error_category const& vr) CXXO_NOEXCEPT {
        return &vl < & vr;
    }

    private:

};

struct generic_category_t : public error_category {
    ~generic_category_t () {}

    const char* name () const CXXO_NOEXCEPTNOTHROW {
        return "generic";
    }
    std::string message (int condition) const {
        return std::string(name()) + ": " + std::strerror(condition);
    }
};

static inline error_category const& generic_category() CXXO_NOEXCEPTNOTHROW {
    static generic_category_t g;
    return g;
}


}} // cxxomfort::cxxostd

namespace std {
	//using cxxomfort::cxxostd::errc;
	using cxxomfort::cxxostd::error_code;
	using cxxomfort::cxxostd::error_condition;
	using cxxomfort::cxxostd::error_category;
	
	using cxxomfort::cxxostd::generic_category;
	
}


#endif // CXXOMFORT_CXX_STD
#endif

/**
 * @page std0system_error <system_error>
 * 
................................................................................
 * 
 * @code
 * #include <cxxomfort/system_error.hpp>
 * @endcode
 * 
 * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>)
 * 
 * In new C++, <tt><system_error></tt> provides general facilities for dealing with error codes and categorization of error types and error returns (eg.: @c errno ) using a schema alternative and complimentary to eg.: exceptions. 
 * 
 * @section Interfaces 
 * 
 * Interfaces defined in this file:
 * 
 * * @link cxxomfort::cxxostd::errc @c errc @endlink - enumerator type for error codes, basically a typesafe version of @c errno .
 * * @c error_category() , @c generic_category() , @c system_category() - marker functions that reference the category object that an error is being implemented in.
 * * @link cxxomfort::cxxostd::error_condition @c error_condition @endlink - a sort of platform-agnostic error code.
 * * @c @ref cxxomfort::cxxostd::error_code platform-dependent "error_code" .
 * * @c make_error_code()
 * * POSIX error codes that might be missing in some compilers (eg.: older versions of MSVC).
 * 
 * Non-backport interfaces (<tt>cxxomfort::fix</tt>):
 * 
 * * @link cxxomfort::fix::errc @c errc @endlink - Alias to @c errc::errc in MSVC 2010, normal @c std::errc otherwise.
 * * @c to_errc() - Create an @c errc value from a native integer, a sort of safe type cast.
 * 
 * @section errc codes
 * 
 * The listing of error codes that cxxomfort supports is compiler-specific and mostly depends on the operating system and C++ Standard conformance level. In general, when in >=C++11 mode the listing present at https://en.cppreference.com/w/cpp/error/errc is supporte.
 * 
 * In pre-C++11 mode (or in eg.: MSVC on Windows), a subset of those names are detected automatically and the extension @c cxxomfort::fix::errc provides access to some other names not normally provided by the compiler.
 * 
 * 
 * @section Client Code
 * 
 * For sections of cxxomfort making use of these facilities 
 * (even in C++03 mode), see: @link cxxo-sup-iterator @endlink , <tt>at_or</tt>, 
 * @ref fixed_vector , @ref cxxo_array_ref .
 * 
 * @subsection See Also
 * 
 * * @cppref{header/system_error}
 * * @cppref{error/errc} (definition and values of the enumeration type)
 * 
 * 
 * */

Changes to cxxomfort/cxxomfort/type_traits.hpp.

163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
...
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
...
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
...
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
...
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
...
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
...
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
...
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
	#define CXXOMFORT_IMPLEMENTS_p0550 CXXO_IMPLSTATUS_BACKPORT()
namespace std {
	using ::cxxomfort::traits::remove_cvref;
}

#endif

#define CXXOMFORT_IMPLEMENTS_std_remove_cvref CXXOMFORT_IMPLEMENTS_p0550


/*
 * TR1 traits missing in c++03 in implementations
 * is_literal_type, is_trivial, etc
 */

................................................................................
#endif


//
// is_trivially_... missing in GCC 4.7 despite announcing C++11 mode
//

#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC , < 404) && CXXOMFORT_CXX_EMULATION==2011)
namespace std {
    template <typename T> struct is_trivially_default_constructible
    : integral_constant<bool, __has_trivial_constructor(T)> {};

    template <typename T> struct is_trivially_copy_constructible
    : integral_constant<bool, __has_trivial_copy(T)> {};

................................................................................
    : integral_constant<bool, __has_trivial_assign(T)> {};

    template <typename T> struct is_trivially_destructible
    : integral_constant<bool, __has_trivial_destructor(T)> {};

}
#endif
#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC , == 407) && CXXOMFORT_CXX_EMULATION==2011)
namespace std {
    template <typename T> struct is_trivially_destructible
    : integral_constant<bool, __has_trivial_destructor(T)> {};
}
#endif    

// is_...._move_constructible - for C++03
................................................................................
 */
#if ( (CXXOMFORT_CXX_STD < 2014) )
    #define CXXO_needs_is_null_pointer
#endif
#if (defined(CXXO_needs_is_null_pointer) && CXXOMFORT_CXX_STD == 2011 && CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG)
    #undef CXXO_needs_is_null_pointer
#endif
#if (defined(CXXO_needs_is_null_pointer) && CXXOMFORT_CXX_STD == 2011 && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, >=500 ))
    #undef CXXO_needs_is_null_pointer
#endif

#if (defined(CXXO_needs_is_null_pointer))
namespace std {
    using ::cxxomfort::traits::is_null_pointer;
}
................................................................................
// 
// traits from here on require at least C++03 TR1 <type_traits> support
// 


// is_destructible
#if (CXXOMFORT_CXX_STD >= 2011) \
|| CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,>=1700)
#elif (CXXO_COMPILER_SUPPORT_tr1_type_traits)
namespace std {

    template <typename T>
    struct is_destructible
    : integral_constant<bool, 
    (is_pod<T>::value || is_class<T>::value) && !is_void<T>::value > 
................................................................................
}

#endif

// is_standard_layout
#if (CXXOMFORT_CXX_STD < 2011) 
    #if \
    (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,>=1500) && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,<1600)) || \
    (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC,>0) && 0==CXXOMFORT_CXX_EMULATION)
        #define CXXO_needs_standard_layout
    #endif
#endif

#ifdef CXXO_needs_standard_layout
namespace std {

................................................................................
    : integral_constant<bool,
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)
        #if (CXXOMFORT_COMPILER_VERSION>=1600)
        __is_standard_layout(T)
        #else
        false
        #endif
    #elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, >=406))
        __is_standard_layout(T)
    #elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_CLANG, >= 300))
        __is_standard_layout(T)
    #else
        is_scalar<T>::value
    #endif

    > {
    };
................................................................................
// is_final

#if (CXXOMFORT_CXX_STD < 2014)
namespace std {
    template <typename T>
    struct is_final
    : integral_constant<bool,
    #if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, > 0))
        false
    #elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, >= 600))
        __is_final(T)
    #elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_CLANG, >= 300))
        __is_final(T)
    #else
        false
    #endif

    > {
    };







|







 







|







 







|







 







|







 







|







 







|
|







 







|

|







 







|

|

|







163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
...
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
...
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
...
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
...
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
...
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
...
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
...
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
	#define CXXOMFORT_IMPLEMENTS_p0550 CXXO_IMPLSTATUS_BACKPORT()
namespace std {
	using ::cxxomfort::traits::remove_cvref;
}

#endif

// #define CXXOMFORT_IMPLEMENTS_std_remove_cvref CXXOMFORT_IMPLEMENTS_p0550


/*
 * TR1 traits missing in c++03 in implementations
 * is_literal_type, is_trivial, etc
 */

................................................................................
#endif


//
// is_trivially_... missing in GCC 4.7 despite announcing C++11 mode
//

#if (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC , < 404) && CXXOMFORT_CXX_EMULATION==2011)
namespace std {
    template <typename T> struct is_trivially_default_constructible
    : integral_constant<bool, __has_trivial_constructor(T)> {};

    template <typename T> struct is_trivially_copy_constructible
    : integral_constant<bool, __has_trivial_copy(T)> {};

................................................................................
    : integral_constant<bool, __has_trivial_assign(T)> {};

    template <typename T> struct is_trivially_destructible
    : integral_constant<bool, __has_trivial_destructor(T)> {};

}
#endif
#if (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC , == 407) && CXXOMFORT_CXX_EMULATION==2011)
namespace std {
    template <typename T> struct is_trivially_destructible
    : integral_constant<bool, __has_trivial_destructor(T)> {};
}
#endif    

// is_...._move_constructible - for C++03
................................................................................
 */
#if ( (CXXOMFORT_CXX_STD < 2014) )
    #define CXXO_needs_is_null_pointer
#endif
#if (defined(CXXO_needs_is_null_pointer) && CXXOMFORT_CXX_STD == 2011 && CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG)
    #undef CXXO_needs_is_null_pointer
#endif
#if (defined(CXXO_needs_is_null_pointer) && CXXOMFORT_CXX_STD == 2011 && CXXO_COMPILERREQ(CXXO_COMPILERID_GCC, >=500 ))
    #undef CXXO_needs_is_null_pointer
#endif

#if (defined(CXXO_needs_is_null_pointer))
namespace std {
    using ::cxxomfort::traits::is_null_pointer;
}
................................................................................
// 
// traits from here on require at least C++03 TR1 <type_traits> support
// 


// is_destructible
#if (CXXOMFORT_CXX_STD >= 2011) \
|| CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,>=1700)
#elif (CXXO_COMPILER_SUPPORT_tr1_type_traits)
namespace std {

    template <typename T>
    struct is_destructible
    : integral_constant<bool, 
    (is_pod<T>::value || is_class<T>::value) && !is_void<T>::value > 
................................................................................
}

#endif

// is_standard_layout
#if (CXXOMFORT_CXX_STD < 2011) 
    #if \
    (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,>=1500) && CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,<1600)) || \
    (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC,>0) && 0==CXXOMFORT_CXX_EMULATION)
        #define CXXO_needs_standard_layout
    #endif
#endif

#ifdef CXXO_needs_standard_layout
namespace std {

................................................................................
    : integral_constant<bool,
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)
        #if (CXXOMFORT_COMPILER_VERSION>=1600)
        __is_standard_layout(T)
        #else
        false
        #endif
    #elif (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC, >=406))
        __is_standard_layout(T)
    #elif (CXXO_COMPILERREQ(CXXO_COMPILERID_CLANG, >= 300))
        __is_standard_layout(T)
    #else
        is_scalar<T>::value
    #endif

    > {
    };
................................................................................
// is_final

#if (CXXOMFORT_CXX_STD < 2014)
namespace std {
    template <typename T>
    struct is_final
    : integral_constant<bool,
    #if (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC, > 0))
        false
    #elif (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC, >= 600))
        __is_final(T)
    #elif (CXXO_COMPILERREQ(CXXO_COMPILERID_CLANG, >= 300))
        __is_final(T)
    #else
        false
    #endif

    > {
    };

Changes to cxxomfort/cxxomfort/util/memtraits.hpp.

223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239

}
}

#if (CXXOMFORT_CXX_STD < 2011)
    #if (CXXOMFORT_CXX_EMULATION < 2011)
        #define CXXO_needs_memtraits 1
    #elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, <= 1600) )
        #define CXXO_needs_memtraits 1
    #elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, <= 408) )
        #define CXXO_needs_memtraits 1
    #endif
#endif


#ifdef CXXO_needs_memtraits
    







|

|







223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239

}
}

#if (CXXOMFORT_CXX_STD < 2011)
    #if (CXXOMFORT_CXX_EMULATION < 2011)
        #define CXXO_needs_memtraits 1
    #elif (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC, <= 1600) )
        #define CXXO_needs_memtraits 1
    #elif (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC, <= 408) )
        #define CXXO_needs_memtraits 1
    #endif
#endif


#ifdef CXXO_needs_memtraits
    

Changes to cxxomfort/cxxomfort/util/traits_tn.hpp.

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
#if (defined(CXXO_enable_is_nothrow))
namespace std {
}
#undef CXXO_enable_is_nothrow
#endif // cxx11

// GCC 4.7 misses some nothrow traits despite announcing C++11 mode
#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC , == 407) && CXXOMFORT_CXX_EMULATION==2011)
namespace std {
    template <typename T>
    struct is_nothrow_destructible
    : cxxomfort::traits::integral_constant<bool, __has_trivial_destructor(T)> {};
}
#endif

................................................................................
//
// is_default_constructible (for c++03)
// we approximate it by using the trivially and nothrow traits
//



#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,<1700))
namespace std {
    template <typename T>
    struct is_default_constructible
    : std::integral_constant<bool, is_trivially_default_constructible<T>::value || is_nothrow_default_constructible<T>::value>
    {};

} // std::







|







 







|







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
#if (defined(CXXO_enable_is_nothrow))
namespace std {
}
#undef CXXO_enable_is_nothrow
#endif // cxx11

// GCC 4.7 misses some nothrow traits despite announcing C++11 mode
#if (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC , == 407) && CXXOMFORT_CXX_EMULATION==2011)
namespace std {
    template <typename T>
    struct is_nothrow_destructible
    : cxxomfort::traits::integral_constant<bool, __has_trivial_destructor(T)> {};
}
#endif

................................................................................
//
// is_default_constructible (for c++03)
// we approximate it by using the trivially and nothrow traits
//



#if (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,<1700))
namespace std {
    template <typename T>
    struct is_default_constructible
    : std::integral_constant<bool, is_trivially_default_constructible<T>::value || is_nothrow_default_constructible<T>::value>
    {};

} // std::

Changes to cxxomfort/cxxomfort/utility.hpp.

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
     */
    template <typename T> typename cxxomfort::traits::add_reference<T>::type declval();

}
}

	#if (CXXOMFORT_CXX_STD < 2011)
		#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,<170))
			#define CXXO_ADD_declval 
		#endif
		#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, >0))
			#if (CXXOMFORT_CXX_EMULATION<2011)
				#define CXXO_ADD_declval
			#endif
		#elif (CXXOMFORT_CXX_EMULATION < 2011)
			#define CXXO_ADD_declval
		#endif








|


|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
     */
    template <typename T> typename cxxomfort::traits::add_reference<T>::type declval();

}
}

	#if (CXXOMFORT_CXX_STD < 2011)
		#if (CXXO_COMPILERREQ(CXXO_COMPILERID_MSC,<170))
			#define CXXO_ADD_declval 
		#endif
		#if (CXXO_COMPILERREQ(CXXO_COMPILERID_GCC, >0))
			#if (CXXOMFORT_CXX_EMULATION<2011)
				#define CXXO_ADD_declval
			#endif
		#elif (CXXOMFORT_CXX_EMULATION < 2011)
			#define CXXO_ADD_declval
		#endif

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

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
CXXOMFORT_CXX_EMULATION|unsigned int: yyyy (year of STD)||
CXXOMFORT_NOTICES|int|noticelevel|
CXXO_NOTICE||("message")|
CXXO_WARNING||("warning")|
CXXOFLAG_SHADOW_KEYWORD_constexpr|||
CXXOFLAG_INCLUDE_PATH|||
#code generation
CXXO_COMPILERVERSION_COMPARE|BOOL|(compilerid_, <=> version_)|
CXXOMFORT_CXX11_CODE|code...|(cxx11onward_code,cxx03upto_code)|
CXXOMFORT_CXX14_CODE|code...|(cxx14onward_code,cxx11upto_code)|
CXXOMFORT_CXX17_CODE|code...|(cxx17onward_code,cxx14upto_code)|
CXXO_AUTO|type?|(name , expression)|
CXXO_I12N_BEG|expr...|(Sequence_Type , Variable_Name)|
CXXO_I12N_END|expr...|(Sequence_Type , Variable_Name)|
CXXO_I12N_SEQ|expr...|(Sequence_Type , Variable_Name , { sequence...})|
CXXO_LOCALFN||(Signature)(arguments...){...}|
CXXO_LOCALFN_NAME_DEF||(Name,Signature)|
CXXO_TYPEOF|type?|(expression)|

CXXO_CONSTEXPR|expr?||
CXXO_CONSTEXPR14|expr?||
CXXO_DECLTYPE|type?|(expression)|
CXXO_DEFAULT_DEFAULT_CONSTRUCTOR|default_ctor_expression|(T)|
CXXO_DISABLE_DEFAULT_CONSTRUCTOR|private_expr|(T)|
CXXO_EXPLICIT_OPERATOR|code...|(Target_Type)|
CXXO_FOREACH|expr...|(key , sequence)|
CXXO_GENERATE_RELATIONALS|code...|(Type)|
CXXO_GENERATE_RELATIONALS_T|code...|(Type with TPARAMS and TARGS)|
CXXO_NOEXCEPT|expr?||
CXXO_NOEXCEPTNOTHROW|expr?||
CXXO_NOEXCEPT_COND|expr?|(conditional)||
CXXO_PSEUDOVARIADIC_MEMBER||(prefix,func_name,suffix)|







|










>













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
CXXOMFORT_CXX_EMULATION|unsigned int: yyyy (year of STD)||
CXXOMFORT_NOTICES|int|noticelevel|
CXXO_NOTICE||("message")|
CXXO_WARNING||("warning")|
CXXOFLAG_SHADOW_KEYWORD_constexpr|||
CXXOFLAG_INCLUDE_PATH|||
#code generation
CXXO_COMPILERREQ|BOOL|(compilerid_, <=> version_)|
CXXOMFORT_CXX11_CODE|code...|(cxx11onward_code,cxx03upto_code)|
CXXOMFORT_CXX14_CODE|code...|(cxx14onward_code,cxx11upto_code)|
CXXOMFORT_CXX17_CODE|code...|(cxx17onward_code,cxx14upto_code)|
CXXO_AUTO|type?|(name , expression)|
CXXO_I12N_BEG|expr...|(Sequence_Type , Variable_Name)|
CXXO_I12N_END|expr...|(Sequence_Type , Variable_Name)|
CXXO_I12N_SEQ|expr...|(Sequence_Type , Variable_Name , { sequence...})|
CXXO_LOCALFN||(Signature)(arguments...){...}|
CXXO_LOCALFN_NAME_DEF||(Name,Signature)|
CXXO_TYPEOF|type?|(expression)|
CXXO_TYPEOF_OR|type?|(Type,Expr)|
CXXO_CONSTEXPR|expr?||
CXXO_CONSTEXPR14|expr?||
CXXO_DECLTYPE|type?|(expression)|
CXXO_DEFAULT_DEFAULT_CONSTRUCTOR|default_ctor_expression|(T)|
CXXO_DISABLE_DEFAULT_CONSTRUCTOR|private_expr|(T)|
CXXO_EXPLICIT_OPERATOR|code...|(Target_Type)|
CXXO_FOREACH|expr...|(key , sequence)|
CXXO_GENERATE_RELATIONALS|code...|(Type)|
CXXO_GENERATE_RELATIONALS_T|code...|(Type with TPARAMS and TARGS)|
CXXO_NOEXCEPT|expr?||
CXXO_NOEXCEPTNOTHROW|expr?||
CXXO_NOEXCEPT_COND|expr?|(conditional)||
CXXO_PSEUDOVARIADIC_MEMBER||(prefix,func_name,suffix)|