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

Overview
Comment:Commit 2020-02-04 - Compatibility improvements for MSVC 2012, GCC 6.x.
  • cxxomfort: Added better compatibility with GCC in C++14 mode (Enhances: []).
  • cxxomfort: Added better detection of MSVC 2012 and MSVC 2013 (Enhances: [70b70d8017]).
  • cstddef: Moved CXXOMFORT_IMPLEMENTS_decltype from utility.
  • cstddef: Moved to_byte to fixes (cxxomfort::fix).
  • ctime: Now uses POSIX timespec functions when in POSIX env.
  • ctime: Now implements timespec_get() in terms of GetSystemTime() when in Windows env.
  • memory: Fixed make_unique double / conflicting definition in GCC C++14 emulation mode (Enhances: []).
  • numeric: Fixed an issue where the template argument names for gcd, lcm cause conflicts in MSVC >= 2010.
  • string_view: Fixed a copy-ctor and assignment compilation error due to partial constexpr support (see library:array_ref).
  • string_view: Fixed missing reverse iterators.
  • system_error: Fixed an issue where code including the header would not compile if it was the only backported header it was using.
  • tuple: Fixed get<type>(tuple<...>) not being backported to C++11 in GCC≥5.
  • tuple: Fixed get<type>(tuple<...>) clashing with GCC 6.x in C++14 emulation mode (__cplusplus==201500) (Enhances: []).
  • tuple: Fixed make_from_tuple not being backported to C++11, C++14 in GCC≥5.
  • utility: moved CXXOMFORT_IMPLEMENTS_decltype to cstddef.
  • library:algorithm: Added [any,all,none]_on.
  • library:array_ref: Made front, back noexcept where available.
  • library:array_ref: Added size_bytes member function, adapting from C++20 span.
  • library:array_ref: Added a workaround for GCC bug on "defaulted declaration differs" for GCC < 7 (see [E1])
  • library:array_ref: Added missing operator==, operator!=.
  • library:functional: Fixed anachronistic parameter passing in constant_fn().
  • library:numeric: static_min, static_max now take up to 10 arguments.
  • library:utility: Added hexdump, hexload.
  • library:utility: Added utility typedefs bytes_view, const_bytes_view and utility function as_bytes_view().

[E1] https://stackoverflow.com/questions/20610658/defaulted-move-assignment-cannot-be-explicitly-noexcept-if-a-member-has-a-non-tr

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | msvc_max_1700 | msvc_min_1500 | release | y2020 | gcc_max_605 | gcc_min_408 | tagfiles
Files: files | file ages | folders
SHA3-256:f22f0a4b02331df79fb68096ec9678d99724946b5795fb2345f94bd046815c9c
User & Date: luismachuca 2020-02-07 16:42:58
Context
2020-02-07
16:45
Commit 2020-02-04 - Compatibility improvements for MSVC 2012, GCC 6.x [2]
  • Fixed missing hexdump.hpp.
check-in: 2e1ff340 user: luismachuca tags: msvc_max_1700, msvc_min_1500, release, y2020, gcc_max_605, gcc_min_408, tagfiles
16:42
Commit 2020-02-04 - Compatibility improvements for MSVC 2012, GCC 6.x.
  • cxxomfort: Added better compatibility with GCC in C++14 mode (Enhances: []).
  • cxxomfort: Added better detection of MSVC 2012 and MSVC 2013 (Enhances: [70b70d8017]).
  • cstddef: Moved CXXOMFORT_IMPLEMENTS_decltype from utility.
  • cstddef: Moved to_byte to fixes (cxxomfort::fix).
  • ctime: Now uses POSIX timespec functions when in POSIX env.
  • ctime: Now implements timespec_get() in terms of GetSystemTime() when in Windows env.
  • memory: Fixed make_unique double / conflicting definition in GCC C++14 emulation mode (Enhances: []).
  • numeric: Fixed an issue where the template argument names for gcd, lcm cause conflicts in MSVC >= 2010.
  • string_view: Fixed a copy-ctor and assignment compilation error due to partial constexpr support (see library:array_ref).
  • string_view: Fixed missing reverse iterators.
  • system_error: Fixed an issue where code including the header would not compile if it was the only backported header it was using.
  • tuple: Fixed get<type>(tuple<...>) not being backported to C++11 in GCC≥5.
  • tuple: Fixed get<type>(tuple<...>) clashing with GCC 6.x in C++14 emulation mode (__cplusplus==201500) (Enhances: []).
  • tuple: Fixed make_from_tuple not being backported to C++11, C++14 in GCC≥5.
  • utility: moved CXXOMFORT_IMPLEMENTS_decltype to cstddef.
  • library:algorithm: Added [any,all,none]_on.
  • library:array_ref: Made front, back noexcept where available.
  • library:array_ref: Added size_bytes member function, adapting from C++20 span.
  • library:array_ref: Added a workaround for GCC bug on "defaulted declaration differs" for GCC < 7 (see [E1])
  • library:array_ref: Added missing operator==, operator!=.
  • library:functional: Fixed anachronistic parameter passing in constant_fn().
  • library:numeric: static_min, static_max now take up to 10 arguments.
  • library:utility: Added hexdump, hexload.
  • library:utility: Added utility typedefs bytes_view, const_bytes_view and utility function as_bytes_view().

[E1] https://stackoverflow.com/questions/20610658/defaulted-move-assignment-cannot-be-explicitly-noexcept-if-a-member-has-a-non-tr check-in: f22f0a4b user: luismachuca tags: msvc_max_1700, msvc_min_1500, release, y2020, gcc_max_605, gcc_min_408, tagfiles

2020-01-14
05:29
Commit 2020-01-13 - The “don't ask me for documentation fixes, I don't have 2020 vision” release.
  • cxxomfort: Added detection of Clang 4.x with some features.
  • cxxomfort: CXXOMFORT_VERSION now copies CXXOMFORT_DATE.
  • config: Slightly improved detection of Clang __has_extension.
  • algorithm: Fixed any_of returning always true (Fixes: [98efdadf5b]).
  • functional: Fixed missing connection of documentation for heterogeneous functors.
  • iterator: Defined and documented the behaviour of fix:is_contiguous_access_iterator for "checked" iterators.
  • limits: Fixed missing documentation for integral_limits.
  • memory: Fixed documentation for the to_bool fixes.
  • system_error: Fixed Doxygen marking for the category functions.
  • library:functional: Fixed missing connection of documentation for heterogeneous functors.
  • library:iterator: Added at_or() adapter.
  • library:tuple: Fixed missing Doxygen marking for tuple_pop, tuple_shift.
  • library:utility: Added valcmp (also in library:algorithm).
  • library:array_ref: Fixed constructors in accordance to n3334.
  • library:function_ref: Added support for 3, 4, 5-args functions.
  • library:typesafe_enum: Corrected default constructor as per [expr.type.conv] and https://stackoverflow.com/questions/53897991/enum-class-default-initialization .
  • tags: Added tags for new features in library:functional.
  • tags: Updated cxxomfort tags for new fix / assists.
  • tags: Removed references to CXXOMFORT_VERSION.
  • doc: Updated autogenerated documentation.
  • LICENSE: Now reflects year 2020.
This release marks the opening of (pre-)releases to be marked with the 'y2020' tag.
check-in: 4817fec6 user: luismachuca tags: trunk, gcc_min_404, msvc_min_1500, clang_min_303, release, y2020
Changes

Changes to cxxomfort/cxxomfort/config.hpp.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
125
126
127
128
129
130
131


132
133
134
135
136
137
138
139
140
...
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
 * @ingroup cxxomfort-config
 *
 * This file contains configuration macros used by the cxxomfort library
 * and it is not intended to be directly used.
 */

//! Library version and release date as YYYYMMDD
#define CXXOMFORT_DATE 20200113UL
//! Defines the library version 
//! @warning to be deprecated
#define CXXOMFORT_VERSION CXXOMFORT_DATE

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

................................................................................

/*
 * Set up more friendly messages
 */
    #if (CXXOMFORT_NOTICES > 1)

        #if 0


        #elif (CXXOMFORT_CXX_STD >= 2017)
            #pragma message CXXO_NOTICE("C++17 or newer mode") );
        #elif (CXXOMFORT_CXX_STD >= 2014)
            #pragma message CXXO_NOTICE("C++14 mode")
        #elif (CXXOMFORT_CXX_STD >= 2011)
            #pragma message CXXO_NOTICE("C++11 mode")
        #elif (CXXOMFORT_CXX_STD >=1997 && CXXOMFORT_CXX_STD < 2011)
            #pragma message CXXO_NOTICE("C++03 or basic mode")
        #else
................................................................................
//

#if (CXXOMFORT_CXX_STD < 2011)
    #define CXXOMFORT_CXX11_CODE(cxx11,none) none
    #define CXXOMFORT_CXX14_CODE(cxx14,none) none
    #define CXXOMFORT_CXX17_CODE(cxx17,none) none

#elif (CXXOMFORT_CXX_STD == 2011)
    #define CXXOMFORT_CXX11_CODE(cxx11,none) cxx11
    #define CXXOMFORT_CXX14_CODE(cxx14,none) none
    #define CXXOMFORT_CXX17_CODE(cxx17,none) none

#elif (CXXOMFORT_CXX_STD == 2014)
    #define CXXOMFORT_CXX11_CODE(cxx11,none) cxx11
    #define CXXOMFORT_CXX14_CODE(cxx14,none) cxx14
    #define CXXOMFORT_CXX17_CODE(cxx17,none) none

#elif (CXXOMFORT_CXX_STD >= 2017)
    #define CXXOMFORT_CXX11_CODE(cxx11,none) cxx11
    #define CXXOMFORT_CXX14_CODE(cxx14,none) cxx14
    #define CXXOMFORT_CXX17_CODE(cxx17,none) cxx17

#endif

//







|







 







>
>

|







 







|




|




|







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
...
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
 * @ingroup cxxomfort-config
 *
 * This file contains configuration macros used by the cxxomfort library
 * and it is not intended to be directly used.
 */

//! Library version and release date as YYYYMMDD
#define CXXOMFORT_DATE 20200204UL
//! Defines the library version 
//! @warning to be deprecated
#define CXXOMFORT_VERSION CXXOMFORT_DATE

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

................................................................................

/*
 * Set up more friendly messages
 */
    #if (CXXOMFORT_NOTICES > 1)

        #if 0
        #elif (CXXOMFORT_CXX_STD >= 2020)
			#pragma message CXXO_NOTICE("C++20 or newer") );
        #elif (CXXOMFORT_CXX_STD >= 2017)
            #pragma message CXXO_NOTICE("C++17") );
        #elif (CXXOMFORT_CXX_STD >= 2014)
            #pragma message CXXO_NOTICE("C++14 mode")
        #elif (CXXOMFORT_CXX_STD >= 2011)
            #pragma message CXXO_NOTICE("C++11 mode")
        #elif (CXXOMFORT_CXX_STD >=1997 && CXXOMFORT_CXX_STD < 2011)
            #pragma message CXXO_NOTICE("C++03 or basic mode")
        #else
................................................................................
//

#if (CXXOMFORT_CXX_STD < 2011)
    #define CXXOMFORT_CXX11_CODE(cxx11,none) none
    #define CXXOMFORT_CXX14_CODE(cxx14,none) none
    #define CXXOMFORT_CXX17_CODE(cxx17,none) none

#elif (CXXOMFORT_CXX_STD < 2014)
    #define CXXOMFORT_CXX11_CODE(cxx11,none) cxx11
    #define CXXOMFORT_CXX14_CODE(cxx14,none) none
    #define CXXOMFORT_CXX17_CODE(cxx17,none) none

#elif (CXXOMFORT_CXX_STD < 2017)
    #define CXXOMFORT_CXX11_CODE(cxx11,none) cxx11
    #define CXXOMFORT_CXX14_CODE(cxx14,none) cxx14
    #define CXXOMFORT_CXX17_CODE(cxx17,none) none

#elif (CXXOMFORT_CXX_STD < 2020)
    #define CXXOMFORT_CXX11_CODE(cxx11,none) cxx11
    #define CXXOMFORT_CXX14_CODE(cxx14,none) cxx14
    #define CXXOMFORT_CXX17_CODE(cxx17,none) cxx17

#endif

//

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

Changes to cxxomfort/cxxomfort/config/_pre.hpp.

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
    #error "This file should only be #included via <cxxomfort/config.hpp>"
#endif
#ifndef CXXOMFORT_CONFIG_PRE_HPP
#define CXXOMFORT_CONFIG_PRE_HPP

#define CXXO_NONE() 


#define CXXO_COMMA() ,

#define CXXO_STRINGIZE_IMPL(...) #__VA_ARGS__
//! Stringizes tokens (transforms them into a string literal)
#define CXXO_STRINGIZE(...) CXXO_STRINGIZE_IMPL(__VA_ARGS__)

#define CXXO_STRINGIZE1_IMPL2(x) #x
#define CXXO_STRINGIZE1_IMPL1(x) CXXO_STRINGIZE1_IMPL2(x)
//! Stringizes a token (transforms it into a string literal)
#define CXXO_STRINGIZE1(x) CXXO_STRINGIZE1_IMPL1(x)

#define CXXO_JOIN_IMPL2(x,y) x##y
#define CXXO_JOIN_IMPL1(x,y) CXXO_JOIN_IMPL2(x,y)
//! Joins tokens
#define CXXO_JOIN(x,y) CXXO_JOIN_IMPL1(x,y)

#define CXXOMFORT_ISOYEAR() ((__DATE__[7]-'0')*1000 + (__DATE__[8]-'0')*100 + (__DATE__[9]-'0')*10 + (__DATE__[10]-'0') )
#define CXXOMFORT_ISOMONTH() 0
#define CXXOMFORT_ISODAY() (( __DATE__[4]==' ' ?  0 : __DATE__[4]-'0')*10 + (__DATE__[5]-'0'))

#define CXXOMFORT_ISODATE() \
( \
CXXOMFORT_ISOYEAR() * 10000UL \
+ ( \
 ((__DATE__[0]=='J' ? \
 (__DATE__[1]=='a' ? 1 : (__DATE__[2]=='n' ? 6 : 7)   )\
 :0)) | \







>



|




|










>







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
    #error "This file should only be #included via <cxxomfort/config.hpp>"
#endif
#ifndef CXXOMFORT_CONFIG_PRE_HPP
#define CXXOMFORT_CONFIG_PRE_HPP

#define CXXO_NONE() 

//! Expands to a comma.
#define CXXO_COMMA() ,

#define CXXO_STRINGIZE_IMPL(...) #__VA_ARGS__
//! Stringizes all tokens (transforms them into a string literal)
#define CXXO_STRINGIZE(...) CXXO_STRINGIZE_IMPL(__VA_ARGS__)

#define CXXO_STRINGIZE1_IMPL2(x) #x
#define CXXO_STRINGIZE1_IMPL1(x) CXXO_STRINGIZE1_IMPL2(x)
//! Stringizes a single token (transforms it into a string literal)
#define CXXO_STRINGIZE1(x) CXXO_STRINGIZE1_IMPL1(x)

#define CXXO_JOIN_IMPL2(x,y) x##y
#define CXXO_JOIN_IMPL1(x,y) CXXO_JOIN_IMPL2(x,y)
//! Joins tokens
#define CXXO_JOIN(x,y) CXXO_JOIN_IMPL1(x,y)

#define CXXOMFORT_ISOYEAR() ((__DATE__[7]-'0')*1000 + (__DATE__[8]-'0')*100 + (__DATE__[9]-'0')*10 + (__DATE__[10]-'0') )
#define CXXOMFORT_ISOMONTH() 0
#define CXXOMFORT_ISODAY() (( __DATE__[4]==' ' ?  0 : __DATE__[4]-'0')*10 + (__DATE__[5]-'0'))
//! Expands to the current date as a number, in ISO 8601 <tt>YYYY-MM-DD</tt> format.
#define CXXOMFORT_ISODATE() \
( \
CXXOMFORT_ISOYEAR() * 10000UL \
+ ( \
 ((__DATE__[0]=='J' ? \
 (__DATE__[1]=='a' ? 1 : (__DATE__[2]=='n' ? 6 : 7)   )\
 :0)) | \

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

59
60
61
62
63
64
65


66
67
68
69
70
71
72
...
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
//! If compiler declares std::tr1::is_const<> et al.
#define CXXO_COMPILER_SUPPORT_tr1_type_traits 0
//! If compiler provides support for @c __typeof__ eg.: in C++03.
#define CXXO_COMPILER_SUPPORT_typeof 0
//! If compiler provides support for variadic macros (<code>__VA_ARG__</code>).
#define CXXO_COMPILER_SUPPORT_va_args 0



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

// c++11 stuff
................................................................................
 */

#if defined(DOXYGEN_DOC)

/**
 * @page cxxomfort-behaviour Configuration Macros
 * 
 * Listing of the various macros that change the behaviour of @a cxxomfort .
 * 
 * * @c @ref CXXOMFORT_NOTICES  - controls log level.
 * * @c @ref CXXOFLAG_INCLUDE_PATH  - sets an alternate <tt>#include</tt> path for Standard headers.
 * * @c @ref CXXOFLAG_NO_STD_USING  - disables adding names to namespace @c std .
 * 
 * */

/**
 * @ingroup cxxomfort-behaviour
 * @xrefitem cxxomfort-behaviour "Behaviour" ""
 * @{
 * */
#define CXXOFLAG_CXXHEADERS defined_if_using_cstd

/**
 * @brief Unsupported (!) macro for avoiding inserting names in <tt>namespace std</tt>.
 * @ingroup cxxomfort-behaviour
 * @xrefitem cxxomfort-behaviour "Behaviour Macro" "NO STD USING"










 * */
#define CXXOFLAG_NO_STD_USING defined_if_no_using_namespace_std_for_names
//! If defined, the keyword "constexpr" is defined away in c++03.







#define CXXOFLAG_SHADOW_KEYWORD_constexpr defined_if_constexpr_is_custom_keyword
//! if defined, the keyword "noexcept" is defined away in c++03.








#define CXXOFLAG_SHADOW_KEYWORD_noexcept defined_if_noexcept_is_custom_keyword
//! If defined, alternate filesystm path where to find C++ headers.
#define CXXOFLAG_INCLUDE_PATH includepath_to_system_includes

//! If defined, ????
#define CXXOFLAG_MAKE_CXXOSTD_TYPES_NATIVE 0
//! If defined, ????









#define CXXOFLAG_byte_IS_TYPEDEF 0

/**
 * @brief Makes the reserved names @c char16_t , @c char32_t available via typedefs or named types.
 * @ingroup cxxomfort-behaviour
 * @xrefitem cxxomfort-behaviour "Behaviour Macro" "TYPEDEF charn_t"



 * @note This flag is usually set by cxxomfort automatically.

 * */
#define CXXOFLAG_MAKE_TYPEDEF_charn_t 0


/**
 * @}
 * */
#endif

#endif







>
>







 







|

|

|





|



>

|


>
>
>
>
>
>
>
>
>
>


<
>
>
>
>
>
>
>

<
>
>
>
>
>
>
>
>



>
|

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




>
>
>

>










59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
...
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
373
374
//! If compiler declares std::tr1::is_const<> et al.
#define CXXO_COMPILER_SUPPORT_tr1_type_traits 0
//! If compiler provides support for @c __typeof__ eg.: in C++03.
#define CXXO_COMPILER_SUPPORT_typeof 0
//! If compiler provides support for variadic macros (<code>__VA_ARG__</code>).
#define CXXO_COMPILER_SUPPORT_va_args 0


#define CXXOFLAG_tr1 0
#define CXXO_STDTR1_OPEN() namespace std  {
#define CXXO_STDTR1_CLOSE()  }
#define CXXO_STDTR1_NAME() std
#define CXXOFLAG_directory_tr1 0
#define CXXOFLAG_namespace_tr1 0

// c++11 stuff
................................................................................
 */

#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 .
 * 
 * * @c @ref CXXOMFORT_NOTICES  - controls log level. Defined as a numeric value, larger values increase the level of verbosity.
 * * @c @ref CXXOFLAG_INCLUDE_PATH  - sets an alternate <tt>#include</tt> path for Standard headers.
 * * @c @ref CXXOFLAG_NO_STD_USING  - prevents cxxomfort from adding (most) names to namespace @c std .
 * 
 * */

/**
 * @ingroup cxxomfort-behaviour
 * @xrefitem cxxomfort-behaviour "Behaviour" "Behaviour Macros"
 * @{
 * */
#define CXXOFLAG_CXXHEADERS defined_if_using_cstd

/**
 * @brief Disables declaration of names in <tt>namespace std</tt>.
 * @ingroup cxxomfort-behaviour
 * @xrefitem cxxomfort-behaviour "Behaviour Macro" "NO STD USING"
 * 
 * If this macro is defined to a nonzero value when @p cxxomfort is included, the library won't add the names of the various backports from namespace <tt>cxxomfort::cxxostd</tt> to <tt>namespace std</tt>.
 * 
 * @note When using this macro, not all names are exempted from adding to <tt>namespace std</tt>. A few specific items, specifically things like <tt>nullptr_t</tt> which are defined in the cxxomfort core, will be added to std regardless.
 * 
 * @warning Usage of this macro is @b unsupported . The @e entire point of this library is adding to <tt>namspace std</tt> the names that are missing, and code within relies on some names having been added to the namespace for utilities that are dependencies of other: for example, most templated code will rely on such things as <tt>enable_if</tt> or the type traits being made present, as there is no <tt>using</tt>-like mechanism for template signatures. <br/>It is the responsibility of the user to make the needed names available somehow (eg.: from Boost or another source) if they use this configuration. 
 * 
 * @warning No bug reports will be taken where this macro is enabled.
 * 
 *  
 * */
#define CXXOFLAG_NO_STD_USING defined_if_no_using_namespace_std_for_names



/**
 * @brief Hides the keyword @c constexpr in C++03 mode.
 * @ingroup cxxomfort-behaviour
 * @xrefitem cxxomfort-behaviour "Behaviour Macro" "Text compatibility"
 */
#define CXXOFLAG_SHADOW_KEYWORD_constexpr defined_if_constexpr_is_custom_keyword

/**
 * @brief Hides the keyword @c noexcept(...) in C++03 mode.
 * @ingroup cxxomfort-behaviour
 * @xrefitem cxxomfort-behaviour "Behaviour Macro" "Text compatibility"
 * 
 * Note: This shadows the noexcept expression with arguments eg.: <tt>noexcept(true)</tt>; @b not "<tt>noexcept</tt>" alone.
 * 
 */
#define CXXOFLAG_SHADOW_KEYWORD_noexcept defined_if_noexcept_is_custom_keyword
//! If defined, alternate filesystm path where to find C++ headers.
#define CXXOFLAG_INCLUDE_PATH includepath_to_system_includes

// If defined, ????
#define CXXOFLAG_MAKE_CXXOSTD_TYPES_NATIVE 0


/**
 * @brief Makes the reserved name @c byte a typedef.
 * @ingroup cxxomfort-behaviour
 * @xrefitem cxxomfort-behaviour "Behaviour Macro" "TYPEDEF byte"
 * 
 * When pre- C++17 mode, if this macro is enabled, <tt><cxxomfort/cstddef.hpp></tt> will set up the name @c byte (<tt>std::byte</tt>) as a typedef to the type <tt>unsigned char</tt>, instead of using one of the backport / emulation mechanisms made available to cxxomfort.<br/>The resulting code is not necessarily supported (eg.: abiguous overloads).
 * 
 * */
#define CXXOFLAG_MAKE_TYPEDEF_byte 0

/**
 * @brief Makes the reserved names @c char16_t , @c char32_t available via typedefs or named types.
 * @ingroup cxxomfort-behaviour
 * @xrefitem cxxomfort-behaviour "Behaviour Macro" "TYPEDEF charn_t"
 * 
 * When in C++03 mode, if this macro is enabled, <tt><cxxomfort/cuchar.hpp></tt> will set up the names @c char16_t and @c char32_t as typedefs to @c uint16_t and @c uint32_t respectively, thus making them integral integer types, instead of declaring our own @c char16_t and @c char32_t types. <br/>The former also follows how the names are set up in eg.: GCC in C++0x (not C++11) mode.
 * 
 * @note This flag is usually set by cxxomfort automatically.
 * 
 * */
#define CXXOFLAG_MAKE_TYPEDEF_charn_t 0


/**
 * @}
 * */
#endif

#endif

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

117
118
119
120
121
122
123

124
125
126
127
128
129
130
131
132
133
134
...
327
328
329
330
331
332
333







334
335
336
337
338
339
340
341
342
343
344
#define CXXO_COMPILER_SUPPORT___alignof 1
#undef  CXXO_COMPILER_SUPPORT_typeof
#define CXXO_COMPILER_SUPPORT_typeof 1
#undef  CXXO_COMPILER_SUPPORT_va_args
#define CXXO_COMPILER_SUPPORT_va_args 1

// 

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

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

// set up TR1 headers
................................................................................
    #if (CXXOMFORT_CXX_STD>=2011)
        #undef  CXXO_COMPILER_SUPPORT_attribute_deprecated
        #define CXXO_COMPILER_SUPPORT_attribute_deprecated 1
    #endif
#endif

#if (CXXOMFORT_COMPILER_VERSION >= 600)







#endif

#if (CXXOMFORT_COMPILER_VERSION >= 700)
    #if (CXXOMFORT_CXX_STD>=2014)
        // these are present in the GCC7 libstdc++
        #undef  CXXO_COMPILER_SUPPORT_std_byte
        #define CXXO_COMPILER_SUPPORT_std_byte 1
        #undef  CXXO_COMPILER_SUPPORT_std_voidt
        #define CXXO_COMPILER_SUPPORT_std_voidt 1
    #endif
#endif







>
|


|







 







>
>
>
>
>
>
>



|







117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
...
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
#define CXXO_COMPILER_SUPPORT___alignof 1
#undef  CXXO_COMPILER_SUPPORT_typeof
#define CXXO_COMPILER_SUPPORT_typeof 1
#undef  CXXO_COMPILER_SUPPORT_va_args
#define CXXO_COMPILER_SUPPORT_va_args 1

// 
// GCC in C++03 mode includes TR1 support 
// and headers in all the versions we support, so far.
// 

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

// set up TR1 headers
................................................................................
    #if (CXXOMFORT_CXX_STD>=2011)
        #undef  CXXO_COMPILER_SUPPORT_attribute_deprecated
        #define CXXO_COMPILER_SUPPORT_attribute_deprecated 1
    #endif
#endif

#if (CXXOMFORT_COMPILER_VERSION >= 600)
	// GCC >= 6.1 reports C++17 emulation mode as __cplusplus==201500
	#if (__cplusplus == 201500 )
		#undef CXXOMFORT_CXX_EMULATION
		#define CXXOMFORT_CXX_EMULATION 2017
		#undef  CXXO_COMPILER_SUPPORT_std_voidt
		#define CXXO_COMPILER_SUPPORT_std_voidt 1
	#endif
#endif

#if (CXXOMFORT_COMPILER_VERSION >= 700)
    #if (CXXOMFORT_CXX_STD>=2015)
        // these are present in the GCC7 libstdc++
        #undef  CXXO_COMPILER_SUPPORT_std_byte
        #define CXXO_COMPILER_SUPPORT_std_byte 1
        #undef  CXXO_COMPILER_SUPPORT_std_voidt
        #define CXXO_COMPILER_SUPPORT_std_voidt 1
    #endif
#endif

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

61
62
63
64
65
66
67



68
69
70
71
72
73
74
..
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
..
99
100
101
102
103
104
105



106
107
108
109
110
111
112
...
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
...
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
...
206
207
208
209
210
211
212


213
214
215
216
217
218
219
#if (CXXOMFORT_COMPILER_VERSION <= 1200)
    #error "cxxomfort -- Detected an horribly broken compiler! (MSVC6 or earlier)"
#endif

/**
 * MSVC headers tend to be organized via a 
 * path like ${VISUAL_STUDIO}/VC/include



 */
#undef  CXXO_INCLUDE_SYS
#define CXXO_INCLUDE_SYS(NAME) <../../VC/include/NAME>
#if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1)
    #pragma message CXXO_NOTICE("Using Windows+MSC include paths: " ) 
    #pragma message CXXO_NOTICE( CXXO_STRINGIZE1(CXXO_INCLUDE_SYS(name)) ) 
#endif
................................................................................
    #define CXXO_COMPILER_SUPPORT_type_intrinsics 1
#endif

#if (CXXOMFORT_COMPILER_VERSION >= 1500) // VC 2008 or higher
    #if (_MSC_FULL_VER == 150030729) // SP1
		#undef  CXXOMFORT_CXX_EMULATION
		#define CXXOMFORT_CXX_EMULATION 2007
		#undef  CXXOFLAG_tr1
		#define CXXOFLAG_tr1 1

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




		#define CXXOFLAG_namespace_tr1 1
		#undef  CXXO_STDTR1_NAME
		#define CXXO_STDTR1_NAME() std::tr1
		#undef  CXXO_STDTR1_OPEN
		#define CXXO_STDTR1_OPEN() namespace std { namespace tr1 {
		#undef  CXXO_STDTR1_CLOSE
		#define CXXO_STDTR1_CLOSE() } }
................................................................................
    #undef  CXXO_COMPILER_SUPPORT_va_args
    #define CXXO_COMPILER_SUPPORT_va_args 1
    
#endif

// At least VC2010
#if (CXXOMFORT_COMPILER_VERSION >= 1600) // VC10 or higher
    #if (_MSC_FULL_VER == 160040219) // SP1
        #undef  CXXOMFORT_COMPILER_VERSION
        #define CXXOMFORT_COMPILER_VERSION 1601
    #endif
    #undef  CXXOMFORT_CXX_EMULATION
    #define CXXOMFORT_CXX_EMULATION 2011
    #undef  CXXO_COMPILER_SUPPORT__Pragma
    #define CXXO_COMPILER_SUPPORT__Pragma 1

    #undef  CXXO_CXXSTDHEADER_array
    #define CXXO_CXXSTDHEADER_array 1
................................................................................
    #undef  CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers
    #define CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers 1
    #undef  CXXO_COMPILER_SUPPORT_trailing_returns
    #define CXXO_COMPILER_SUPPORT_trailing_returns 1
    #undef  CXXO_COMPILER_SUPPORT_unique_ptr
    #define CXXO_COMPILER_SUPPORT_unique_ptr 1




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

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

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

    #undef  CXXO_CXXSTDHEADER_cstdint 
    #define CXXO_CXXSTDHEADER_cstdint 1
................................................................................
    #undef  CXXO_COMPILER_SUPPORT_std_common_type
    #define CXXO_COMPILER_SUPPORT_std_common_type 1
    #undef  CXXO_COMPILER_SUPPORT_std_is_trivially
    #define CXXO_COMPILER_SUPPORT_std_is_trivially 1
    #undef  CXXO_COMPILER_SUPPORT_std_is_constructible_traits
    #define CXXO_COMPILER_SUPPORT_std_is_constructible_traits 1
#endif



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








>
>
>







 







<
<







 







>
>
>







 







<
<
<
<







 







>
>
>
|

|

|

|




|







 







>
>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
..
85
86
87
88
89
90
91


92
93
94
95
96
97
98
...
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
...
122
123
124
125
126
127
128




129
130
131
132
133
134
135
...
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
...
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#if (CXXOMFORT_COMPILER_VERSION <= 1200)
    #error "cxxomfort -- Detected an horribly broken compiler! (MSVC6 or earlier)"
#endif

/**
 * MSVC headers tend to be organized via a 
 * path like ${VISUAL_STUDIO}/VC/include
 * 
 * TR1 headers live in the same directory as the normal ones, 
 * but features are in namespace std::tr1
 */
#undef  CXXO_INCLUDE_SYS
#define CXXO_INCLUDE_SYS(NAME) <../../VC/include/NAME>
#if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1)
    #pragma message CXXO_NOTICE("Using Windows+MSC include paths: " ) 
    #pragma message CXXO_NOTICE( CXXO_STRINGIZE1(CXXO_INCLUDE_SYS(name)) ) 
#endif
................................................................................
    #define CXXO_COMPILER_SUPPORT_type_intrinsics 1
#endif

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



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

		#undef  CXXOFLAG_tr1
		#define CXXOFLAG_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() } }
................................................................................
    #undef  CXXO_COMPILER_SUPPORT_va_args
    #define CXXO_COMPILER_SUPPORT_va_args 1
    
#endif

// At least VC2010
#if (CXXOMFORT_COMPILER_VERSION >= 1600) // VC10 or higher




    #undef  CXXOMFORT_CXX_EMULATION
    #define CXXOMFORT_CXX_EMULATION 2011
    #undef  CXXO_COMPILER_SUPPORT__Pragma
    #define CXXO_COMPILER_SUPPORT__Pragma 1

    #undef  CXXO_CXXSTDHEADER_array
    #define CXXO_CXXSTDHEADER_array 1
................................................................................
    #undef  CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers
    #define CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers 1
    #undef  CXXO_COMPILER_SUPPORT_trailing_returns
    #define CXXO_COMPILER_SUPPORT_trailing_returns 1
    #undef  CXXO_COMPILER_SUPPORT_unique_ptr
    #define CXXO_COMPILER_SUPPORT_unique_ptr 1

	#undef  CXXOFLAG_tr1
	#define CXXOFLAG_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

// -- TODO -- get my claws on a MSVC 2012 / 2013 for actual testing
// -- done in 2019

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

    #undef  CXXO_CXXSTDHEADER_cstdint 
    #define CXXO_CXXSTDHEADER_cstdint 1
................................................................................
    #undef  CXXO_COMPILER_SUPPORT_std_common_type
    #define CXXO_COMPILER_SUPPORT_std_common_type 1
    #undef  CXXO_COMPILER_SUPPORT_std_is_trivially
    #define CXXO_COMPILER_SUPPORT_std_is_trivially 1
    #undef  CXXO_COMPILER_SUPPORT_std_is_constructible_traits
    #define CXXO_COMPILER_SUPPORT_std_is_constructible_traits 1
#endif

// -- NEW TODO -- get my claws on the MSVC 2013 and CTP

// At least VC2013
#if (CXXOMFORT_COMPILER_VERSION >= 1800) 
	#undef  CXXO_COMPILER_SUPPORT_functional_transparent
	#define CXXO_COMPILER_SUPPORT_functional_transparent 1
#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
..
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
#ifndef CXXOMFORT_CSTDDEF_HPP
#define CXXOMFORT_CSTDDEF_HPP
/**
 * @file


 *
 */

#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
 * @xrefitem std0cstddef "" "max_align_t"
................................................................................
	#if (CXXOMFORT_CXX_STD>=1997)
	#endif

#endif

/**
 * @page std0cstddef <cstddef>
 * @brief Features related to Standard header <code><cstddef></code>.
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 * 
 * Features included in this section:
 * 
 * * @c #nullptr, @ref nullptr_t (C++11)
 * * @c max_align_t (C++11)
 * 
 * Features also without a specific header:
 * 
 * * @ref @c static_assert (C++11)
 * * <code>@ref byte</code> , @c to_integral() (C++17)
 * 
 * See also: @ref std0cstdio <cstdio> , @ref std0cstdint <cstdint> 
 * See also: @ref cxxomfort-base , 
 * <a href="https://en.cppreference.com/w/cpp/header/cstddef">\<cstddef\> \@cppreference</a>.
 * 
 * Non-backport features:
 * 
 * * @c NULL_t - type of the value of @c NULL .

 * 
 * 
 * **/




>
>
|






>
>
>
>
>
>
>
>
>
>
>







 







|










|





|


>



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
..
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
#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
 * @xrefitem std0cstddef "" "max_align_t"
................................................................................
	#if (CXXOMFORT_CXX_STD>=1997)
	#endif

#endif

/**
 * @page std0cstddef <cstddef>
 * @brief Features related to Standard header <tt><cstddef></tt>.
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 * 
 * Features included in this section:
 * 
 * * @c #nullptr, @ref nullptr_t (C++11)
 * * @c max_align_t (C++11)
 * 
 * Features also without a specific header:
 * 
 * * @ref @c static_assert (C++11)
 * * @link cxxomfort::cxxostd::byte @c byte @endlink , @c to_integral() (C++17)
 * 
 * See also: @ref std0cstdio <cstdio> , @ref std0cstdint <cstdint> 
 * See also: @ref cxxomfort-base , 
 * <a href="https://en.cppreference.com/w/cpp/header/cstddef">\<cstddef\> \@cppreference</a>.
 * 
 * Non-backport features (<tt>cxxomfort::fix</tt>):
 * 
 * * @c NULL_t - type of the value of @c NULL .
 * * @c to_byte() - obtain a <tt>byte</tt> value for a given integral.
 * 
 * 
 * **/

Changes to cxxomfort/cxxomfort/ctime.hpp.

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

#if (CXXOMFORT_CXX_STD >= 2017)

#elif (CXXOMFORT_CXX_STD >= 1997)

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



















	#if !defined(_POSIX_VERSION)

namespace cxxomfort { namespace cxxostd {







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

		#if !defined(TIME_UTC)
		#define TIME_UTC 0












		#endif









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

} }





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

	#endif // _POSIX_VERSION

#endif

#endif

/**
 * @page std0ctime <ctime>
 * @brief Backports from @c <ctime> 
 * 





 * Interfaces defined in this section:
 * 
 * * @c timespec_get() - obtain current time information for a system clock.
 * * @c timespec - information datatype for @c timespec_get .
 * 

 *

 *
 * @section also See Also
 * 
 * @see @cppref{header/ctime} (cppreference) 
 * 
 * */








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


>
>
>

>
>
>
|
|
|
|

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

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

<
>
>
>
>






<

|





|

>
>
>
>
>





>
|
>
|






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

#if (CXXOMFORT_CXX_STD >= 2017)

#elif (CXXOMFORT_CXX_STD >= 1997)

	#include <time.h>
	// we look for CLOCK_REALTIME to use http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html
	#if defined(__unix__)
		#include <unistd.h>
		#include <time.h>
	#elif defined(_WIN32)
		#include <winsock2.h>
		#include <MAPIWin.h>
	#else
	#endif
	

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

	
/*
 * if in POSIX, we can just use their functions
 * when on Windows, we sandwich
 * */
	#if defined(_POSIX_VERSION)

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

	#elif defined(_WIN32)
namespace cxxomfort { namespace cxxostd {

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



	inline 
	int timespec_get ( struct timespec* ts, int base ) {
		(void)base;
		ts->tv_sec = time(0);
		SYSTEMTIME st;
		GetSystemTime(&st);
		ts->tv_nsec= st.wMilliseconds ; //static_cast<long>(st.wMilliseconds)*1000UL;
		return 0;
	}

} } // cxxomfort::cxxostd

	#else

namespace cxxomfort { namespace cxxostd {

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

	inline 
	int timespec_get ( struct timespec* ts, int base ) {
		(void)base;



		ts->tv_sec = time(0);
		ts->tv_nsec= 0 ; //static_cast<long>(st.wMilliseconds)*1000UL;

		return 0;
	}


} } // cxxomfort::cxxostd

	#endif // posix? windows? foo?


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



#endif // cxx_std

#endif

/**
 * @page std0ctime <ctime>
 * @brief Backports related to Standard header <tt><ctime></tt>
 * 
 * @code
 * #include <cxxomfort/ctime.hpp>
 * @endcode
 * 
 * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>)
 * Interfaces defined in this section:
 * 
 * * @c timespec_get() - obtain current time information for a system clock.
 * * @c timespec - information datatype for @c timespec_get .
 * 
 * Non-backport interfaces:
 * 
 * * (none)
 * 
 * @section also See Also
 * 
 * @see @cppref{header/ctime} (cppreference) 
 * 
 * */

Changes to cxxomfort/cxxomfort/cxxomfort.hpp.

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
 * <table><tr>
 *  <th>Library</th>
 *  <td align="center"> @subpage cxxomfort-behaviour "Behaviour Macros" - @subpage cxxomfort-codegen "Code Generation" 
 *  </td>
 * </tr><tr>
 *  <th>Basic features</th>
 *  <td align="center"> @subpage cxxomfort-base "Base Features (automatically included)" <br/>
 * <code>#include <cxxomfort/base.hpp></code><br/>
 *  @c @ref nullptr , @c @ref static_assert , @c @ref explicit_cast , @c move / rvalue-reference emulation , iterator accessors , alignof
 *  </td>
 * </tr><tr>
 *  <th rowspan="2">Backports & Standard&nbsp;C++</th>
 *  <td align="center"> *  <strong>Backports</strong> 
 *  <tt>#include <cxxomfort/backports.hpp></tt><br/>
 *  @subpage cxx03-backports "C++03" -- @subpage cxx11-backports "C++11" --  @subpage cxx14-backports "C++14" -- @subpage cxx17-backports "C++17" --  @subpage cxx20-backports "C++20?"
 *  </td>
 *  </tr><tr><td align="center">
 * @subpage std0cstddef "<cstddef>" - @subpage std0cstdint "<cstdint>" - <cstdio> - @subpage std0ctime "<ctime>" - @subpage std0cuchar "<cuchar>" 
 <br/> @subpage std0algorithm "<algorithm>" - @subpage std0functional "<functional>" -  @subpage std0iterator "<iterator>" - @subpage std0numeric "<numeric>" - @subpage std0string "<string>" - @subpage std0string_view "<string_view>" 
 <br/> @subpage std0limits "<limits>" - @subpage std0memory "<memory>" - @subpage std0tuple "<tuple>" - @subpage std0utility "<utility>" 
 <br/> @subpage std0type_traits "<type_traits>" - @subpage std0typeindex "<typeindex>" 
 <br/> @subpage std0array "<array>" - @subpage std0forward_list "<forward_list>" 
 <br/> @subpage std0random "<random>" - @subpage std0system_error "<system_error>"
 * <br/>  @subpage transparent-headers "Transparent Headers" -- @subpage cxxomfort-fix "Fixes to implementation issues"
 * </td>
 *  </tr>
 * </tr><tr>
 *  <th rowspan="2">Supplements</th>
 * <td align="center">
 *  @subpage cxxo-sup "Library Supplements" -- @cxxowiki{Supplements,repo}</a> 
 *  <br/> <tt>#include <cxxomfort/library.hpp></tt>
 *  <br/>
 * @ref cxxo-foreach "@c foreach emulation" -- typesafe @c enums -- strong types -- @link cxxo-i12n @c i12n (initialization) @endlink 
 * <br/>
 * @c @ref array_ref -- @c @ref fixed_vector -- @c @ref mstack 
 * <br/>
 * Supplementals for Standard C++ Headers
 * </td></tr>
 * <tr><td style="text-align:center;">  @cxxowiki{Extras,Extra Projects}</a>
 * </td></tr>
 * </table>
 * 







|
|




|





|










|



|







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
 * <table><tr>
 *  <th>Library</th>
 *  <td align="center"> @subpage cxxomfort-behaviour "Behaviour Macros" - @subpage cxxomfort-codegen "Code Generation" 
 *  </td>
 * </tr><tr>
 *  <th>Basic features</th>
 *  <td align="center"> @subpage cxxomfort-base "Base Features (automatically included)" <br/>
 * <tt>\#include <cxxomfort/base.hpp></tt><br/>
 *  <tt> @ref nullptr </tt>, <tt> @ref static_assert </tt> , <tt> @ref explicit_cast </tt> , @c move / rvalue-reference emulation , iterator accessors , @ref @c alignof
 *  </td>
 * </tr><tr>
 *  <th rowspan="2">Backports & Standard&nbsp;C++</th>
 *  <td align="center"> *  <strong>Backports</strong> 
 *  <tt>\#include <cxxomfort/backports.hpp></tt><br/>
 *  @subpage cxx03-backports "C++03" -- @subpage cxx11-backports "C++11" --  @subpage cxx14-backports "C++14" -- @subpage cxx17-backports "C++17" --  @subpage cxx20-backports "C++20?"
 *  </td>
 *  </tr><tr><td align="center">
 * @subpage std0cstddef "<cstddef>" - @subpage std0cstdint "<cstdint>" - <cstdio> - @subpage std0ctime "<ctime>" - @subpage std0cuchar "<cuchar>" 
 <br/> @subpage std0algorithm "<algorithm>" - @subpage std0functional "<functional>" -  @subpage std0iterator "<iterator>" - @subpage std0numeric "<numeric>" - @subpage std0string "<string>" - @subpage std0string_view "<string_view>" 
 <br/> @subpage std0ios "<ios>" - @subpage std0limits "<limits>" - @subpage std0memory "<memory>" - @subpage std0tuple "<tuple>" - @subpage std0utility "<utility>" 
 <br/> @subpage std0type_traits "<type_traits>" - @subpage std0typeindex "<typeindex>" 
 <br/> @subpage std0array "<array>" - @subpage std0forward_list "<forward_list>" 
 <br/> @subpage std0random "<random>" - @subpage std0system_error "<system_error>"
 * <br/>  @subpage transparent-headers "Transparent Headers" -- @subpage cxxomfort-fix "Fixes to implementation issues"
 * </td>
 *  </tr>
 * </tr><tr>
 *  <th rowspan="2">Supplements</th>
 * <td align="center">
 *  @subpage cxxo-sup "Library Supplements" -- @cxxowiki{Supplements,repo}</a> 
 *  <br/> <tt>\#include <cxxomfort/library.hpp></tt>
 *  <br/>
 * @ref cxxo-foreach "@c foreach emulation" -- typesafe @c enums -- strong types -- @link cxxo-i12n @c i12n (initialization) @endlink 
 * <br/>
 * @ref @c array_ref -- @ref @c fixed_vector -- @ref @c mstack 
 * <br/>
 * Supplementals for Standard C++ Headers
 * </td></tr>
 * <tr><td style="text-align:center;">  @cxxowiki{Extras,Extra Projects}</a>
 * </td></tr>
 * </table>
 * 

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

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

} //~namespace cxxostd
} //~namespace cxxomfort


#if (CXXOMFORT_CXX_STD >= 2011)
#elif (CXXOMFORT_CXX_EMULATION==0)























namespace std {

    //! using to_string (backport to c++03)
    using ::cxxomfort::cxxostd::to_string;

    using ::cxxomfort::cxxostd::stoul;
    using ::cxxomfort::cxxostd::stol;
    using ::cxxomfort::cxxostd::stoull;
    using ::cxxomfort::cxxostd::stoll;
}
#elif (CXXOMFORT_CXX_EMULATION>0)
namespace std {
    // GCC already brings those names
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC)
    // MSC brings some of them
    #elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)
        #if (CXXOMFORT_COMPILER_VERSION==1600)
        // MSVC 2010 has failing overloads for to_string
            #if (CXXOMFORT_NOTICES > 2)
                #pragma message CXXO_NOTICE("adding missing overloads to to_string")
            #endif
        using ::cxxomfort::cxxostd::to_string;
    // MSVC 2010 already has stol, stoul, but lacks the long long versions
        #elif (CXXOMFORT_COMPILER_VERSION < 160)
        using ::cxxomfort::cxxostd::stol;
        using ::cxxomfort::cxxostd::stoul;
        using ::cxxomfort::cxxostd::to_string;
        #endif
    using ::cxxomfort::cxxostd::stoll;
    using ::cxxomfort::cxxostd::stoull;
    #endif
}
#endif // (c++11)

#endif







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



|






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



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

} //~namespace cxxostd
} //~namespace cxxomfort


#if (CXXOMFORT_CXX_STD >= 2011)
#elif (CXXOMFORT_CXX_EMULATION >= 2011)
	//#pragma message ("to_string emulation")

    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC)
		// GCC already brings the names
    #elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)
		// MSC brings some of them
        #if (CXXOMFORT_COMPILER_VERSION==1600)
        // MSVC 2010 has failing overloads for to_string
            #if (CXXOMFORT_NOTICES > 2)
                #pragma message CXXO_NOTICE("string: adding missing to_string() overloads")
            #endif
        using ::cxxomfort::cxxostd::to_string;
		// MSVC 2010 already has stol, stoul, but lacks the long long versions
        #elif (CXXOMFORT_COMPILER_VERSION < 1600)
        using ::cxxomfort::cxxostd::stol;
        using ::cxxomfort::cxxostd::stoul;
        using ::cxxomfort::cxxostd::to_string;
        #endif
	
	#endif

#elif (CXXOMFORT_CXX_EMULATION >= 0) // eg.: 2007, TR1
	//#pragma message ("to_string emulation 0")
namespace std {

    //! using to_string (backport to c++03)
    using cxxomfort::cxxostd::to_string;

    using ::cxxomfort::cxxostd::stoul;
    using ::cxxomfort::cxxostd::stol;
    using ::cxxomfort::cxxostd::stoull;
    using ::cxxomfort::cxxostd::stoll;
}






















#endif // (c++11)

#endif

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

2
3
4
5
6
7
8

9
10
11
12
13
14
15
#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 <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 cxxomfort {







>







2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#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 cxxomfort {

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

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
..
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
#define CXXOMFORT_IMPL_MAKE_UNIQUE_HPP
/**
 * @file
 */
#include "../base.hpp"
//#include "../impl/unique_ptr.hpp"




#define CXXOMFORT_IMPLEMENTS_n3588 CXXO_IMPLSTATUS_BACKPORT()

#define CXXOMFORT_IMPLEMENTS_make_unique CXXOMFORT_IMPLEMENTS_n3588


// this is included after unique_ptr

// Add make_unique
// equivalent to return std::std::unique_ptr<T>(new T(std::forward<Args>(args)...));


namespace cxxomfort { namespace cxxostd {

#if (CXXOMFORT_CXX_STD == 2011)

template <typename T, typename ...Args> inline
std::unique_ptr<T> make_unique (Args&&... args) {
    return std::unique_ptr<T>( new T(std::forward<Args>(args)... ) );
}

#elif (CXXOMFORT_CXX_STD < 2011)

template <typename T> inline
std::unique_ptr<T> make_unique () {
    return std::unique_ptr<T> (new T());
}
template <typename T, typename A1> inline
std::unique_ptr<T> make_unique (CXXO_FWD_REF(A1) a1) {
    return std::unique_ptr<T> (new T( std::forward<A1>(a1) ));
................................................................................
template <typename T, typename A1, typename A2, typename A3, typename A4, typename A5> inline
std::unique_ptr<T> make_unique (CXXO_FWD_REF(A1) a1, CXXO_FWD_REF(A2) a2, CXXO_FWD_REF(A3) a3, CXXO_FWD_REF(A4) a4, CXXO_FWD_REF(A5) a5) {
    return std::unique_ptr<T> (new T(
      std::forward<A1>(a1), std::forward<A2>(a2), std::forward<A3>(a3), 
      std::forward<A4>(a4), std::forward<A5>(a5) ));
}

#endif

} } // cxxomfort::cxxostd

#if (CXXOMFORT_CXX_STD < 2014 && CXXOMFORT_CXX_EMULATION < 2014)
namespace std {
    using cxxomfort::cxxostd::make_unique;
}






#endif






#ifdef DOXYGEN_DOC
namespace std {

/**
 * @fn make_unique
 * @brief Creates a unique_ptr holding a constructed object
 */
}

#endif

#endif








>
>
>
|
>



<

<
<
>

|

|






|
>







 







|
>
|

<

|

>
>
>
>
>
>


>
>
>
>
>













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
..
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
#define CXXOMFORT_IMPL_MAKE_UNIQUE_HPP
/**
 * @file
 */
#include "../base.hpp"
//#include "../impl/unique_ptr.hpp"

#if (CXXOMFORT_CXX_STD >= 2014)
	#define CXXOMFORT_IMPLEMENTS_n3588 CXXO_IMPLSTATUS_NATIVE()
#else
	#define CXXOMFORT_IMPLEMENTS_n3588 CXXO_IMPLSTATUS_BACKPORT()
#endif
#define CXXOMFORT_IMPLEMENTS_make_unique CXXOMFORT_IMPLEMENTS_n3588






#if (CXXOMFORT_IMPLEMENTS_n3588==CXXO_IMPLSTATUS_BACKPORT())

namespace cxxomfort { namespace cxxostd { 

	#if (CXXOMFORT_CXX_STD >= 2011)

template <typename T, typename ...Args> inline
std::unique_ptr<T> make_unique (Args&&... args) {
    return std::unique_ptr<T>( new T(std::forward<Args>(args)... ) );
}

	#else

template <typename T> inline
std::unique_ptr<T> make_unique () {
    return std::unique_ptr<T> (new T());
}
template <typename T, typename A1> inline
std::unique_ptr<T> make_unique (CXXO_FWD_REF(A1) a1) {
    return std::unique_ptr<T> (new T( std::forward<A1>(a1) ));
................................................................................
template <typename T, typename A1, typename A2, typename A3, typename A4, typename A5> inline
std::unique_ptr<T> make_unique (CXXO_FWD_REF(A1) a1, CXXO_FWD_REF(A2) a2, CXXO_FWD_REF(A3) a3, CXXO_FWD_REF(A4) a4, CXXO_FWD_REF(A5) a5) {
    return std::unique_ptr<T> (new T(
      std::forward<A1>(a1), std::forward<A2>(a2), std::forward<A3>(a3), 
      std::forward<A4>(a4), std::forward<A5>(a5) ));
}

	#endif

} }  // cxxomfort::cxxostd


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

#else // c++14

namespace cxxomfort { namespace cxxostd {
	using std::make_unique;
} } 
#endif

// this is included after unique_ptr

// Add make_unique
// equivalent to return std::std::unique_ptr<T>(new T(std::forward<Args>(args)...));

#ifdef DOXYGEN_DOC
namespace std {

/**
 * @fn make_unique
 * @brief Creates a unique_ptr holding a constructed object
 */
}

#endif

#endif

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

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
..
76
77
78
79
80
81
82



83














84
85
86
87
88
89
90
..
98
99
100
101
102
103
104


105
106
107

108
109
110
111
112
113
114
...
160
161
162
163
164
165
166
167
168
 * Interfaces defined in this header:
 * 
 * * std::get <T> (std::tuple<...>)
 * 
 */

#include <cxxomfort/base.hpp>
#define CXXOMFORT_IMPLEMENTS_n3584 CXXO_IMPLSTATUS_EMULATION()
#define CXXOMFORT_IMPLEMENTS_n3670 CXXO_IMPLSTATUS_EMULATION()
#define CXXOMFORT_IMPLEMENTS_tuple_get_type CXXOMFORT_IMPLEMENTS_n3584


#include <type_traits>
#include <tuple>
#include <cxxomfort/impl/tuplemeta.hpp> // is_tuple, tuple_index

#if (defined(CXXOMFORT_NOTICES))
    #if (CXXOMFORT_NOTICES > 1)
    #pragma message CXXO_NOTICE("enabled tuple get<type> implementation")
    #endif
#endif


// This probably has to go in namespace std
// because otherwise we can get a "already using" error instead of an overload

namespace std {











namespace {
    using cxxomfort::impl::is_tuple;
    using cxxomfort::impl::tuple_index;
} // anonymous was here

#if (CXXOMFORT_CXX_STD >= 2014 || CXXOMFORT_CXX_EMULATION == 2014)
    // already available, do nothing
#elif (CXXOMFORT_CXX_STD == 2011 || (CXXO_COMPILER_SUPPORT_variadic && CXXO_COMPILER_SUPPORT_rvref) )



// three overloads as per cppreference

/**
 * @brief Return a member of a tuple given its type as a template argument.
 * @ingroup cxx14-backports
 */
................................................................................
, typename = std::enable_if< tuple_index<C,std::tuple<Targs...> >::value != -1> 
>
C& get (std::tuple<Targs...> & t) CXXO_NOEXCEPT {
    enum { N = tuple_index<C, std::tuple<Targs...> >::value };
    return (get<N>(t));
}




#else














// at this point, c++03
//! Return a member from a tuple given its type.
template <typename C, typename Tuple>
typename std::enable_if< is_tuple<Tuple>::value ,
    typename std::tuple_element< tuple_index<C,Tuple>::value, Tuple>::type
>::type
const& get (Tuple const& t) {
................................................................................
    typename std::tuple_element< tuple_index<C,Tuple>::value, Tuple>::type&
>::type
get (Tuple& t) {
    enum { N = tuple_index<C,Tuple>::value }; 
    return get<N>(t);
}



#endif
}



// Implement interface for std::pair

/*
namespace std {

template <typename C, typename T2>
................................................................................
template <typename T, typename... TupleArgs>
T const& get (std::tuple<TupleArgs...> const&) {}

} } // cxxomfort::cxxostd
#endif

#endif // 









<
<
<
<
<
<
<
<











|
>
>
>
>

>
>
>
>
>
>

|
|
<
|
<
<
<

>







 







>
>
>

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







 







>
>

|
<
>







 







<
<
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
..
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
...
114
115
116
117
118
119
120
121
122
123
124

125
126
127
128
129
130
131
132
...
178
179
180
181
182
183
184


 * Interfaces defined in this header:
 * 
 * * std::get <T> (std::tuple<...>)
 * 
 */

#include <cxxomfort/base.hpp>









#if (defined(CXXOMFORT_NOTICES))
    #if (CXXOMFORT_NOTICES > 1)
    #pragma message CXXO_NOTICE("enabled tuple get<type> implementation")
    #endif
#endif


// This probably has to go in namespace std
// because otherwise we can get a "already using" error instead of an overload

#if (CXXOMFORT_CXX_STD >= 2014 || CXXOMFORT_CXX_EMULATION >= 2014)
    // already available, do nothing
	#define CXXOMFORT_IMPLEMENTS_n3584 CXXO_IMPLSTATUS_NATIVE()
	#define CXXOMFORT_IMPLEMENTS_n3670 CXXO_IMPLSTATUS_NATIVE()
#elif (CXXOMFORT_CXX_STD >= 2011 || (CXXO_COMPILER_SUPPORT_variadic && CXXO_COMPILER_SUPPORT_rvref) )

	#define CXXOMFORT_IMPLEMENTS_n3584 CXXO_IMPLSTATUS_BACKPORT()
	#define CXXOMFORT_IMPLEMENTS_n3670 CXXO_IMPLSTATUS_BACKPORT()

	#include <utility>
	#include <cxxomfort/impl/tuplemeta.hpp> // is_tuple, tuple_index

namespace {
	using cxxomfort::impl::is_tuple;
	using cxxomfort::impl::tuple_index;

}




namespace std {

// three overloads as per cppreference

/**
 * @brief Return a member of a tuple given its type as a template argument.
 * @ingroup cxx14-backports
 */
................................................................................
, typename = std::enable_if< tuple_index<C,std::tuple<Targs...> >::value != -1> 
>
C& get (std::tuple<Targs...> & t) CXXO_NOEXCEPT {
    enum { N = tuple_index<C, std::tuple<Targs...> >::value };
    return (get<N>(t));
}


} // std

#else

	#define CXXOMFORT_IMPLEMENTS_n3584 CXXO_IMPLSTATUS_EMULATION()
	#define CXXOMFORT_IMPLEMENTS_n3670 CXXO_IMPLSTATUS_EMULATION()

	#include <cxxomfort/tuple.hpp>
	#include <cxxomfort/impl/tuplemeta.hpp> // is_tuple, tuple_index

namespace {
	using cxxomfort::impl::is_tuple;
	using cxxomfort::impl::tuple_index;
}

namespace std {

// at this point, c++03
//! Return a member from a tuple given its type.
template <typename C, typename Tuple>
typename std::enable_if< is_tuple<Tuple>::value ,
    typename std::tuple_element< tuple_index<C,Tuple>::value, Tuple>::type
>::type
const& get (Tuple const& t) {
................................................................................
    typename std::tuple_element< tuple_index<C,Tuple>::value, Tuple>::type&
>::type
get (Tuple& t) {
    enum { N = tuple_index<C,Tuple>::value }; 
    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>
................................................................................
template <typename T, typename... TupleArgs>
T const& get (std::tuple<TupleArgs...> const&) {}

} } // cxxomfort::cxxostd
#endif

#endif // 


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

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
..
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
...
168
169
170
171
172
173
174

175


176
177
178
179
180
181
182
183
184
185
186
...
189
190
191
192
193
194
195

196
197
198
199
200
201
202
...
215
216
217
218
219
220
221

222
223
224
225
226

227
228
229
230
231

232
233
234
235
236

237
238
239
240
241

242
243
244
245
246

247
248
249
250
251
252
253
254
255
256

257
258
259
260
261

262
263
264
265
266
267
268
...
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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
...
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
...
369
370
371
372
373
374
375
376

377
378
379
380
381
382
383
384


385
386
387
388
389
390
 * 
 */

#include <cxxomfort/base.hpp>
#include <cxxomfort/util/type_traits.hpp>
#include <cstring>

//
// new impl 
//

#if (CXXOMFORT_CXX_STD>=2017 || CXXO_COMPILER_SUPPORT_std_byte)

	#define CXXOMFORT_IMPLEMENTS_p0298r3 CXXO_IMPLSTATUS_NATIVE()

namespace cxxomfort { namespace cxxostd { 
	using std::byte;
	using std::to_integer;




template <typename I, typename = typename std::enable_if<std::is_integral<I>::value>::type >
constexpr byte 
to_byte (I i) noexcept {
	return byte{i};
}
	
} }  // cxxomfort::cxxostd

#elif (CXXOMFORT_CXX_STD>=2011)
	#define CXXOMFORT_IMPLEMENTS_p0298r3 CXXO_IMPLSTATUS_BACKPORT()

namespace cxxomfort { namespace cxxostd {

enum class byte : unsigned char {};
................................................................................

template <typename I, typename = typename std::enable_if<std::is_integral<I>::value>::type >
CXXO_CONSTEXPR  inline 
I to_integer (byte b) noexcept {
	return I(b);
}





template <typename I, typename = typename std::enable_if<std::is_integral<I>::value>::type >
CXXO_CONSTEXPR  inline 
byte to_byte (I i) noexcept {
	return static_cast<byte>(i);
}


} } // cxxomfort::cxxostd

#elif (CXXOMFORT_CXX_STD>=1997) \
	&& (CXXO_COMPILER_SUPPORT_explicit_operator)
	// if the compiler at least supports explicit conversion operators, 
	// we can implement std::byte using the typesafe_enum pattern.

	#define CXXOMFORT_IMPLEMENTS_p0298r3 CXXO_IMPLSTATUS_EMULATION()

#include "typesafe_enum-core.hpp"

................................................................................
namespace detail {

	struct mybyte_def { enum type {};  };
	typedef cxxomfort::impl::typesafe_enum<mybyte_def,unsigned char> byteimpl;

}


struct byte 
//: private detail::byteimpl 
{

    private:
    typedef detail::byteimpl impl_t;

    public:

    //CXXO_DEFAULT_DEFAULT_CONSTRUCTOR(byte);
    
    //byte (byte const& by) CXXO_NOEXCEPTNOTHROW 
    //: impl_t(by) {}
    
    //using detail::byteimpl::CXXO_EXPLICIT_OPERATOR(unsigned char);
    
    CXXO_EXPLICIT_OPERATOR(unsigned char) () const CXXO_NOEXCEPTNOTHROW {
		return explicit_cast<unsigned char>(impl);
	}
    
    private:
    impl_t impl;

};


template <typename Integral>
Integral to_integer (byte b) CXXO_NOEXCEPTNOTHROW {
	using namespace std;
	static_assert (is_integral<Integral>::value, "to_integer");
	return explicit_cast<unsigned char>(b);
}





template <typename Integral>
byte to_byte (Integral i) CXXO_NOEXCEPTNOTHROW {
	using namespace std;
	byte b;
	(unsigned char&)(b) = static_cast<unsigned char>(i);
	return b;
}

} }  // cxxomfort::cxxostd



#else 


	// implement using a simple struct
	#define CXXOMFORT_IMPLEMENTS_p0298r3 3001

namespace cxxomfort { namespace cxxostd {

#pragma pack(push,1)
struct byte {
	public:
	//CXXO_DEFAULT_DEFAULT_CONSTRUCTOR(byte);
	//CXXO_DEFAULT_COPY_CONSTRUCTOR(byte,  CXXO_NOEXCEPTNOTHROW
	//, v(From.v) 
	//);
	
	CXXO_EXPLICIT_OPERATOR(unsigned char) () const CXXO_NOEXCEPTNOTHROW {
		return v;
	}

	private:
	unsigned char v;
................................................................................
	using namespace std;
	return explicit_cast<unsigned char>(b);
	//I i= 0;
	//memcpy(&i, &b, 1);
	//return i;
}





template <typename I>
byte to_byte (I i) CXXO_NOEXCEPTNOTHROW {
	using namespace std;
	byte b;
	unsigned char c= static_cast<unsigned char>(i);
	memcpy(&b, &c, 1);
	return b;
}


} } // cxxomfort::cxxostd
................................................................................
#endif

	#define CXXOMFORT_IMPLEMENTS_byte CXXOMFORT_IMPLEMENTS_p0298r3

// 
// internal checks 
// 

namespace cxxomfort { namespace cxxostd {

static_assert(sizeof(byte) == sizeof(char), "byte: sizeof check");
static_assert (cxxomfort::traits::is_integral<byte>::value==false, "byte: separate-type check");

} }

................................................................................
bool operator!= (byte b1, byte b2) CXXO_NOEXCEPTNOTHROW {
	return to_integer<unsigned>(b1) != to_integer<unsigned>(b2);
}


CXXO_CONSTEXPR static inline 
byte operator& (byte b1, byte b2) CXXO_NOEXCEPTNOTHROW {

	return to_byte( to_integer<unsigned>(b1) & to_integer<unsigned>(b2) );
}

CXXO_CONSTEXPR static inline 
byte operator| (byte b1, byte b2) CXXO_NOEXCEPTNOTHROW {

	return to_byte( to_integer<unsigned>(b1) | to_integer<unsigned>(b2) );
}

CXXO_CONSTEXPR static inline 
byte operator^ (byte b1, byte b2) CXXO_NOEXCEPTNOTHROW {

	return to_byte( to_integer<unsigned>(b1) ^ to_integer<unsigned>(b2) );
}

CXXO_CONSTEXPR static inline 
byte operator~ (byte b1) CXXO_NOEXCEPTNOTHROW {

	return to_byte( ~to_integer<unsigned>(b1) );
}

static inline 
byte operator&= (byte& b1, byte b2) CXXO_NOEXCEPTNOTHROW {

	return b1= b1 & b2;
}

static inline 
byte operator|= (byte& b1, byte b2) CXXO_NOEXCEPTNOTHROW {

	return b1= b1 | b2;
}

static inline 
byte operator^= (byte& b1, byte b2) CXXO_NOEXCEPTNOTHROW {
	return b1= b1 ^ b2;
}

CXXO_CONSTEXPR static inline 
byte operator>> (byte b1, unsigned s) CXXO_NOEXCEPTNOTHROW {

	return to_byte(to_integer<unsigned>(b1) >> s);
}

CXXO_CONSTEXPR static inline 
byte operator<< (byte b1, unsigned s) CXXO_NOEXCEPTNOTHROW {

	return to_byte(to_integer<unsigned>(b1) << s);
}

static inline 
byte& operator>>= (byte& b1, unsigned s) CXXO_NOEXCEPTNOTHROW {
	return b1= b1 >> s;
}
................................................................................
	return b1= b1 << s;
}



} } 


#ifdef DOXYGEN_DOC
namespace cxxomfort { namespace cxxostd {

/**
 * @brief Type that represents a "byte" with a value.
 * @ingroup cxx17-backports 
 * 
 * A '<code>byte</code>' is much like an <code>unsigned char</code>, 
 * except that it is not an integral type or a character type, 
 * but a trivial-like type of its own. 
 * It represents one @e character in memory in terms of a sequence of bits.
 * 
 * Only bit operations (via bitmask operators) and explicit 
 * conversion to <tt>unsigned char</tt> are defined for it.
 * 
 * @c byte has no value-taking constructors. In order to construct a value 
 * of type @c byte one uses the assist function @c to_byte() .
 * 
 * See @c @ref std::byte for more information.
 * */
struct byte {
	__implementation_defined_t value;
};

/**
 * @brief Creates a @c std::byte value given a numerical octet value.
 * @ingroup cxxomfort-fix
 * @xrefitem cxxomfort-fix "byte" "byte"
 * @return A @c std::byte value .
 * 
 * 
 * See @c std::byte for more information.
 * */
template <typename Integral>
inline to_byte (Integral i) CXXO_NOEXCEPTNOTHROW {
	return byte{i};
}

} }
#endif

// 
// using 
// 

#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#elif (CXXOMFORT_IMPLEMENTS_byte==CXXO_IMPLSTATUS_NATIVE())
#else
................................................................................
    //! @ref cxx17-backports
    using cxxomfort::cxxostd::byte;
    using cxxomfort::cxxostd::to_integer;
}
#endif


namespace cxxomfort { namespace fix {

/**
 * @brief Construct a 'byte' value from an integer.
 * @ingroup cxxomfort-fix
 * 
 */
	using cxxomfort::cxxostd::to_byte;

} } // cxxomfort::fix

#if (defined(DOXYGEN_DOC))






















































namespace std {
/**
 * @enum byte
 * @brief "byte" type for C++17.
 * @ingroup cxx17-backports
 * @xrefitem std0cstddef "<cstddef>" "std::byte"
 * @see http://wg21.link/p0298r3
 * @see https://en.cppreference.com/w/cpp/types/byte
 * 










 * cxxomfort provides this backport via @c @ref cxxomfort::cxxostd::byte .
 * 
 * The following basic operations are allowed:
 * 
 * @code
 * byte b = to_byte(0xnn);
 * b | c;
 * b & c;
................................................................................
 * int cint = to_integer<int>(c);
 * byte d { 0x23 }; // c++17 only
 * @endcode
 * 
 * In C++11 mode onwards, @c byte is implemented as an 
 * <code>enum class</code> and treated accordingly; in C++03 and 
 * compilers without full C++11 conformance, it is implemented 
 * in terms of a @c typesafe_enum .

 * 
 * The supplemental function @c to_byte() allows initialization 
 * of a @c byte in pre-C++17, where uniform initialization for 
 * enums is not defined.
 * 
 *
 */
    enum class byte : unsigned char {};


    template <typename Integral> 
    constexpr Integral to_integral (byte) noexcept;
}
#endif

#endif







<
<
<
<







>

>
>

|

|


|







 







>
>
>
>


|
|


<
|


|







 







>








<
<
<
<
<
<
<









>








>
>
>
>

|

|




|
>



>
>








<
<
<
<







 







>

>
>

|

|







 







>







 







>





>





>





>





>





>










>





>







 







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







 







|






|




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









>
>
>
>
>
>
>
>
>
>
|







 







|
>







|
>
>






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
..
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
...
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
...
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
...
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
...
284
285
286
287
288
289
290










































291
292
293
294
295
296
297
...
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
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
...
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
 * 
 */

#include <cxxomfort/base.hpp>
#include <cxxomfort/util/type_traits.hpp>
#include <cstring>





#if (CXXOMFORT_CXX_STD>=2017 || CXXO_COMPILER_SUPPORT_std_byte)

	#define CXXOMFORT_IMPLEMENTS_p0298r3 CXXO_IMPLSTATUS_NATIVE()

namespace cxxomfort { namespace cxxostd { 
	using std::byte;
	using std::to_integer;
} } // cxxomfort::cxxostd

namespace cxxomfort { namespace fix {

template <typename I, typename = typename std::enable_if<std::is_integral<I>::value>::type >
constexpr std::byte 
to_byte (I i) noexcept {
	return std::byte{i};
}
	
} }  // cxxomfort::fix

#elif (CXXOMFORT_CXX_STD>=2011)
	#define CXXOMFORT_IMPLEMENTS_p0298r3 CXXO_IMPLSTATUS_BACKPORT()

namespace cxxomfort { namespace cxxostd {

enum class byte : unsigned char {};
................................................................................

template <typename I, typename = typename std::enable_if<std::is_integral<I>::value>::type >
CXXO_CONSTEXPR  inline 
I to_integer (byte b) noexcept {
	return I(b);
}

} } // cxxomfort::cxxostd

namespace cxxomfort { namespace fix {

template <typename I, typename = typename std::enable_if<std::is_integral<I>::value>::type >
CXXO_CONSTEXPR  inline 
cxxomfort::cxxostd::byte to_byte (I i) noexcept {
	return static_cast<cxxomfort::cxxostd::byte>(i);
}


} } // cxxomfort::fix

#elif (CXXOMFORT_CXX_STD>=1997) \
&& (CXXO_COMPILER_SUPPORT_explicit_operator)
	// if the compiler at least supports explicit conversion operators, 
	// we can implement std::byte using the typesafe_enum pattern.

	#define CXXOMFORT_IMPLEMENTS_p0298r3 CXXO_IMPLSTATUS_EMULATION()

#include "typesafe_enum-core.hpp"

................................................................................
namespace detail {

	struct mybyte_def { enum type {};  };
	typedef cxxomfort::impl::typesafe_enum<mybyte_def,unsigned char> byteimpl;

}

#pragma pack(push,1)
struct byte 
//: private detail::byteimpl 
{

    private:
    typedef detail::byteimpl impl_t;

    public:







    
    CXXO_EXPLICIT_OPERATOR(unsigned char) () const CXXO_NOEXCEPTNOTHROW {
		return explicit_cast<unsigned char>(impl);
	}
    
    private:
    impl_t impl;

};
#pragma pack(pop)

template <typename Integral>
Integral to_integer (byte b) CXXO_NOEXCEPTNOTHROW {
	using namespace std;
	static_assert (is_integral<Integral>::value, "to_integer");
	return explicit_cast<unsigned char>(b);
}

} }  // cxxomfort::cxxostd

namespace cxxomfort { namespace fix {
	
template <typename Integral>
cxxomfort::cxxostd::byte to_byte (Integral i) CXXO_NOEXCEPTNOTHROW {
	using namespace std;
	cxxomfort::cxxostd::byte b;
	(unsigned char&)(b) = static_cast<unsigned char>(i);
	return b;
}

} } // cxxomfort::fix



#else 
	// pre-C++11 if we don't have support for 
	// explicit operator
	// implement using a simple struct
	#define CXXOMFORT_IMPLEMENTS_p0298r3 3001

namespace cxxomfort { namespace cxxostd {

#pragma pack(push,1)
struct byte {
	public:




	
	CXXO_EXPLICIT_OPERATOR(unsigned char) () const CXXO_NOEXCEPTNOTHROW {
		return v;
	}

	private:
	unsigned char v;
................................................................................
	using namespace std;
	return explicit_cast<unsigned char>(b);
	//I i= 0;
	//memcpy(&i, &b, 1);
	//return i;
}

} } // cxxomfort::cxxostd

namespace cxxomfort { namespace fix {

template <typename I>
cxxomfort::cxxostd::byte to_byte (I i) CXXO_NOEXCEPTNOTHROW {
	using namespace std;
	cxxomfort::cxxostd::byte b;
	unsigned char c= static_cast<unsigned char>(i);
	memcpy(&b, &c, 1);
	return b;
}


} } // cxxomfort::cxxostd
................................................................................
#endif

	#define CXXOMFORT_IMPLEMENTS_byte CXXOMFORT_IMPLEMENTS_p0298r3

// 
// internal checks 
// 

namespace cxxomfort { namespace cxxostd {

static_assert(sizeof(byte) == sizeof(char), "byte: sizeof check");
static_assert (cxxomfort::traits::is_integral<byte>::value==false, "byte: separate-type check");

} }

................................................................................
bool operator!= (byte b1, byte b2) CXXO_NOEXCEPTNOTHROW {
	return to_integer<unsigned>(b1) != to_integer<unsigned>(b2);
}


CXXO_CONSTEXPR static inline 
byte operator& (byte b1, byte b2) CXXO_NOEXCEPTNOTHROW {
	using cxxomfort::fix::to_byte;
	return to_byte( to_integer<unsigned>(b1) & to_integer<unsigned>(b2) );
}

CXXO_CONSTEXPR static inline 
byte operator| (byte b1, byte b2) CXXO_NOEXCEPTNOTHROW {
	using cxxomfort::fix::to_byte;
	return to_byte( to_integer<unsigned>(b1) | to_integer<unsigned>(b2) );
}

CXXO_CONSTEXPR static inline 
byte operator^ (byte b1, byte b2) CXXO_NOEXCEPTNOTHROW {
	using cxxomfort::fix::to_byte;
	return to_byte( to_integer<unsigned>(b1) ^ to_integer<unsigned>(b2) );
}

CXXO_CONSTEXPR static inline 
byte operator~ (byte b1) CXXO_NOEXCEPTNOTHROW {
	using cxxomfort::fix::to_byte;
	return to_byte( ~to_integer<unsigned>(b1) );
}

static inline 
byte operator&= (byte& b1, byte b2) CXXO_NOEXCEPTNOTHROW {
	using cxxomfort::fix::to_byte;
	return b1= b1 & b2;
}

static inline 
byte operator|= (byte& b1, byte b2) CXXO_NOEXCEPTNOTHROW {
	using cxxomfort::fix::to_byte;
	return b1= b1 | b2;
}

static inline 
byte operator^= (byte& b1, byte b2) CXXO_NOEXCEPTNOTHROW {
	return b1= b1 ^ b2;
}

CXXO_CONSTEXPR static inline 
byte operator>> (byte b1, unsigned s) CXXO_NOEXCEPTNOTHROW {
	using cxxomfort::fix::to_byte;
	return to_byte(to_integer<unsigned>(b1) >> s);
}

CXXO_CONSTEXPR static inline 
byte operator<< (byte b1, unsigned s) CXXO_NOEXCEPTNOTHROW {
	using cxxomfort::fix::to_byte;
	return to_byte(to_integer<unsigned>(b1) << s);
}

static inline 
byte& operator>>= (byte& b1, unsigned s) CXXO_NOEXCEPTNOTHROW {
	return b1= b1 >> s;
}
................................................................................
	return b1= b1 << s;
}



} } 











































// 
// using 
// 

#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#elif (CXXOMFORT_IMPLEMENTS_byte==CXXO_IMPLSTATUS_NATIVE())
#else
................................................................................
    //! @ref cxx17-backports
    using cxxomfort::cxxostd::byte;
    using cxxomfort::cxxostd::to_integer;
}
#endif


namespace cxxomfort { namespace cxxostd {

/**
 * @brief Construct a 'byte' value from an integer.
 * @ingroup cxxomfort-fix
 * 
 */
	using cxxomfort::fix::to_byte;

} } // cxxomfort::fix

#if (defined(DOXYGEN_DOC))
namespace cxxomfort { namespace cxxostd {

/** 
 * @struct byte
 * @brief Implements the backport for <tt>std::byte</tt>.
 * @see @ref std::byte
 * 
 * This implementation-defined struct implements the functionality 
 * for <tt>std::byte</tt> where required (eg.: in C++03 mode).
 * 
 * Only comparison operator, bit operations (via bitmask operators) and explicit 
 * conversion to <tt>unsigned char</tt> are defined for it. Just 
 * like <tt>std::byte</tt>, it has no value-taking constructors.
 * 
 * The implementation changes according to the language features 
 * that cxxomfort can find. In C++11 onwards mode, an actual 
 * <tt>enum class</tt> is used.
 * 
 * See @ref @c std::byte for more information.
 * */
struct byte {
	//! Stored value corresponding to one "byte" (implementation-defined).
	__implementation_defined_t value;
	//! Explicit conversion to <tt>unsigned char</tt> (implementation-defined).
	explicit operator unsigned char () const noexcept;
};

//! Compares the numerical expression of two bytes
inline bool operator== (byte, byte);

//! Compares the numerical expression of two bytes
inline bool operator!= (byte, byte);

} } // cxxomfort::cxxostd

namespace cxxomfort { namespace fix { 

/**
 * @brief Creates a @c std::byte value given a numerical octet value.
 * @ingroup cxxomfort-fix
 * @xrefitem cxxomfort-fix "byte" "byte"
 * @return A @c std::byte value .
 * @see @ref std::byte
 * 
 * 
 * See @c std::byte for more information.
 * */
template <typename Integral>
inline to_byte (Integral i) CXXO_NOEXCEPTNOTHROW {
	return std::byte{i};
}

} }

namespace std {
/**
 * @enum byte
 * @brief "byte" type for C++17.
 * @ingroup cxx17-backports
 * @xrefitem std0cstddef "<cstddef>" "std::byte"
 * @see http://wg21.link/p0298r3
 * @see https://en.cppreference.com/w/cpp/types/byte
 * 
 * A '<code>byte</code>' is much like an <code>unsigned char</code>, 
 * except that it is not an integral type or a character type, 
 * but a trivial-like type of its own. 
 * It represents one @e character in memory in terms of a sequence of bits.
 *
 * @c byte has no value-taking constructors. In order to construct a value 
 * of type @c byte one uses the assist function @c to_byte() 
 * (<tt>cxxomfort::fix::to_byte()</tt>). In C++17, 
 * one can use normal initialization (<tt>byte by = {0x01}</tt>).
 *
 * @b cxxomfort provides this backport via @c @ref cxxomfort::cxxostd::byte .
 * 
 * The following basic operations are allowed:
 * 
 * @code
 * byte b = to_byte(0xnn);
 * b | c;
 * b & c;
................................................................................
 * int cint = to_integer<int>(c);
 * byte d { 0x23 }; // c++17 only
 * @endcode
 * 
 * In C++11 mode onwards, @c byte is implemented as an 
 * <code>enum class</code> and treated accordingly; in C++03 and 
 * compilers without full C++11 conformance, it is implemented 
 * in terms of a @c typesafe_enum if possible, or as a 
 * simple struct with <tt>#pragma pack</tt> otherwise.
 * 
 * The supplemental function @c to_byte() allows initialization 
 * of a @c byte in pre-C++17, where uniform initialization for 
 * enums is not defined.
 * 
 *
 */
    enum byte;

	//! Converts a @c byte to an integral value.
    template <typename Integral> 
    constexpr Integral to_integral (byte) noexcept;
}
#endif

#endif

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

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
 * of characters, to be interpreted as a string object and given 
 * a set of operations.
 * 
 * @see
 * * @cppref{string/basic_string_view} .
 * 
 * */

template <typename CharT, typename CTraits = std::char_traits<CharT>
> class basic_string_view 
: protected cxxomfort::impl::array_ref::array_ref<CharT const> {
    private:
    typedef cxxomfort::impl::array_ref::array_ref<CharT const> membertype;
    public:

    typedef typename membertype::value_type      value_type;
    typedef typename membertype::size_type          size_type;
    typedef typename membertype::difference_type    difference_type;
    typedef CharT*             pointer;
    typedef CharT const*       const_pointer;


    typedef typename membertype::reference          reference;
    typedef typename membertype::const_reference    const_reference;
    typedef typename membertype::const_iterator     const_iterator;
    typedef const_iterator                 iterator;
    typedef typename membertype::const_reverse_iterator  const_reverse_iterator;
    typedef const_reverse_iterator         reverse_iterator;
    //! Flag that indicates a position not found.
    static const size_type npos= size_type(-1);

    
    public:
    // def-ctor





    CXXO_DEFAULT_DEFAULT_CONSTRUCTOR(basic_string_view);
    CXXO_CONSTEXPR CXXO_DEFAULT_COPY_CONSTRUCTOR(basic_string_view,CXXO_NOTHROW,
    membertype(From) );







    
    //! String view to a buffer of characters at position @e px and length @e sz .
    CXXO_CONSTEXPR basic_string_view (const_pointer px, size_t sz) CXXO_NOEXCEPTNOTHROW
    : membertype(px,sz)
    {}



    
    //! String view to a buffer of characters at position @e px to be processed via character_traits.
    CXXO_CONSTEXPR basic_string_view (const_pointer px) CXXO_NOEXCEPTNOTHROW 
    : membertype(px, CTraits::length(px) )
    {}




    //! String view to an array of characters.
#if (CXXOMFORT_CXX_STD>=1997)
    template<size_t N>
    CXXO_CONSTEXPR basic_string_view (CharT const(&arr)[N])
    : membertype(arr,N)
    {}
#endif


    using membertype::max_size;
    using membertype::size;
    using membertype::empty;
    using membertype::data;
    //! Returns the length of the viewed string.
    CXXO_CONSTEXPR 
    size_type  length () const CXXO_NOEXCEPTNOTHROW { return this->size(); }
    





    using membertype::begin;
    using membertype::end;






    //! Accesses characters in the string, unchecked.
    using membertype::operator[];


    //! Accesses characters in the string, checked.
    reference       at (size_type idx) { return this->at(idx); }
    const_reference at (size_type idx) const { return this->at(idx); }
    reference       at_or (size_type idx, reference rx) { return idx < this->size() ? this->operator[](idx) : rx; }
    const_reference at_or (size_type idx, const_reference rx) const { return idx < this->size() ? this->operator[](idx) : rx; }    
    
    using membertype::front;
    using membertype::back;

    //! Copies contents from the viewed string to a @c CharT array.
    size_type  copy (CharT* d, size_type count, size_type pos=0) const;
    //! Returns a view of part of the string.
    basic_string_view    substr (size_type pos, size_type count = npos) const;
    
    int        compare (basic_string_view r) const CXXO_NOEXCEPTNOTHROW;







>
|

|

|

>
|
|
|
<
<
>
>
|
|
|

|







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



|
<
>
>
>



|
<
>
>
>





|



>
|
|
|
|



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

|
>
>



<
<

<
<







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
 * of characters, to be interpreted as a string object and given 
 * a set of operations.
 * 
 * @see
 * * @cppref{string/basic_string_view} .
 * 
 * */
template <
typename CharT, typename CTraits = std::char_traits<CharT> 
> class basic_string_view 
: private cxxomfort::impl::array_ref::array_ref<CharT const> {
    private:
    typedef cxxomfort::impl::array_ref::array_ref<CharT const> basetype;
    public:
	typedef CTraits  	traits_type;
    typedef typename basetype::value_type      value_type;
    typedef typename basetype::size_type          size_type;
    typedef typename basetype::difference_type    difference_type;


    typedef typename basetype::pointer            pointer;
    typedef typename basetype::const_pointer      const_pointer;
    typedef typename basetype::reference          reference;
    typedef typename basetype::const_reference    const_reference;
    typedef typename basetype::const_iterator     const_iterator;
    typedef const_iterator                 iterator;
    typedef typename basetype::const_reverse_iterator  const_reverse_iterator;
    typedef const_reverse_iterator         reverse_iterator;
    //! Flag that indicates a position not found.
    static const size_type npos= size_type(-1);

    
    public:
    // def-ctor

#if (CXXOMFORT_CXX_STD >= 2011)
	constexpr basic_string_view () noexcept = default;
	constexpr basic_string_view (basic_string_view const&) noexcept = default;
#else
	basic_string_view () CXXO_NOEXCEPTNOTHROW


	: basetype()
	{}
	basic_string_view (basic_string_view const& c) CXXO_NOEXCEPTNOTHROW
	: basetype(c) 
	{}

#endif
    
    //! String view to a buffer of characters at position @e px and length @e sz .
    CXXO_CONSTEXPR basic_string_view (const_pointer px, size_t sz) CXXO_NOEXCEPTNOTHROW
    : basetype(px,sz)

    {
//		std::cout<< "Construct on length="<< sz<< "."<< std::endl;
	}
    
    //! String view to a buffer of characters at position @e px to be processed via character_traits.
    CXXO_CONSTEXPR basic_string_view (const_pointer px) CXXO_NOEXCEPTNOTHROW 
    : basetype(px, CTraits::length(px) )

    {
//		std::cout<< "Construct on Ctraits::length="<< CTraits::length(px)<< "."<< std::endl;
	}

    //! String view to an array of characters.
#if (CXXOMFORT_CXX_STD>=1997)
    template<size_t N>
    CXXO_CONSTEXPR basic_string_view (CharT const(&arr)[N])
    : basetype(arr,N)
    {}
#endif


    using basetype::max_size;
    using basetype::size;
    using basetype::empty;
    using basetype::data;
    //! Returns the length of the viewed string.
    CXXO_CONSTEXPR 
    size_type  length () const CXXO_NOEXCEPTNOTHROW { return this->size(); }

    using basetype::front;
    using basetype::back;

	using basetype::cbegin;
	using basetype::cend;
    using basetype::begin;
    using basetype::end;
    
    using basetype::crbegin;
    using basetype::crend;
    using basetype::rbegin;
    using basetype::rend;

    //! Accesses characters in the string, unchecked.
    using basetype::operator[];
    //! Accesses characters in the string, checked.
    using basetype::at_or;
    //! Accesses characters in the string, checked.
    reference       at (size_type idx) { return this->at(idx); }
    const_reference at (size_type idx) const { return this->at(idx); }


    



    //! Copies contents from the viewed string to a @c CharT array.
    size_type  copy (CharT* d, size_type count, size_type pos=0) const;
    //! Returns a view of part of the string.
    basic_string_view    substr (size_type pos, size_type count = npos) const;
    
    int        compare (basic_string_view r) const CXXO_NOEXCEPTNOTHROW;

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

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    #pragma message CXXO_NOTICE("enabled tuple apply(fn,tuple) implementation")
    #endif
#endif

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

namespace cxxomfort {
namespace tuple {

//
// tuple_apply
// (call a function using an unpacked tuple as arguments)







|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    #pragma message CXXO_NOTICE("enabled tuple apply(fn,tuple) implementation")
    #endif
#endif

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

namespace cxxomfort {
namespace tuple {

//
// tuple_apply
// (call a function using an unpacked tuple as arguments)

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

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
...
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
...
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
223
224
225


226
227


228
229
230
231
232
233
234
...
261
262
263
264
265
266
267
268
269
270

271
272
273















274
275
276
277
278
279
280
...
305
306
307
308
309
310
311







312
313
314
315
316
317
318
	// 
	// basic constructors
	// 
	
#ifdef DOXYGEN_DOC
	constexpr array_ref () noexcept = default; //!< trivial, empty array_ref.
	constexpr array_ref (array_ref const&) noexcept = default; // //!< trivial copy-ctor.

#endif
#if (CXXOMFORT_CXX_STD>=2011)
    constexpr array_ref () noexcept = default;
    constexpr array_ref (array_ref const&) noexcept = default;

    constexpr array_ref& operator= (array_ref const&) noexcept = default;
#else



    array_ref () CXXO_NOEXCEPTNOTHROW 
    : ptr_(nullptr), len_(0) 
    {}
    array_ref (array_ref const& a) CXXO_NOEXCEPTNOTHROW 
    : ptr_(a.ptr_), len_(a.len_) {}

#endif
    
    // 
    // special constructors 
    // 
    
    //! This object refers to a buffer of memory pointed by @a p and of size @a len .
................................................................................

    //! 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()) {}

    
    // access to elements

    //! 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]; }
................................................................................
#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_; }


    
    // iterators


    CXXO_CONSTEXPR
    const_iterator  cbegin () const CXXO_NOEXCEPTNOTHROW { return ptr_; }

    CXXO_CONSTEXPR
    const_iterator  cend () const CXXO_NOEXCEPTNOTHROW { return ptr_+len_; }

    iterator        begin () CXXO_NOEXCEPTNOTHROW { return ptr_; }

    iterator        end () CXXO_NOEXCEPTNOTHROW { return ptr_+len_; }

    CXXO_CONSTEXPR 
    const_iterator  begin () const CXXO_NOEXCEPTNOTHROW { return cbegin(); }

    CXXO_CONSTEXPR 
    const_iterator  end () const CXXO_NOEXCEPTNOTHROW { return cend(); }


    const_reverse_iterator    crbegin () const CXXO_NOEXCEPTNOTHROW { return const_reverse_iterator(ptr_+len_); }

    const_reverse_iterator    crend () const CXXO_NOEXCEPTNOTHROW { return const_reverse_iterator(ptr_); }

    const_reverse_iterator    rbegin () const CXXO_NOEXCEPTNOTHROW { return crbegin(); }

    const_reverse_iterator    rend () const CXXO_NOEXCEPTNOTHROW { return crend(); }

	//! Unchecked (!) access to the 0th element.
    const_iterator  front () const { return ptr_[0]; }


    //! Unchecked (!) access to the last element.
    const_iterator  back () const { return ptr_[len_-1]; }



    //! Returns a view to the @a count -elements subsequence starting from @a pos .
    array_ref       substr (size_type pos, size_type count) const;
    //! @overload substr
    array_ref       substr (size_type pos) const;
    //! Returns a view to the leftmost (first) @a n elements.
    array_ref       leftmost (size_type n) const CXXO_NOEXCEPTNOTHROW;
................................................................................
    }
#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

















/**
 * @brief Create a (potentially writeable) @c arrayref view of a buffer with size.
 * @return A view of data of type @a Ty .
 * */
template <typename Ty>
array_ref<Ty> arrayref (Ty* p, size_t l) {
................................................................................
}

//! @overload carrayref
template <typename Ty>
array_ref<Ty const> carrayref (array_ref<Ty> const& a) {
    return array_ref<Ty 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);
}







>




>
|
|
>
>
>





>







 







<
<







 







|

|

|






>
>



>


>


>

>

>


>



>

>

>

>



|
>
>

|
>
>







 







|


>



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







 







>
>
>
>
>
>
>







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
...
166
167
168
169
170
171
172


173
174
175
176
177
178
179
...
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
...
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
...
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
	// 
	// basic constructors
	// 
	
#ifdef DOXYGEN_DOC
	constexpr array_ref () noexcept = default; //!< trivial, empty array_ref.
	constexpr array_ref (array_ref const&) noexcept = default; // //!< trivial copy-ctor.
	constexpr array_ref& operator= (array_ref const&) noexcept = default; //!< trivial assignment operator
#endif
#if (CXXOMFORT_CXX_STD>=2011)
    constexpr array_ref () noexcept = default;
    constexpr array_ref (array_ref const&) noexcept = default;
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_COMPILER_VERSION < 700)
    array_ref& operator= (array_ref const&) noexcept = default;
    #else
    constexpr array_ref& operator= (array_ref const&) noexcept = default;    
    #endif
#else // pre-c++11 constructors
    array_ref () CXXO_NOEXCEPTNOTHROW 
    : ptr_(nullptr), len_(0) 
    {}
    array_ref (array_ref const& a) CXXO_NOEXCEPTNOTHROW 
    : ptr_(a.ptr_), len_(a.len_) {}
    // assignment operator can be generated trivially
#endif
    
    // 
    // special constructors 
    // 
    
    //! This object refers to a buffer of memory pointed by @a p and of size @a len .
................................................................................

    //! 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]; }
................................................................................
#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
    CXXO_CONSTEXPR
    const_iterator  cend () const CXXO_NOEXCEPTNOTHROW { return ptr_+len_; }
    //! begin
    iterator        begin () CXXO_NOEXCEPTNOTHROW { return ptr_; }
    //! end
    iterator        end () CXXO_NOEXCEPTNOTHROW { return ptr_+len_; }
    //! begin
    CXXO_CONSTEXPR 
    const_iterator  begin () const CXXO_NOEXCEPTNOTHROW { return cbegin(); }
    //! end
    CXXO_CONSTEXPR 
    const_iterator  end () const CXXO_NOEXCEPTNOTHROW { return cend(); }

	//! reverse-begin
    const_reverse_iterator    crbegin () const CXXO_NOEXCEPTNOTHROW { return const_reverse_iterator(ptr_+len_); }
	//! reverse-end
    const_reverse_iterator    crend () const CXXO_NOEXCEPTNOTHROW { return const_reverse_iterator(ptr_); }
	//! reverse-begin
    const_reverse_iterator    rbegin () const CXXO_NOEXCEPTNOTHROW { return crbegin(); }
	//! reverse-end
    const_reverse_iterator    rend () const CXXO_NOEXCEPTNOTHROW { return crend(); }

	//! Unchecked (!) access to the 0th element.
    const_iterator  front () const CXXO_NOEXCEPTNOTHROW { return ptr_[0]; }
	//! Unchecked (!) access to the 0th element.
    iterator        front () CXXO_NOEXCEPTNOTHROW { return ptr_[0]; }
    //! Unchecked (!) access to the last element.
    const_iterator  back () const CXXO_NOEXCEPTNOTHROW { return ptr_[len_-1]; }
    //! Unchecked (!) access to the last element.
    iterator  		back () CXXO_NOEXCEPTNOTHROW { return ptr_[len_-1]; }

    //! Returns a view to the @a count -elements subsequence starting from @a pos .
    array_ref       substr (size_type pos, size_type count) const;
    //! @overload substr
    array_ref       substr (size_type pos) const;
    //! Returns a view to the leftmost (first) @a n elements.
    array_ref       leftmost (size_type n) const CXXO_NOEXCEPTNOTHROW;
................................................................................
    }
#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>
CXXO_CONSTEXPR 
bool operator== (array_ref<T> const& a1, array_ref<T> const& a2) CXXO_NOEXCEPTNOTHROW {
	return a1.data()==a2.data() && a1.size()==a2.size();
}

//! Compare <tt>array_ref</tt>s for equality.
template <typename T>
CXXO_CONSTEXPR 
bool operator!= (array_ref<T> const& a1, array_ref<T> const& a2) CXXO_NOEXCEPTNOTHROW {
	return !(a1==a2);
}


/**
 * @brief Create a (potentially writeable) @c arrayref view of a buffer with size.
 * @return A view of data of type @a Ty .
 * */
template <typename Ty>
array_ref<Ty> arrayref (Ty* p, size_t l) {
................................................................................
}

//! @overload carrayref
template <typename Ty>
array_ref<Ty const> carrayref (array_ref<Ty> const& a) {
    return array_ref<Ty const>(a.data(), a.size());
}

//! @overload carrayref
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);
}

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

269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
...
294
295
296
297
298
299
300

301
302
303
304
305
306
307
...
316
317
318
319
320
321
322





323
324
325
326
327
328
329
...
334
335
336
337
338
339
340

341
342
343
344
345
346
347
...
356
357
358
359
360
361
362
363






364
365
366








367
368



369
























370
371








372






































































373





#endif

    Ret operator() () const {
        return fn_(ptr_ );
    }

    operator bool() const { return fn_; }

    std::type_info const& info () const CXXO_NOEXCEPT {
        return *tinfo;
    }

};

template <typename Ret, typename A1> 
struct fn_aligned_union<Ret(A1)> {
................................................................................
template <typename Ret, typename A1>
class function_ref <Ret(A1)> {
    enum { IsConst = true };
    typedef typename functiontype<Ret(void const*,A1)>::pointer call_t;
    typedef typename std::conditional< IsConst, void const, void>::type voidtype;
    call_t fn_;
    voidtype* ptr_;

    
    template<typename Callable>
    static Ret callback_fn(voidtype* callable, A1 a1) {
        return (*reinterpret_cast<Callable const*>(callable))(a1);
    }

    public:
................................................................................
    , ptr_(reinterpret_cast<voidtype*>(&callable)) 
    {   }

    Ret operator() (CXXO_FWD_REF(A1) a1) const {
        return fn_(ptr_ , std::forward<A1>(a1));
    }
    





};

template <typename Ret, typename A1, typename A2> 
struct fn_aligned_union<Ret(A1,A2)> {
    union type {
        void* m1;
        typename functiontype<Ret(A1,A2)>::pointer m2;
................................................................................
template <typename Ret, typename A1, typename A2>
class function_ref <Ret(A1,A2)> {
    enum { IsConst = true };
    typedef typename functiontype<Ret(void const*,A1,A2)>::pointer call_t;
    typedef typename std::conditional< IsConst, void const, void>::type voidtype;
    call_t fn_;
    voidtype* ptr_;

    
    template<typename Callable>
    static Ret callback_fn(voidtype* callable, A1 a1, A2 a2) {
        return (*reinterpret_cast<Callable const*>(callable))(a1,a2);
        
    }

................................................................................
    : fn_(callback_fn<typename cxxomfort::traits::remove_reference<Callable>::type>)
    , ptr_(reinterpret_cast<voidtype*>(&callable)) 
    {   }

    Ret operator() (CXXO_FWD_REF(A1) a1,CXXO_FWD_REF(A2) a2) const {
        return fn_( ptr_ , std::forward<A1>(a1), std::forward<A2>(a2) );
    }
    






};











#endif




























}}
















































































#endif











|

|







 







>







 







>
>
>
>
>







 







>







 







|
>
>
>
>
>
>



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

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

>
>
>
>
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
...
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
...
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
...
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
...
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
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
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
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502

#endif

    Ret operator() () const {
        return fn_(ptr_ );
    }

    operator bool() const CXXO_NOEXCEPTNOTHROW { return fn_; }

    std::type_info const& info () const CXXO_NOEXCEPTNOTHROW {
        return *tinfo;
    }

};

template <typename Ret, typename A1> 
struct fn_aligned_union<Ret(A1)> {
................................................................................
template <typename Ret, typename A1>
class function_ref <Ret(A1)> {
    enum { IsConst = true };
    typedef typename functiontype<Ret(void const*,A1)>::pointer call_t;
    typedef typename std::conditional< IsConst, void const, void>::type voidtype;
    call_t fn_;
    voidtype* ptr_;
    std::type_info const* tinfo;
    
    template<typename Callable>
    static Ret callback_fn(voidtype* callable, A1 a1) {
        return (*reinterpret_cast<Callable const*>(callable))(a1);
    }

    public:
................................................................................
    , ptr_(reinterpret_cast<voidtype*>(&callable)) 
    {   }

    Ret operator() (CXXO_FWD_REF(A1) a1) const {
        return fn_(ptr_ , std::forward<A1>(a1));
    }
    
    operator bool() const CXXO_NOEXCEPTNOTHROW { return fn_; }

    std::type_info const& info () const CXXO_NOEXCEPTNOTHROW {
        return *tinfo;
    }
};

template <typename Ret, typename A1, typename A2> 
struct fn_aligned_union<Ret(A1,A2)> {
    union type {
        void* m1;
        typename functiontype<Ret(A1,A2)>::pointer m2;
................................................................................
template <typename Ret, typename A1, typename A2>
class function_ref <Ret(A1,A2)> {
    enum { IsConst = true };
    typedef typename functiontype<Ret(void const*,A1,A2)>::pointer call_t;
    typedef typename std::conditional< IsConst, void const, void>::type voidtype;
    call_t fn_;
    voidtype* ptr_;
    std::type_info const* tinfo;
    
    template<typename Callable>
    static Ret callback_fn(voidtype* callable, A1 a1, A2 a2) {
        return (*reinterpret_cast<Callable const*>(callable))(a1,a2);
        
    }

................................................................................
    : fn_(callback_fn<typename cxxomfort::traits::remove_reference<Callable>::type>)
    , ptr_(reinterpret_cast<voidtype*>(&callable)) 
    {   }

    Ret operator() (CXXO_FWD_REF(A1) a1,CXXO_FWD_REF(A2) a2) const {
        return fn_( ptr_ , std::forward<A1>(a1), std::forward<A2>(a2) );
    }

    operator bool() const CXXO_NOEXCEPTNOTHROW { return fn_; }

    std::type_info const& info () const CXXO_NOEXCEPTNOTHROW {
        return *tinfo;
    }
    
};


template <typename Ret, typename A1, typename A2, typename A3>
class function_ref <Ret(A1,A2,A3)> {
    enum { IsConst = true };
    typedef typename functiontype<Ret(void const*,A1,A2,A3)>::pointer call_t;
    typedef typename std::conditional< IsConst, void const, void>::type voidtype;
    call_t fn_;
    voidtype* ptr_;
    std::type_info const* tinfo;
    

    template<typename Callable>
    static Ret callback_fn(voidtype* callable, A1 a1, A2 a2, A3 a3) {
        return (*reinterpret_cast<Callable const*>(callable))(a1,a2,a3);
        
    }

    public:

    template <typename Callable>
    function_ref (Callable const& callable,
        typename std::enable_if<
            !std::is_same<typename std::remove_reference<Callable>::type,
              function_ref>::value>::type * = nullptr
    )
    : fn_(callback_fn<typename cxxomfort::traits::remove_reference<Callable>::type>)
    , ptr_(reinterpret_cast<voidtype*>(&callable)) 
    {   }

    Ret operator() (CXXO_FWD_REF(A1) a1,CXXO_FWD_REF(A2) a2, CXXO_FWD_REF(A3) a3) const {
        return fn_( ptr_ , std::forward<A1>(a1), std::forward<A2>(a2), std::forward<A3>(a3) );
    }

    operator bool() const CXXO_NOEXCEPTNOTHROW { return fn_; }

    std::type_info const& info () const CXXO_NOEXCEPTNOTHROW {
        return *tinfo;
    }
    
};

template <typename Ret, typename A1, typename A2, typename A3, typename A4>
class function_ref <Ret(A1,A2,A3,A4)> {
    enum { IsConst = true };
    typedef typename functiontype<Ret(void const*,A1,A2,A3,A4)>::pointer call_t;
    typedef typename std::conditional< IsConst, void const, void>::type voidtype;
    call_t fn_;
    voidtype* ptr_;
    std::type_info const* tinfo;
    
    template<typename Callable>
    static Ret callback_fn(voidtype* callable, A1 a1, A2 a2, A3 a3, A4 a4) {
        return (*reinterpret_cast<Callable const*>(callable))(a1,a2,a3,a4);
        
    }

    public:

    template <typename Callable>
    function_ref (Callable const& callable,
        typename std::enable_if<
            !std::is_same<typename std::remove_reference<Callable>::type,
              function_ref>::value>::type * = nullptr
    )
    : fn_(callback_fn<typename cxxomfort::traits::remove_reference<Callable>::type>)
    , ptr_(reinterpret_cast<voidtype*>(&callable)) 
    {   }

    Ret operator() (CXXO_FWD_REF(A1) a1,CXXO_FWD_REF(A2) a2, CXXO_FWD_REF(A3) a3, CXXO_FWD_REF(A4) a4) const {
        return fn_( ptr_ , std::forward<A1>(a1), std::forward<A2>(a2), std::forward<A3>(a3), std::forward<A4>(a4) );
    }

    operator bool() const CXXO_NOEXCEPTNOTHROW { return fn_; }

    std::type_info const& info () const CXXO_NOEXCEPTNOTHROW {
        return *tinfo;
    }
    
};


template <typename Ret, typename A1, typename A2, typename A3, typename A4, typename A5>
class function_ref <Ret(A1,A2,A3,A4,A5)> {
    enum { IsConst = true };
    typedef typename functiontype<Ret(void const*,A1,A2,A3,A4,A5)>::pointer call_t;
    typedef typename std::conditional< IsConst, void const, void>::type voidtype;
    call_t fn_;
    voidtype* ptr_;
    std::type_info const* tinfo;
    
    template<typename Callable>
    static Ret callback_fn(voidtype* callable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
        return (*reinterpret_cast<Callable const*>(callable))(a1,a2,a3,a4,a5);
        
    }

    public:

    template <typename Callable>
    function_ref (Callable const& callable,
        typename std::enable_if<
            !std::is_same<typename std::remove_reference<Callable>::type,
              function_ref>::value>::type * = nullptr
    )
    : fn_(callback_fn<typename cxxomfort::traits::remove_reference<Callable>::type>)
    , ptr_(reinterpret_cast<voidtype*>(&callable)) 
    {   }

    Ret operator() (CXXO_FWD_REF(A1) a1,CXXO_FWD_REF(A2) a2, CXXO_FWD_REF(A3) a3, CXXO_FWD_REF(A4) a4, CXXO_FWD_REF(A5) a5) const {
        return fn_( ptr_ , std::forward<A1>(a1), std::forward<A2>(a2), std::forward<A3>(a3), std::forward<A4>(a4), std::forward<A5>(a5) );
    }

    operator bool() const CXXO_NOEXCEPTNOTHROW { return fn_; }

    std::type_info const& info () const CXXO_NOEXCEPTNOTHROW {
        return *tinfo;
    }
    
};

#endif

} } // cxxomfort::impl

#endif

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

1
2
3
4
5










































































































































































































6
7
8
9
10
11
12
...
329
330
331
332
333
334
335
336
337



#ifndef CXXOMFORT_IMPL_TO_BASIC_STRING_03_HPP
#define CXXOMFORT_IMPL_TO_BASIC_STRING_03_HPP

#include <cstring>
#include <sstream>











































































































































































































namespace cxxomfort { namespace impl {
namespace string {

namespace detail_string {

#if (CXXOMFORT_CXX_STD>=1997)
................................................................................
std::string  to_string
(T0 const& t0, T1 const& t1) {
    return to_basic_string_defaults<char>(t0,t1);
}

} // string
}} // cxxomfort::impl

#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
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
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
...
531
532
533
534
535
536
537
538
539
540
541
542
#ifndef CXXOMFORT_IMPL_TO_BASIC_STRING_03_HPP
#define CXXOMFORT_IMPL_TO_BASIC_STRING_03_HPP

#include <cstring>
#include <sstream>
#include <ostream>

namespace cxxomfort { namespace impl { 
namespace string {

namespace {
struct no_ts {};
const no_ts NO = {};

template <typename Char>
std::basic_ostream<Char>& operator<<  (std::basic_ostream<Char>& os, no_ts) CXXO_NOEXCEPTNOTHROW {
	return os;
}

} // anon

template <typename Ch, 
    typename T0, typename T1, typename T2, typename T3, typename T4, 
    typename T5, typename T6, typename T7, typename T8, typename T9
>
std::basic_string<Ch> to_basic_string (
 	T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, 
	T5 const& t5, T6 const& t6, T7 const& t7, T8 const& t8, T9 const& t9
) {
	std::basic_ostringstream<Ch> ox;
	ox<< t0<< t1<< t2<< t3<< t4<< t5<< t6<< t7<< t8<< t9;
	return ox.str();
}


template <typename Ch, 
    typename T0, typename T1, typename T2, typename T3, typename T4, 
    typename T5, typename T6, typename T7, typename T8
>
std::basic_string<Ch> to_basic_string (
 	T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, 
	T5 const& t5, T6 const& t6, T7 const& t7, T8 const& t8
) {
	std::basic_ostringstream<Ch> ox;
	ox<< t0<< t1<< t2<< t3<< t4<< t5<< t6<< t7<< t8<< NO;
	return ox.str();
}

template <typename Ch, 
    typename T0, typename T1, typename T2, typename T3, typename T4, 
    typename T5, typename T6, typename T7
>
std::basic_string<Ch> to_basic_string (
 	T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, 
	T5 const& t5, T6 const& t6, T7 const& t7
) {
	std::basic_ostringstream<Ch> ox;
	ox<< t0<< t1<< t2<< t3<< t4<< t5<< t6<< t7<< NO<< NO;
	return ox.str();
}

template <typename Ch, 
    typename T0, typename T1, typename T2, typename T3, typename T4, 
    typename T5, typename T6
>
std::basic_string<Ch> to_basic_string (
 	T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, 
	T5 const& t5, T6 const& t6
) {
	std::basic_ostringstream<Ch> ox;
	ox<< t0<< t1<< t2<< t3<< t4<< t5<< t6<< NO;
	return ox.str();
}

template <typename Ch, 
    typename T0, typename T1, typename T2, typename T3, typename T4, 
    typename T5
>
std::basic_string<Ch> to_basic_string (
 	T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, 
	T5 const& t5
) {
	std::basic_ostringstream<Ch> ox;
	ox<< t0<< t1<< t2<< t3<< t4<< t5<< NO;
	return ox.str();
}

template <typename Ch, 
    typename T0, typename T1, typename T2, typename T3, typename T4
>
std::basic_string<Ch> to_basic_string (
 	T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4
) {
	std::basic_ostringstream<Ch> ox;
	ox<< t0<< t1<< t2<< t3<< t4<< NO;
	return ox.str();
}

template <typename Ch, typename T0, typename T1, typename T2, typename T3>
std::basic_string<Ch> to_basic_string (
 	T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3
) {
	std::basic_ostringstream<Ch> ox;
	ox<< t0<< t1<< t2<< t3<< NO;
	return ox.str();
}

template <typename Ch, typename T0, typename T1, typename T2>
std::basic_string<Ch> to_basic_string (
 	T0 const& t0, T1 const& t1, T2 const& t2
) {
	std::basic_ostringstream<Ch> ox;
	ox<< t0<< t1<< t2<< NO;
	return ox.str();
}

template <typename Ch, typename T0, typename T1>
std::basic_string<Ch> to_basic_string (
 	T0 const& t0, T1 const& t1
) {
	std::basic_ostringstream<Ch> ox;
	ox<< t0<< t1<< NO;
	return ox.str();
}


// to_string (std::string)

template <	typename T0, typename T1, typename T2, typename T3, typename T4, 
			typename T5, typename T6, typename T7, typename T8, typename T9
>
std::string to_string (
 	T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, 
	T5 const& t5, T6 const& t6, T7 const& t7, T8 const& t8, T9 const& t9
) {
	return to_basic_string<char>(t0,t1,t2,t3,t4,t5,t6,t7,t8,t9);
}

template <	typename T0, typename T1, typename T2, typename T3, typename T4, 
			typename T5, typename T6, typename T7, typename T8
>
std::string to_string (
 	T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, 
	T5 const& t5, T6 const& t6, T7 const& t7, T8 const& t8
) {
	return to_basic_string<char>(t0,t1,t2,t3,t4,t5,t6,t7,t8);
}

template <	typename T0, typename T1, typename T2, typename T3, typename T4, 
			typename T5, typename T6, typename T7
>
std::string to_string (
 	T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, 
	T5 const& t5, T6 const& t6, T7 const& t7
) {
	return to_basic_string<char>(t0,t1,t2,t3,t4,t5,t6,t7);
}

template <	typename T0, typename T1, typename T2, typename T3, typename T4, 
			typename T5, typename T6
>
std::string to_string (
 	T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, 
	T5 const& t5, T6 const& t6
) {
	return to_basic_string<char>(t0,t1,t2,t3,t4,t5,t6);
}

template <	typename T0, typename T1, typename T2, typename T3, typename T4, 
			typename T5
>
std::string to_string (
 	T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, 
	T5 const& t5
) {
	return to_basic_string<char>(t0,t1,t2,t3,t4,t5);
}

template <	typename T0, typename T1, typename T2, typename T3, typename T4 >
std::string to_string ( T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4
 ) {
	return to_basic_string<char>(t0,t1,t2,t3,t4);
}

template <	typename T0, typename T1, typename T2, typename T3 >
std::string to_string ( T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3
 ) {
	return to_basic_string<char>(t0,t1,t2,t3);
}

template <	typename T0, typename T1, typename T2 >
std::string to_string ( T0 const& t0, T1 const& t1, T2 const& t2
 ) {
	return to_basic_string<char>(t0,t1,t2);
}

template <	typename T0, typename T1 >
std::string to_string ( T0 const& t0, T1 const& t1
 ) {
	return to_basic_string<char>(t0,t1);
}


} // string
} } // cxxomfort::impl

#if 0

namespace cxxomfort { namespace impl {
namespace string {

namespace detail_string {

#if (CXXOMFORT_CXX_STD>=1997)
................................................................................
std::string  to_string
(T0 const& t0, T1 const& t1) {
    return to_basic_string_defaults<char>(t0,t1);
}

} // string
}} // cxxomfort::impl

#endif


#endif

Changes to cxxomfort/cxxomfort/impl/tuple_call.hpp.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#define CXXOMFORT_IMPL_tuple_visit_HPP
/*
 * @file 
 * Support for tuple_visit / tuple_foreach
 */

#include <cxxomfort/base.hpp>
#include <tuple>
#include <type_traits>
#include <functional>

namespace cxxomfort {
namespace impl {
namespace tuple {

/*
 * returns 1 + the index of the first element of tt







|
|
|







2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#define CXXOMFORT_IMPL_tuple_visit_HPP
/*
 * @file 
 * Support for tuple_visit / tuple_foreach
 */

#include <cxxomfort/base.hpp>
#include <cxxomfort/tuple.hpp>
#include <cxxomfort/type_traits.hpp>
#include <cxxomfort/functional.hpp>

namespace cxxomfort {
namespace impl {
namespace tuple {

/*
 * returns 1 + the index of the first element of tt

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

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
...
210
211
212
213
214
215
216
217
218
219
 */
template <typename T> struct is_tuple: traits::false_type {};

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

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

#else // c++03

// assume implementation of tuple in tr1 and supports at least 10 elements


template <typename T1> struct is_tuple <std::tuple<T1> >
................................................................................
    enum { 
        //! The value of this trait.
        value = detail::tuple_element2index_helper<C,0UL,std::tuple_size<T>::value,T>::value 
    };
};


}}

#endif







|







 







|


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
...
210
211
212
213
214
215
216
217
218
219
 */
template <typename T> struct is_tuple: traits::false_type {};

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

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

#else // c++03

// assume implementation of tuple in tr1 and supports at least 10 elements


template <typename T1> struct is_tuple <std::tuple<T1> >
................................................................................
    enum { 
        //! The value of this trait.
        value = detail::tuple_element2index_helper<C,0UL,std::tuple_size<T>::value,T>::value 
    };
};


}} // cxxomfort::impl

#endif

Changes to cxxomfort/cxxomfort/impl/using_tr1_type_traits.hpp.

1
2
3
4
5



6

7
8
9
10
11
12
13
#ifndef CXXOMFORT_IMPL_USING_tr1_type_traits_HPP
#define CXXOMFORT_IMPL_USING_tr1_type_traits_HPP

// for tr1 we bring at least the basic type traits
#if (CXXOMFORT_CXX_STD < 2011 && CXXO_COMPILER_SUPPORT_tr1_type_traits) 



#include <type_traits>


namespace std {
    using tr1::integral_constant;
    using tr1::false_type;
    using tr1::true_type;
    using tr1::is_same;
    using tr1::is_integral;





>
>
>
|
>







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

// for tr1 we bring at least the basic type traits
#if (CXXOMFORT_CXX_STD < 2011 && CXXO_COMPILER_SUPPORT_tr1_type_traits) 
	#if (CXXOFLAG_directory_tr1)
		#include <tr1/type_traits>
	#else
		#include <type_traits>
	#endif

namespace std {
    using tr1::integral_constant;
    using tr1::false_type;
    using tr1::true_type;
    using tr1::is_same;
    using tr1::is_integral;

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

347
348
349
350
351
352
353










































354
355
356
357
358
359
360
...
415
416
417
418
419
420
421

422
423
424
425
426
427
428
Iterator count_frequencies (Iterator ini, Iterator fin, ValueMap& v) {
    for (; ini != fin; ++ini) {
        v[*ini]++;
    }
    return ini;
}












































/*
 * fwsort
 * sort but for non-random access iterators. Requires fw-iterators.
 */

/*
................................................................................
 * 
 * Interfaces defined here:
 * 
 * * @c valcmp() - compares two values the way eg.: @c memcmp does.
 * * @c copy_leftmost_n() , @c copy_rightmost_n () - copies from either end of a sequence.
 * * @c copy_if_not() - complementary to @c find_if_not .
 * * @c count_while() - counts elements in a sequence.

 * * @c find_not() , @c find_if_not() - complements to @c find() , from p1223.
 * * binary predicate form @c find() , from lwg127.
 * * @c find_inversion() - finds elements out of place in a sequence.
 * * @c find_last_if() - finds elements matching a predicate.
 * * @c transform_inplace() , @c transform_inplace_if() - transforms sequences in-place.
 * * @c transform_n() - transforms sequences.
 * * @c count_frequencies_map() , @c count_frequencies() - gathers data frequency in a sequence.







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







 







>







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
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
...
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
Iterator count_frequencies (Iterator ini, Iterator fin, ValueMap& v) {
    for (; ini != fin; ++ini) {
        v[*ini]++;
    }
    return ini;
}

#if (CXXOMFORT_CXX_STD>= 2011)
/**
 * @brief Checks if any of the predicates checks for @a value .
 * @ingroup cxxo-sup-algorithm
 * @return @c true if any of [ini,...,fin) evaluates @c true for @a value .
 * */
template <typename T, typename FncIter>
bool any_on (FncIter ini, FncIter fin, T const& value) {
	for (; ini != fin; ++ini) {
		if ((*ini)(value)) return true;
	}
	return false;
}

/**
 * @brief Checks if all of the predicates checks for @a value .
 * @ingroup cxxo-sup-algorithm
 * @return @c false if any of [ini,...,fin) evaluates @c false for @a value .
 * */
template <typename T, typename FncIter>
bool all_on (FncIter ini, FncIter fin, T const& value) {
	for (; ini != fin; ++ini) {
		if ((*ini)(value)!=true) return false;
	}
	return true;
}

/**
 * @brief Checks if none of the predicates checks for @a value .
 * @ingroup cxxo-sup-algorithm
 * @return @c true if all of [ini,...,fin) evaluates @c true for @a value .
 * */
template <typename T, typename FncIter>
bool none_on (FncIter ini, FncIter fin, T const& value) {
	for (; ini != fin; ++ini) {
		if ((*ini)(value)==true) return false;
	}
	return true;
}


#endif

/*
 * fwsort
 * sort but for non-random access iterators. Requires fw-iterators.
 */

/*
................................................................................
 * 
 * Interfaces defined here:
 * 
 * * @c valcmp() - compares two values the way eg.: @c memcmp does.
 * * @c copy_leftmost_n() , @c copy_rightmost_n () - copies from either end of a sequence.
 * * @c copy_if_not() - complementary to @c find_if_not .
 * * @c count_while() - counts elements in a sequence.
 * * @c any_on(), @c all_on(), @c none_on() - check a number of predicates on a given value.
 * * @c find_not() , @c find_if_not() - complements to @c find() , from p1223.
 * * binary predicate form @c find() , from lwg127.
 * * @c find_inversion() - finds elements out of place in a sequence.
 * * @c find_last_if() - finds elements matching a predicate.
 * * @c transform_inplace() , @c transform_inplace_if() - transforms sequences in-place.
 * * @c transform_n() - transforms sequences.
 * * @c count_frequencies_map() , @c count_frequencies() - gathers data frequency in a sequence.

Changes to cxxomfort/cxxomfort/library/array_ref.hpp.

1
2
3
4
5

6
7
8
9
10
11



























12
13
14
15
#ifndef CXXOMFORT_LIBRARY_ARRAY_REF_HPP
#define CXXOMFORT_LIBRARY_ARRAY_REF_HPP

#include <cxxomfort/impl/n3334-array_ref.hpp>



namespace cxxomfort { namespace library { 

    using ::cxxomfort::impl::array_ref::array_ref;
    using ::cxxomfort::impl::array_ref::arrayref;
    using ::cxxomfort::impl::array_ref::carrayref;




























} }

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

#include <cxxomfort/impl/n3334-array_ref.hpp>
#include <cxxomfort/string.hpp>
#include <vector>

namespace cxxomfort { namespace library { 

    using ::cxxomfort::impl::array_ref::array_ref;
    using ::cxxomfort::impl::array_ref::arrayref;
    using ::cxxomfort::impl::array_ref::carrayref;


// 
// helper functions
// 

template <typename T>
array_ref<T> arrayref (std::vector<T>& v) CXXO_NOEXCEPTNOTHROW {
	return array_ref<T>(v.data(), v.size());
}

template <typename T>
array_ref<T const> carrayref (std::vector<T> const& v) CXXO_NOEXCEPTNOTHROW {
	return array_ref<T const>(v.data(), v.size());
}

inline
array_ref<char> arrayref (std::string& s) CXXO_NOEXCEPTNOTHROW {
	return array_ref<char>((char*)(&s[0]), s.size());
}

inline
array_ref<char const> carrayref (std::string const& s) CXXO_NOEXCEPTNOTHROW {
	return array_ref<char const>((char const*)(&s[0]), s.size());
}



} }

#endif

Changes to cxxomfort/cxxomfort/library/functional.hpp.

1
2

3
4
5
6
7
8
9
..
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
..
96
97
98
99
100
101
102

103
104
105
106
107
108
109
110
...
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#ifndef CXXOMFORT_CXXO_FUNCTIONAL_SUPP_HPP
#define CXXOMFORT_CXXO_FUNCTIONAL_SUPP_HPP

#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
#include <cxxomfort/functional.hpp>
#include <functional>
#include <iterator>
#include <utility>
/**
................................................................................
template <typename R>
nullary_function_ptrt<R> ptr_fun (R(* const function)()) {
    return nullary_function_ptrt<R>(function);
}

//! Generic no-op functor, for wrapping "unset" eg.: @c function , @c function_ref .
struct noop_t {
    CXXO_CONSTEXPR void operator() (...) const CXXO_NOEXCEPTNOTHROW {  }

};

	#if (CXXOMFORT_CXX_STD>=2014)
constexpr const noop_t noop = {};
	#else
const noop_t noop = {};
................................................................................
	operator() (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW {
		/*static*/ const Ord ord;
		return !(ord(vl,vr)) && !(ord(vr,vl));
	}
	
};


template<typename T> struct equivalent_to<void,Ord> {
	typedef bool result_type;
	template <typename T> 
	CXXO_CONSTEXPR14	
	bool operator() (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW {
		/*static*/ const Ord ord;
		return !ord(vl,vr) && !ord(vr,vl);
	}
................................................................................
    
    T const& operator() (...) const CXXO_NOEXCEPT { return value; }
    
};

template <typename T>
inline
constant_function<T> constant_fn (T& const t) {
	return constant_function<T>(t);
}

CXXO_CONSTEXPR14 const constant_function<bool> true_fn (true);
CXXO_CONSTEXPR14 const constant_function<bool> false_fn (false);




>







 







|







 







>
|







 







|







1
2
3
4
5
6
7
8
9
10
..
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
..
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
...
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#ifndef CXXOMFORT_CXXO_FUNCTIONAL_SUPP_HPP
#define CXXOMFORT_CXXO_FUNCTIONAL_SUPP_HPP

#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
#include <cxxomfort/functional.hpp>
#include <functional>
#include <iterator>
#include <utility>
/**
................................................................................
template <typename R>
nullary_function_ptrt<R> ptr_fun (R(* const function)()) {
    return nullary_function_ptrt<R>(function);
}

//! Generic no-op functor, for wrapping "unset" eg.: @c function , @c function_ref .
struct noop_t {
    void operator() (...) const CXXO_NOEXCEPTNOTHROW {  }

};

	#if (CXXOMFORT_CXX_STD>=2014)
constexpr const noop_t noop = {};
	#else
const noop_t noop = {};
................................................................................
	operator() (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW {
		/*static*/ const Ord ord;
		return !(ord(vl,vr)) && !(ord(vr,vl));
	}
	
};

template<typename Ord> 
struct equivalent_to<void,Ord> {
	typedef bool result_type;
	template <typename T> 
	CXXO_CONSTEXPR14	
	bool operator() (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW {
		/*static*/ const Ord ord;
		return !ord(vl,vr) && !ord(vr,vl);
	}
................................................................................
    
    T const& operator() (...) const CXXO_NOEXCEPT { return value; }
    
};

template <typename T>
inline
constant_function<T> constant_fn (T const& t) {
	return constant_function<T>(t);
}

CXXO_CONSTEXPR14 const constant_function<bool> true_fn (true);
CXXO_CONSTEXPR14 const constant_function<bool> false_fn (false);


Changes to cxxomfort/cxxomfort/library/numeric.hpp.

1
2

3
4
5
6
7
8
9
10
11
12
..
29
30
31
32
33
34
35





36
37
38
39
40
41
42
..
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
...
224
225
226
227
228
229
230
231




































232
233
234
235
236
237
238
...
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269


270

271
272

273
274



275



















276
#ifndef CXXOMFORT_CXXO_NUMERIC_SUPP_HPP
#define CXXOMFORT_CXXO_NUMERIC_SUPP_HPP

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

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

................................................................................
struct T_constant {
    typedef T value_type;
    static const T value= v;
    operator T () const CXXO_NOEXCEPT { return v; }
};







template <typename It, typename T, typename F>
T accumulate_right (It ini, It fin, T v0, F f) {
    for (; ini != fin; ++ini) {
        v0 = f(*ini, v0);
    }    
    return v0;
}
................................................................................
    static const T min_value = T0::value < T1::value ? T0::value : T1::value;
    static const T max_value = T0::value > T1::value ? T0::value : T1::value;
};

} // detail

/**

 * @brief Given non-type template parameters @a t0...t4 , provides the minimum as member @c min_value .
 * */
template <typename T, T t0, T t1, T t2=t0, T t3=t0, T t4=t0>
struct static_min {
    public:
    static const T value = detail::minmax_impl_t<T, 
        T_constant<T,t0>, T_constant<T,t1>,
        T_constant<T,t2>, T_constant<T,t3>,
        T_constant<T,t4>
    >::min_value;
};





template <typename T, T t0, T t1, T t2=t0, T t3=t0, T t4=t0>
struct static_max {
    public:
    static const T value = detail::minmax_impl_t<T, 
        T_constant<T,t0>, T_constant<T,t1>,
        T_constant<T,t2>, T_constant<T,t3>,
        T_constant<T,t4>
    >::max_value;

};

/**

 * @brief Given non-type template parameters @a t0...t4 , provides the minimum and maximum as members @c min_value and @c max_value .
 * */
template <typename T, T t0, T t1, T t2=t0, T t3=t0, T t4=t0>
struct static_minmax {
    public:
    typedef detail::minmax_impl_t<T, 
        T_constant<T,t0>, T_constant<T,t1>,
................................................................................
/*
template <typename F, typename T, T t0, T t1>
struct static_leftf <F,T,t0,t1> {
    static const T value = F<T, t0, t1>::value;
};
*/

} // ctmath





































} // numeric::
} } // cxxomfort::library



#else
................................................................................
 * 
 * @code
 * #include <cxxomfort/library/numeric.hpp>
 * 
 * namespace numeric2 = cxxomfort::library::numeric;
 * 
 * @endcode

 * 
 * This file provides supplementary features for the set of 
 * algorithms present in <code><numeric></code> that are 
 * specific to cxxomfort, in particular pre-C++11 compile-time versions 
 * of the utilities like gcd() and lcm() that were made constexpr.
 * 
 * Interfaces defined here:
 * 
 * * @c accumulate_left() , @c accumulate_right() , @c accumulate_associative()
 * * @c static_abs 
 * * @c static_min , @c static_max , @link cxxomfort::library::numeric::static_minmax static_minmax @endlink
 * * @c #static_gcd , @c #static_lcm 
 * * @ref @c static_sum
 * * @c to_signed() , @c to_unsigned() 
 * 


 * 

 * 
 * All interfaces are defined in the namespace <code>cxxomfort::library::numeric::</code>.

 * 
 * See also: @ref std0numeric .



 * 



















 */


>


|







 







>
>
>
>
>







 







>












>
>
>
>








>



>







 







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







 







|

|













>
>

>

<
>

<
>
>
>

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

1
2
3
4
5
6
7
8
9
10
11
12
13
..
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
...
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
...
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
...
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
#ifndef CXXOMFORT_CXXO_NUMERIC_SUPP_HPP
#define CXXOMFORT_CXXO_NUMERIC_SUPP_HPP

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

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

................................................................................
struct T_constant {
    typedef T value_type;
    static const T value= v;
    operator T () const CXXO_NOEXCEPT { return v; }
};



// 
// left fold and right fold
// 

template <typename It, typename T, typename F>
T accumulate_right (It ini, It fin, T v0, F f) {
    for (; ini != fin; ++ini) {
        v0 = f(*ini, v0);
    }    
    return v0;
}
................................................................................
    static const T min_value = T0::value < T1::value ? T0::value : T1::value;
    static const T max_value = T0::value > T1::value ? T0::value : T1::value;
};

} // detail

/**
 * @struct static_min
 * @brief Given non-type template parameters @a t0...t4 , provides the minimum as member @c min_value .
 * */
template <typename T, T t0, T t1, T t2=t0, T t3=t0, T t4=t0>
struct static_min {
    public:
    static const T value = detail::minmax_impl_t<T, 
        T_constant<T,t0>, T_constant<T,t1>,
        T_constant<T,t2>, T_constant<T,t3>,
        T_constant<T,t4>
    >::min_value;
};

/**
 * @struct static_max
 * @brief Given non-type template parameters @a t0...t4 , provides the maximum as member @c max_value .
 * */
template <typename T, T t0, T t1, T t2=t0, T t3=t0, T t4=t0>
struct static_max {
    public:
    static const T value = detail::minmax_impl_t<T, 
        T_constant<T,t0>, T_constant<T,t1>,
        T_constant<T,t2>, T_constant<T,t3>,
        T_constant<T,t4>
    >::max_value;
    //static const T value = max_value;
};

/**
 * @struct static_minmax
 * @brief Given non-type template parameters @a t0...t4 , provides the minimum and maximum as members @c min_value and @c max_value .
 * */
template <typename T, T t0, T t1, T t2=t0, T t3=t0, T t4=t0>
struct static_minmax {
    public:
    typedef detail::minmax_impl_t<T, 
        T_constant<T,t0>, T_constant<T,t1>,
................................................................................
/*
template <typename F, typename T, T t0, T t1>
struct static_leftf <F,T,t0,t1> {
    static const T value = F<T, t0, t1>::value;
};
*/

} // ctmath::


// 
// arithmetic series generator 
// 

template <typename T, T ax, T b>
struct arith_series_gen {
	CXXO_CONSTEXPR
	arith_series_gen () CXXO_NOEXCEPT
	: v(0), vi(0) {}
	
	CXXO_CONSTEXPR 
	explicit arith_series_gen (T v0) CXXO_NOEXCEPTNOTHROW
	: v(v0) , vi(v0) {}
	
	CXXO_CONSTEXPR 
	operator T () const CXXO_NOEXCEPTNOTHROW { return v; }
	
	T operator() () CXXO_NOEXCEPTNOTHROW {
		T ret= v;
		v= ax*v+b;
		return ret;
	}
	
	void reset () CXXO_NOEXCEPT_COND(std::is_integral<T>::value) {
		v= vi;
	}

	T v;
	T const vi;
};

// 
// 
// 

} // numeric::
} } // cxxomfort::library



#else
................................................................................
 * 
 * @code
 * #include <cxxomfort/library/numeric.hpp>
 * 
 * namespace numeric2 = cxxomfort::library::numeric;
 * 
 * @endcode
 * 
 * 
 * This component provides supplementary features for the set of 
 * algorithms present in <code><numeric></code> that are 
 * specific to cxxomfort, in particular pre-C++11 compile-time versions 
 * of the utilities like gcd() and lcm() that were made constexpr.
 * 
 * Interfaces defined here:
 * 
 * * @c accumulate_left() , @c accumulate_right() , @c accumulate_associative()
 * * @c static_abs 
 * * @c static_min , @c static_max , @link cxxomfort::library::numeric::static_minmax static_minmax @endlink
 * * @c #static_gcd , @c #static_lcm 
 * * @ref @c static_sum
 * * @c to_signed() , @c to_unsigned() 
 * 
 * All interfaces are defined in the namespace 
 * <tt>cxxomfort::library::numeric::</tt>.
 * 
 * See also: @ref std0numeric .
 * 

 * @section Static Numerics
 * 

 * The cxxomfort supplemental templates @c static_min , @c static_max and @c static_minmax provide constant-time evaluation of the 
 * minimum and maximum of a set of integers as Non-Type Template Parameters, in particular useful for C++<11 where 
 * @c constexpr and its application on <tt>std::[min|max]</tt> are not available.
 * 
 * @c static_min and @c static_max return their results via the <tt>::value</tt> member. 
 * @c static_minmax returns the members <tt>::min_value</tt> and <tt>max_value</tt>.
 * 
 * Pre-C++11, these templates take a @a type and up to 5 (five) numeric parameters.
 * 
 * The supplemental <tt>static_sum</tt> takes a @a type and up to 10 (ten) template parameters and returns 
 * as the member <tt>::value</tt> the sum (addition) of those values.
 * 
 * The supplementals @c static_gcd and @c static_lcm provide the same kind of compatible functionality to the 
 * C++17 @c constexpr implementations of <tt>std::[gcd,lcm]</tt>.
 * 
 * @section Number Conversions
 * 
 * The cxxomfort supplementals @c to_signed() and @c to_unsigned() convert a numeric expression to the 
 * corresponding signed or unsigned variant of the type. They are intended as 
 * functional supplements to type_traits' <tt>make_[signed,unsigned]</tt>.
 * 
 * Neither function performs range checking.
 * 
 */

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

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
...
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695






























696

/**
 * @file
 * 
 * This file provides supplementary features for the tuple-related 
 * utilities present in <code><tuple></code>.
 * 
 * Interfaces defined here
 * 
 * * @c tuple_pop()
 * * @c tuple_shift()
 * * @c tuple_push()
 * * @c tuple_unshift()
 * * @c tuple2function_t
 * * @c function2tuple_t
 * * @c tuple_call()
 * 
 * Interfaces brought from impl: @c is_tuple , @c tuple_count_type , @c tuple_index 
 * 
 * All interfaces are defined in the namespace <code>cxxomfort::algorithm::</code>.
 * 
 */




#if (CXXOMFORT_CXX_STD>=1997)

#include <tuple>
#include <cxxomfort/array.hpp>
#include <cxxomfort/utility.hpp>
#include "../impl/tuplemeta.hpp"
#include "../impl/14-integer_sequence.hpp"

// note: for these to work correctly MSVC needs to define _VARIADIC_MAX to >= 9, 
// as per https://stackoverflow.com/questions/8274588/c2977-stdtuple-too-many-template-arguments-msvc11
................................................................................
	return detail::tuple_unshift_t<T,Tuple>()(v,tt);
}

#endif


}
}} // cxxomfort


//
// tuple_call (f, Tuple)
// calls f for each member of Tuple
// good for creating tuple visitors
//
#include "../impl/tuple_call.hpp"

#else // CXX_STD
#endif // CXX_STD































#endif







|
<
<
<
<
<
<
<
<







>
>



|







 







|












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

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
...
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720

/**
 * @file
 * 
 * This file provides supplementary features for the tuple-related 
 * utilities present in <code><tuple></code>.
 * 
 * @ingrouo cxxo-sup-tuple








 * 
 * Interfaces brought from impl: @c is_tuple , @c tuple_count_type , @c tuple_index 
 * 
 * All interfaces are defined in the namespace <code>cxxomfort::algorithm::</code>.
 * 
 */

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

#if (CXXOMFORT_CXX_STD>=1997)

#include <cxxomfort/tuple.hpp>
#include <cxxomfort/array.hpp>
#include <cxxomfort/utility.hpp>
#include "../impl/tuplemeta.hpp"
#include "../impl/14-integer_sequence.hpp"

// note: for these to work correctly MSVC needs to define _VARIADIC_MAX to >= 9, 
// as per https://stackoverflow.com/questions/8274588/c2977-stdtuple-too-many-template-arguments-msvc11
................................................................................
	return detail::tuple_unshift_t<T,Tuple>()(v,tt);
}

#endif


}
}} // cxxomfort::cxxostd


//
// tuple_call (f, Tuple)
// calls f for each member of Tuple
// good for creating tuple visitors
//
#include "../impl/tuple_call.hpp"

#else // CXX_STD
#endif // CXX_STD

/**
 * @page cxxo-sup-tuple
 *
 * @code
 * #include <cxxomfort/library/tuple.hpp>
 * 
 * namespace tuple2 = cxxomfort::library::tuple;
 * 
 * @endcode
 * 
 * This component provides supplementary features to the ones
 * present in <code><tuple></code> that are
 * specific to cxxomfort.
 *
 * * @c tuple_pop() - obtain a tuple with the last type removed.
 * * @c tuple_shift() - obtain a tuple with the first type removed.
 * * @c tuple_push() - add a type to a tuple.
 * * @c tuple_unshift() - add a type to a tuple.
 * * @c tuple2function_t
 * * @c function2tuple_t
 * * @c tuple_call() - invoke a function for all elements of a tuple.
 * 
 *
 * All interfaces are defined in the namespace 
 * <tt>cxxomfort::library::tuple::</tt>.
 * 
 * Also see @link std0tuple <tuple> @endlink .
 *
 */

#endif

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

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
...
114
115
116
117
118
119
120

121
122
123
124
125
126
127
...
135
136
137
138
139
140
141




142
143
144
145
146
147






















148
149
150
151
152
153
154
...
166
167
168
169
170
171
172


173
174
175
176
177
178
179
180
181
182
183
184
185
/**
 * @file
 * 
 * Interfaces defined in this file:
 * 
 * 
 * */

#include <cxxomfort/type_traits.hpp>
#include <cxxomfort/utility.hpp> // pair



#include <cxxomfort/impl/relationals.hpp>
#include <cxxomfort/impl/valcomp.hpp>


namespace cxxomfort { namespace library { 
namespace utility {


	using cxxomfort::impl::valcmp;


template <unsigned I>
struct prio 
: prio <I-1> {};

template <>
struct prio<0> {};














































































#if (CXXOMFORT_CXX_STD >= 1997)


//
// simple_pair
//

/**
 * @brief A reduced version of a pair similar to std::array
 * @note Is an aggregate, no constructors.
 * */
template <typename T1, typename T2>
struct simple_pair {
	typedef T1 first_type;
	typedef T2 second_type;
	first_type 		first;    //!< first element
................................................................................
} none = {};


//
// typed null
//



// 
// Operator less-equal-greater
// 

struct strong_equality {
    static const strong_equality equal;
................................................................................
        return l==r ? 0 : ( l < r ? -1 : +1 );
    }
    
};

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





#endif // cxx_std


}
}}























#endif

/**
 * @page cxxo-sup-utility
 * @brief cxxomfort Supplementals for <utility>
 * 
................................................................................
 * 
 * Interfaces defined here:
 * 
 * * @c valcmp() - compares two values the way eg.: @c memcmp does.
 * * @c v_in_place_type(), @c v_in_place_index() .
 * * @c @link cxxomfort::library::utility::strict_type strict_type @endlink .
 * * @c #simple_pair .


 * 
 * TBA:
 * 
 * * @c null_device() .
 * 
 * 
 * All interfaces are defined in the namespace 
 * <tt>cxxomfort::library::utility::</tt>.
 * 
 * See also: @ref std0utility .
 * 
 */








>

|
>
>
>

<
>





<
<
<







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








|







 







>







 







>
>
>
>





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







 







>
>













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
...
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
...
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
...
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
/**
 * @file
 * 
 * Interfaces defined in this file:
 * 
 * 
 * */
#include <cxxomfort/utility.hpp> // pair
#include <cxxomfort/type_traits.hpp>
#include <cxxomfort/system_error.hpp>

#include "array_ref.hpp"

#include <cxxomfort/impl/relationals.hpp>



namespace cxxomfort { namespace library { 
namespace utility {





template <unsigned I>
struct prio 
: prio <I-1> {};

template <>
struct prio<0> {};

// 
// non-const 
// 

template <typename T>
T& as_nonconst (T& p) {
	return p;
}

// 
// simple memory buffer and typedefs for accessing memory
// 

//! Utility typedef representing a view over bytes.
typedef cxxomfort::library::array_ref<std::byte> bytes_view;
//! Utility typedef representing a view over bytes (read-only).
typedef cxxomfort::library::array_ref<std::byte const> const_bytes_view;

template <typename T>
const_bytes_view as_bytes_view (cxxomfort::library::array_ref<T const> view) CXXO_NOEXCEPTNOTHROW {
	return const_bytes_view ( (std::byte*)view.data(), view.size_bytes() );
}

inline const_bytes_view as_bytes_view (void const* ptr, size_t len) CXXO_NOEXCEPTNOTHROW {
	return const_bytes_view( (std::byte const*)ptr, len);
}

inline bytes_view as_writable_bytes_view (void* ptr, size_t len) CXXO_NOEXCEPTNOTHROW {
	return bytes_view( (std::byte*)ptr, len);
}



namespace {
	typedef cxxomfort::library::array_ref<unsigned char> ucharbuffer;
	typedef cxxomfort::library::array_ref<unsigned char const> const_ucharbuffer;
}

/*
template <bool Writable>
struct memory_buffer {
	private:
	typedef typename std::conditional<Writable, void const*, void*>::type pointer_type;
	public:
	typedef typename std::conditional<Writable, std::byte const, std::byte>::type data_type;

	
	explicit memory_buffer () CXXO_NOEXCEPTNOTHROW 
	: ptr(nullptr), len(0)
	{}

	explicit memory_buffer (pointer_type ptr, size_t len) CXXO_NOEXCEPTNOTHROW 
	: ptr(ptr), len(len) 
	{}

	size_t     size () const CXXO_NOEXCEPTNOTHROW { return len; }
	bool       empty() const CXXO_NOEXCEPTNOTHROW { return ptr==0 || len==0; }
	pointer_type    data () const CXXO_NOEXCEPTNOTHROW { return ptr; }
	
	const_bytes_view as_bytes () const CXXO_NOEXCEPTNOTHROW {
		return const_bytes_view((std::byte const*)ptr, len);
	}
	
	const_ucharbuffer as_uchars () const CXXO_NOEXCEPTNOTHROW {
		return const_ucharbuffer((unsigned char const*)ptr,len);
	}
	
	
	private:
	
	void* ptr;
	size_t len;
	
};
*/


#if (CXXOMFORT_CXX_STD >= 1997)


//
// simple_pair
//

/**
 * @brief A reduced version of a pair similar to std::array in that it's an aggregate.
 * @note Is an aggregate, no constructors.
 * */
template <typename T1, typename T2>
struct simple_pair {
	typedef T1 first_type;
	typedef T2 second_type;
	first_type 		first;    //!< first element
................................................................................
} none = {};


//
// typed null
//



// 
// Operator less-equal-greater
// 

struct strong_equality {
    static const strong_equality equal;
................................................................................
        return l==r ? 0 : ( l < r ? -1 : +1 );
    }
    
};

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





#endif // cxx_std


}
}} // cxxomfort::library

// 
// valcomp 
// 

#include <cxxomfort/impl/valcomp.hpp>

namespace cxxomfort { namespace library { 
namespace utility {

	using cxxomfort::impl::valcmp;

}
}} // cxxomfort::library

// 
// hexdump, hexread
// 


#include <cxxomfort/impl/hexdump.hpp>


#endif

/**
 * @page cxxo-sup-utility
 * @brief cxxomfort Supplementals for <utility>
 * 
................................................................................
 * 
 * Interfaces defined here:
 * 
 * * @c valcmp() - compares two values the way eg.: @c memcmp does.
 * * @c v_in_place_type(), @c v_in_place_index() .
 * * @c @link cxxomfort::library::utility::strict_type strict_type @endlink .
 * * @c #simple_pair .
 * * @c bytes_view , @c const_bytes_view - utility typedefs representing <tt>array_ref</tt> views over std::bytes.
 * * @c as_bytes_view() - a read-only std::byte view of a memory region.
 * 
 * TBA:
 * 
 * * @c null_device() .
 * 
 * 
 * All interfaces are defined in the namespace 
 * <tt>cxxomfort::library::utility::</tt>.
 * 
 * See also: @ref std0utility .
 * 
 */

Changes to cxxomfort/cxxomfort/memory.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
...
132
133
134
135
136
137
138
139
140
141
142
143
144

145
146
147
148
149
150
151
...
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
#ifndef CXXOMFORT_MEMORY_HPP
#define CXXOMFORT_MEMORY_HPP
/**
 * @file
 * @brief Implementations and additions tied to Standard Header <memory>.
 * @xrefitem std0memory "<memory>" ""
 *
 */

#include "config.hpp"
#include "base.hpp"
#include "base/alignof.hpp"
................................................................................
#else
	#include "impl/unique_ptr-poor.hpp"
#endif

//
// make_unique
//
#if (CXXOMFORT_CXX_STD>=2014)
#elif (CXXOMFORT_CXX_STD>=1997)
    #include "impl/14-make_unique.hpp"
#else
#endif



#if 0
//
// alignas
//

/*
................................................................................


#endif // file


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




|







 







<
<
<
<
<

>







 







|







1
2
3
4
5
6
7
8
9
10
11
12
...
132
133
134
135
136
137
138





139
140
141
142
143
144
145
146
147
...
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
#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"
................................................................................
#else
	#include "impl/unique_ptr-poor.hpp"
#endif

//
// make_unique
//






#include "impl/14-make_unique.hpp"

#if 0
//
// alignas
//

/*
................................................................................


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

Changes to cxxomfort/cxxomfort/numeric.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
..
14
15
16
17
18
19
20





21
22
23
24
25
26
27
..
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
...
109
110
111
112
113
114
115
116
117





118
119
120
121

122
123
124
125
126
127
128
#ifndef CXXOMFORT_NUMERIC_HPP
#define CXXOMFORT_NUMERIC_HPP
/**
 * @file
 * @brief Implementations and backports tied to <code><numeric></code>.
 * 
 */


#include "base.hpp"
#include "util/meta.hpp" // conditional
#include <numeric>
................................................................................

namespace cxxomfort {
namespace cxxostd {

/**
 * @brief Fills a sequence with a sequentially growing set of values.
 * @ingroup cxx11-backports 





 */
template <typename FwIt, typename T>
FwIt iota (FwIt ini, FwIt fin, T i0) {
    for(; ini!=fin; ++ini, ++i0) {*ini= i0; }
    return ini;
}

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



/**
 * @brief Calculates the greatest common divisor.
 * @ingroup cxx17-backports
 * @sa lcm



 */
template <typename IM, typename IN>
CXXO_CONSTEXPR IM gcd (IM m, IN n) CXXO_NOEXCEPT {
    return (n== 0) ? m : gcd(n, m % n);


}


/**
 * @brief Calculates the lowest common multiple.
 * @ingroup cxx17-backports
 * @sa gcd
 */
template <typename IM, typename IN>
CXXO_CONSTEXPR IM lcm (IM m, IN n) CXXO_NOEXCEPT {
    return m / gcd(m,n) * n;


}


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

................................................................................
	#undef CXXOMFORT_USING_midpoint
#endif

#endif

/**
 * @page std0numeric <numeric>
 * @brief Backports from <numeric>
 * 





 * Interfaces defined in this section:
 * 
 * * @c iota() (C++11) -  generate sequences of increasing values.
 * * @c gcd() , @c lcm() (C++17) - math functions.

 * 
 * @section also See Also
 * 
 * * @see @cppref{header/numeric} (cppreference)
 * * @see @ref std0algorithm
 * * @ref cxxo-sup-numeric (supplemental).
 */




|







 







>
>
>
>
>







 







|
>
>
>

|
<
<
>
>






|
|
|
|
|
>
>







 







|

>
>
>
>
>




>

|





1
2
3
4
5
6
7
8
9
10
11
12
..
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
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
...
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
#ifndef CXXOMFORT_NUMERIC_HPP
#define CXXOMFORT_NUMERIC_HPP
/**
 * @file
 * @brief Implementations and backports tied to <tt><numeric></tt>.
 * 
 */


#include "base.hpp"
#include "util/meta.hpp" // conditional
#include <numeric>
................................................................................

namespace cxxomfort {
namespace cxxostd {

/**
 * @brief Fills a sequence with a sequentially growing set of values.
 * @ingroup cxx11-backports 
 * 
 * Given the sequence <tt>[ini, fin)</tt>, @e iota assigns the values <tt>i0, i0+1, i0+2, ...</tt> to the elements of the sequence until it has been filled.
 * 
 * @sa cppref{algoritm/iota}
 *  
 */
template <typename FwIt, typename T>
FwIt iota (FwIt ini, FwIt fin, T i0) {
    for(; ini!=fin; ++ini, ++i0) {*ini= i0; }
    return ini;
}

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



/**
 * @brief Calculates the greatest common divisor.
 * @ingroup cxx17-backports
 * @returns A numeric value of type @a Num1 .
 * Compare also: @ref lcm 
 * @sa @cppref{numeric/gcd}
 * @note As a backport, the return type is the same as the first argument.
 */
template <typename Num1, typename Num2>


CXXO_CONSTEXPR Num1 gcd (Num1 n1, Num2 n2) CXXO_NOEXCEPT {
    return (n2== 0) ? n1 : gcd(n2, n1 % n2);
}


/**
 * @brief Calculates the lowest common multiple.
 * @ingroup cxx17-backports
 * @returns A numeric value of type @a Num1 .
 * Compare also: @ref gcd 
 * @sa @cppref{numeric/lcm}
 */
template <typename Num1, typename Num2>
CXXO_CONSTEXPR Num1 lcm (Num1 n1, Num2 n2) CXXO_NOEXCEPT {
    return n1 / gcd(n1,n2) * n2;
}


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

................................................................................
	#undef CXXOMFORT_USING_midpoint
#endif

#endif

/**
 * @page std0numeric <numeric>
 * @brief Backports related to Standard header <tt><numeric></tt> 
 * 
 * @code
 * #include <cxxomfort/numeric.hpp>
 * @endcode
 * 
 * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>)
 * Interfaces defined in this section:
 * 
 * * @c iota() (C++11) -  generate sequences of increasing values.
 * * @c gcd() , @c lcm() (C++17) - math functions.
 * * @c midpoint() (C++20) - midpoint of integers, floating points or pointers.
 * 
 * @subsection also See Also
 * 
 * * @see @cppref{header/numeric} (cppreference)
 * * @see @ref std0algorithm
 * * @ref cxxo-sup-numeric (supplemental).
 */

Changes to cxxomfort/cxxomfort/string.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
...
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
#ifndef CXXOMFORT_STRING_HPP
#define CXXOMFORT_STRING_HPP
/**
 * @file 
 * @brief Implementations and additions tied to <code><string></code>.
 * @xrefitem std0string "" ""
 */

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

................................................................................

#endif // CXX_STD

#endif // file

/**
 * @page std0string <string>
 * @brief Backports from <string>
 * 
 * 





 * Interfaces defined in this section:
 * 
 * * @c cxxomfort::cxxostd::to_string() (C++11) - convert C++ integers/floats into strings.
 *   * Overloads include @c to_string(short) , @c to_string(long) , @c to_string(double) etc.
 * * @c strtoll() , @c strtoull() function family (C++11) - convert strings into @c long s.
 * * hash<> specialization for @c std::basic_string where not available.
 * 
 * Future / potential interfaces:
 * 
 * * @c string user-defined literal
 * 
 * @section also "See Also"
 * 
 * * @ref @cppref{header/string}
 * * @ref std0string_view "string_view backports"
 * * @ref cxxo-sup-string
 * 
 *
 * */




|







 







|


>
>
>
>
>


|
|

|





|







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

................................................................................

#endif // CXX_STD

#endif // file

/**
 * @page std0string <string>
 * @brief Backports related to Standard header <tt><string></tt>
 * 
 * 
 * @code
 * #include <cxxomfort/string.hpp>
 * @endcode
 * 
 * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>)
 * Interfaces defined in this section:
 * 
 * * @c @link cxxomfort::cxxostd::to_string to_string() @endlink (C++11) - convert C++ integers/floats into strings.
 * * Overloads include @c to_string(short) , @c to_string(long) , @c to_string(double) etc.
 * * @c strtoll() , @c strtoull() function family (C++11) - convert strings into @c long s.
 * * <tt>hash<></tt> specialization for @c std::basic_string where not available.
 * 
 * Future / potential interfaces:
 * 
 * * @c string user-defined literal
 * 
 * @subsection also "See Also"
 * 
 * * @ref @cppref{header/string}
 * * @ref std0string_view "string_view backports"
 * * @ref cxxo-sup-string
 * 
 *
 * */

Changes to cxxomfort/cxxomfort/string_view.hpp.

22
23
24
25
26
27
28

29
30
31
32
33
34
35
36
37

38
39
40
41
42
43
44
..
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
	#if (CXXOMFORT_CXX_STD>=1997)
		#include <string>

namespace cxxomfort { namespace fix {

/**
 * @brief Creates a view of a std::string.

 * */
template <typename Char, typename CT>
std::basic_string_view<Char,CT> 
make_string_view (std::basic_string<Char,CT> const& s) {
    return std::basic_string_view<Char,CT> (s.data(), s.size());
}

/**
 * @brief Creates a view from a character array.

 * 
 * */
template <typename Char, size_t N>
CXXO_CONSTEXPR std::basic_string_view<Char> 
make_string_view (Char const(&arr)[N]) CXXO_NOEXCEPT {
    return std::basic_string_view<Char> (arr, N);
}
................................................................................
#else // 0 && C++<1997
#endif

#endif

/**
 * @page std0string_view <string_view>
 * @brief Backports from <string_view>
 * 





 * Interfaces defined here:
 * 
 * * @c @ref cxxomfort::cxxostd::basic_string_view @c basic_string_view  (C++17).
 * * the related typedefs eg.: @c string_view .
 * 


 * Fix (non-backport) interfaces:
 * 
 * * @c cxxomfort::fix::make_string_view() - Makes a @c string_view from a std::string or a literal string.
 * 
 * @section also "See Also"
 * 
 * * @ref @cppref{header/string_view} , @ref @cppref{string/basic_string_view}
 * * @ref std0string "<string> backports"
 * 
 * 
 * */







>









>







 







|

>
>
>
>
>


|


>
>




|






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
..
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
	#if (CXXOMFORT_CXX_STD>=1997)
		#include <string>

namespace cxxomfort { namespace fix {

/**
 * @brief Creates a view of a std::string.
 * @ingroup cxxomfort-fix
 * */
template <typename Char, typename CT>
std::basic_string_view<Char,CT> 
make_string_view (std::basic_string<Char,CT> const& s) {
    return std::basic_string_view<Char,CT> (s.data(), s.size());
}

/**
 * @brief Creates a view from a character array.
 * @ingroup cxxomfort-fix
 * 
 * */
template <typename Char, size_t N>
CXXO_CONSTEXPR std::basic_string_view<Char> 
make_string_view (Char const(&arr)[N]) CXXO_NOEXCEPT {
    return std::basic_string_view<Char> (arr, N);
}
................................................................................
#else // 0 && C++<1997
#endif

#endif

/**
 * @page std0string_view <string_view>
 * @brief Backports related to Standard header <tt><string_view></tt> 
 * 
 * @code
 * #include <cxxomfort/string_view.hpp>
 * @endcode
 * 
 * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>)
 * Interfaces defined here:
 * 
 * * @c @link cxxomfort::cxxostd::basic_string_view basic_string_view @endlink (C++17).
 * * the related typedefs eg.: @c string_view .
 * 
 * For differences between the implementation of <tt>string_view</tt> 
 * here vs standard, check the notices at <tt> @link cxxomfort::cxxostd::basic_string_view basic_string_view @endlink </tt>
 * Fix (non-backport) interfaces:
 * 
 * * @c cxxomfort::fix::make_string_view() - Makes a @c string_view from a std::string or a literal string.
 * 
 * @subsection also "See Also"
 * 
 * * @ref @cppref{header/string_view} , @ref @cppref{string/basic_string_view}
 * * @ref std0string "<string> backports"
 * 
 * 
 * */

Changes to cxxomfort/cxxomfort/system_error.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
#ifndef CXXOMFORT_SYSTEM_ERROR_HPP
#define CXXOMFORT_SYSTEM_ERROR_HPP
/**
 * @file
 * @xrefitem std0system_error "<system_error>" "Header"
 * 
 */








#if (CXXOMFORT_CXX_STD>=2011)

#include <system_error>

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




#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





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









>
>
>
>
>
>
>



|





>
>
>

>











|
|
|
|

>
>
>

|
|
|
|
|
|
|
|
|
|
|

|


|
|

|

|
|
|

|
|
|
|
|
|







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
#ifndef CXXOMFORT_SYSTEM_ERROR_HPP
#define CXXOMFORT_SYSTEM_ERROR_HPP
/**
 * @file
 * @xrefitem std0system_error "<system_error>" "Header"
 * 
 */

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


Changes to cxxomfort/cxxomfort/tuple.hpp.

2
3
4
5
6
7
8

9
10
11
12
13






14
15
16
17


18
19
20
21
22
23
24
..
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
#define CXXOMFORT_TUPLE_HPP
/**
 * @file
 * @brief Implementations and backports related to <code><tuple></code>.
 * @ingroup std0tuple
 * 
 */


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

#elif (CXXOMFORT_CXX_STD>=1997 && CXXOFLAG_tr1)







	#include "base.hpp"
	#include "utility.hpp" // index_sequence
	#include <tuple> // d'uh


	#include <cxxomfort/array.hpp> // array <-> tuple conversions

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

	// for TR1, we need to bring names into namespace std
................................................................................
		return make_tuple(get<0>(a), get<1>(a), get<0>(b), get<1>(b) );
	}

	}

	#endif

	#include "impl/14-tuple_get_type.hpp" // std::get<T> (tuple<>)
	#include "impl/17-tuple_apply.hpp" // std::apply (Function, tuple<>)
	#include "impl/17-make_from_tuple.hpp" // std::make_from_tuple<T>(tuple<>)

namespace cxxomfort {
namespace cxxostd {


} //cxxomfort::cxxostd
} //

#else // CXX_STD < 1997

	#pragma message CXXO_NOTICE("<tuple> not supported")

#endif // CXX_STD


















#endif

/**
 * @page std0tuple <tuple>
 * @brief cxxomfort Backports for features in <tuple>
 * 
 * Interfaces defined here:
 * 
 * * @c get<tuple>() ( @ref std_get_type_tuple ) (C++14) - get elements of a tuple by type.
 * * @c apply() (C++17) - call a functor unpacking a tuple as arguments.
 * * @c make_from_tuple() (C++17) - construct an object unpacking a tuple as arguments.
 * 
 * See also: @ref std0utility , @ref cxxo-sup-tuple ,
 * <a href="https://en.cppreference.com/w/cpp/header/tuple">\<tuple\> \@cppreference</a>.
 * 
 * */







>





>
>
>
>
>
>



|
>
>







 







<
<
<
<












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





|




|
|





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
..
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
#define CXXOMFORT_TUPLE_HPP
/**
 * @file
 * @brief Implementations and backports related to <code><tuple></code>.
 * @ingroup std0tuple
 * 
 */


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

#elif (CXXOMFORT_CXX_STD>=1997 && CXXOFLAG_tr1)

	#if (CXXOFLAG_directory_tr1)
		#include <tr1/tuple> // d'uh
	#else
		#include <tuple>
	#endif

	#include "base.hpp"
	#include "utility.hpp" // index_sequence



	#include <cxxomfort/array.hpp> // array <-> tuple conversions

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

	// for TR1, we need to bring names into namespace std
................................................................................
		return make_tuple(get<0>(a), get<1>(a), get<0>(b), get<1>(b) );
	}

	}

	#endif





namespace cxxomfort {
namespace cxxostd {


} //cxxomfort::cxxostd
} //

#else // CXX_STD < 1997

	#pragma message CXXO_NOTICE("<tuple> not supported")

#endif // CXX_STD

// 
// get<type>(tuple)
// 

#include "impl/14-tuple_get_type.hpp" // std::get<T> (tuple<>)


#if (CXXOMFORT_CXX_STD < 2011)
#endif
#if (CXXOMFORT_CXX_STD < 2014)
#endif
#if (CXXOMFORT_CXX_STD < 2017)
	#include "impl/17-tuple_apply.hpp" // std::apply (Function, tuple<>)
	#include "impl/17-make_from_tuple.hpp" // std::make_from_tuple<T>(tuple<>)
#endif // CXX_STD


#endif

/**
 * @page std0tuple <tuple>
 * @brief Backports related to Standard header <tt><tuple></tt> 
 * 
 * Interfaces defined here:
 * 
 * * @c get<tuple>() ( @ref std_get_type_tuple ) (C++14) - get elements of a tuple by type.
 * * @c apply() (C++17) - call a functor, unpacking a tuple for the arguments.
 * * @c make_from_tuple() (C++17) - construct an object unpacking a tuple for constructor arguments.
 * 
 * See also: @ref std0utility , @ref cxxo-sup-tuple ,
 * <a href="https://en.cppreference.com/w/cpp/header/tuple">\<tuple\> \@cppreference</a>.
 * 
 * */

Changes to cxxomfort/cxxomfort/utility.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
..
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
...
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
...
135
136
137
138
139
140
141
142
143
144
145
146
147
148

149
150
151
152
153
154
155
156
157






158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#ifndef CXXOMFORT_UTILITY_HPP
#define CXXOMFORT_UTILITY_HPP
/**
 * @file
 * @brief Implementations and backports tied to Standard Header <code><utility></code>.
 * @xrefitem std0utility "<utility>" "Header"
 * 
 */



#include "config.hpp"
................................................................................

#include "util/meta.hpp"
#include "util/type_traits.hpp"

//#include "type_traits.hpp"
//USING

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


namespace cxxomfort {
namespace cxxostd {
    /** 
     * @brief Expression for an unevaluated context.
     * @ingroup cxx11-backports
................................................................................
     * @xrefitem std:utility "<utility>" ""
     */
    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

    #if defined(CXXO_ADD_declval)
namespace std { 
    using ::cxxomfort::cxxostd::declval;
} //std::
        #undef CXXO_ADD_declval
    #endif

#endif

#define CXXOMFORT_IMPLEMENTS_n1978 CXXO_IMPLSTATUS_EMULATION()
#define CXXOMFORT_IMPLEMENTS_decltype CXXOMFORT_IMPLEMENTS_n1978
#define CXXOMFORT_IMPLEMENTS_n2343 CXXO_IMPLSTATUS_BACKPORT()


#include "impl/n3668-exchange.hpp"
#include "impl/14-integer_sequence.hpp"
#include "impl/17-as_const.hpp"


//
// in_place_t, etc
//
#if (defined( CXXOFLAG_NO_STD_USING ) && CXXOFLAG_NO_STD_USING>0)
#else

#if (CXXOMFORT_CXX_STD < 2017)

namespace std {

    struct in_place_t { };
#if (CXXOMFORT_CXX_STD >= 2014)
    inline constexpr in_place_t in_place{};
#else
    CXXO_CONSTEXPR const in_place_t in_place = {};
#endif

    namespace detail {

        template< typename T >
        struct in_place_type_tag {
        };

................................................................................
    template <size_t I>       struct in_place_index_t { 
    };

// 
// in_place_type , in_place_index
//

#if (CXXOMFORT_CXX_STD == 2014)
    // here we have template variables

    template <class T>
    CXXOMFORT_CXX17_CODE(inline, ) constexpr in_place_type_t<T> in_place_type = {};

    template <size_t I>
    CXXOMFORT_CXX17_CODE(inline, ) constexpr in_place_index_t<I> in_place_index{};

    #define CXXO_in_place_type_t(T) ::std::in_place_type_t<T>
    
#else

// c++<14 does not have inline variables so we use the 
// overloaded function name reference from 
// https://vector-of-bool.github.io/2016/10/30/standard-in-place.html


struct in_place_tag { };
................................................................................
void in_place_type (detail::in_place_type_tag<T> = detail::in_place_type_tag<T>() ) CXXO_NOEXCEPTNOTHROW {
}

template <size_t I>
void in_place_index (detail::in_place_index_tag<I> = detail::in_place_index_tag<I>() ) CXXO_NOEXCEPTNOTHROW {
}

    #define CXXO_in_place_type_t(T) void(&)( ::std::detail::in_place_type_tag<T> )

#endif


} // std
#endif // c++17 for in_place_...

#endif // std_using

#endif // CXX_STD >= 1997

#endif

/**
 * @page std0utility <utility>
 * @brief Backports from <utility>






 * 
 * Interfaces defined in this file:
 * 
 * * @c move() (C++11).
 * * @c declval() (C++11).
 * * @c exchange() (C++14).
 * * @c integer_sequence , @c index_sequence (C++14) (from C++11 onward only).
 * * @c as_const() , @c as_ptr_const() (C++17).
 * * @c in_place_t , @c in_place_type_t (C++17).
 *
 * See also @ref std0type_traits , @ref std0tuple , 
 * <a href="https://en.cppreference.com/w/cpp/header/utility">\<utility\> \@cppreference</a>.
 * 
 * See also @ref cxxo-sup-utility (supplemental).
 * 
 * */




|







 







|
|
|







 







|
|
|
|
|
|
|
|
|
|
|

|

|

|
|

|

<
<
<


|
|
|





|
|

|




|
|
|

|







 







|








|

|







 







|

|



|
>
|







|
>
>
>
>
>
>



|
|
|

|








1
2
3
4
5
6
7
8
9
10
11
12
..
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
...
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
...
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#ifndef CXXOMFORT_UTILITY_HPP
#define CXXOMFORT_UTILITY_HPP
/**
 * @file
 * @brief Implementations and backports tied to Standard Header <tt>\<utility\></tt>.
 * @xrefitem std0utility "<utility>" "Header"
 * 
 */



#include "config.hpp"
................................................................................

#include "util/meta.hpp"
#include "util/type_traits.hpp"

//#include "type_traits.hpp"
//USING

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


namespace cxxomfort {
namespace cxxostd {
    /** 
     * @brief Expression for an unevaluated context.
     * @ingroup cxx11-backports
................................................................................
     * @xrefitem std:utility "<utility>" ""
     */
    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

		#if defined(CXXO_ADD_declval)
namespace std { 
	using ::cxxomfort::cxxostd::declval;
} //std::
			//#undef CXXO_ADD_declval
		#endif

	#endif






	#include "impl/n3668-exchange.hpp"
	#include "impl/14-integer_sequence.hpp"
	#include "impl/17-as_const.hpp"


//
// in_place_t, etc
//
	#if (defined( CXXOFLAG_NO_STD_USING ) && CXXOFLAG_NO_STD_USING>0)
	#else

		#if (CXXOMFORT_CXX_STD < 2017)

namespace std {

    struct in_place_t { };
			#if (CXXOMFORT_CXX_STD >= 2014)
    constexpr in_place_t in_place{};
			#else
    CXXO_CONSTEXPR const in_place_t in_place = {};
			#endif

    namespace detail {

        template< typename T >
        struct in_place_type_tag {
        };

................................................................................
    template <size_t I>       struct in_place_index_t { 
    };

// 
// in_place_type , in_place_index
//

			#if (CXXOMFORT_CXX_STD == 2014)
    // here we have template variables

    template <class T>
    CXXOMFORT_CXX17_CODE(inline, ) constexpr in_place_type_t<T> in_place_type = {};

    template <size_t I>
    CXXOMFORT_CXX17_CODE(inline, ) constexpr in_place_index_t<I> in_place_index{};

				#define CXXO_in_place_type_t(T) ::std::in_place_type_t<T>
    
			#else

// c++<14 does not have inline variables so we use the 
// overloaded function name reference from 
// https://vector-of-bool.github.io/2016/10/30/standard-in-place.html


struct in_place_tag { };
................................................................................
void in_place_type (detail::in_place_type_tag<T> = detail::in_place_type_tag<T>() ) CXXO_NOEXCEPTNOTHROW {
}

template <size_t I>
void in_place_index (detail::in_place_index_tag<I> = detail::in_place_index_tag<I>() ) CXXO_NOEXCEPTNOTHROW {
}

				#define CXXO_in_place_type_t(T) void(&)( ::std::detail::in_place_type_tag<T> )

			#endif


} // std
		#endif // c++17 for in_place_...

	#endif // std_using

#endif // CXX_STD >= 1997

#endif

/**
 * @page std0utility <utility>
 * @brief Backports related to Standard Header <tt><utility></tt> 
 * 
 * @code
 * #include <cxxomfort/utility.hpp>
 * @endcode
 * 
 * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>)
 * 
 * Interfaces defined in this file:
 * 
 * * @c move() (C++11) - moves an object from an "rvalue reference".
 * * @c declval() (C++11) - declare variables in an unevaluated context.
 * * @c exchange() (C++14) - propagate a modification to two variables.
 * * @c integer_sequence , @c index_sequence (C++14) (from C++11 onward only).
 * * @c as_const() , @c as_ptr_const() (C++17) - a <tt>const</tt> view of data.
 * * @c in_place_t , @c in_place_type_t (C++17).
 *
 * See also @ref std0type_traits , @ref std0tuple , 
 * <a href="https://en.cppreference.com/w/cpp/header/utility">\<utility\> \@cppreference</a>.
 * 
 * See also @ref cxxo-sup-utility (supplemental).
 * 
 * */

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

23
24
25
26
27
28
29



30
31
32
33
34
35
36
..
75
76
77
78
79
80
81







82
83
84
85
86
87
88
find_inversion|Iterator|(Iterator ini, Iterator fin, Comparison less)|
find_last_if|Iterator|(Iterator ini, Iterator fin, Predicate f)|
find_not|Iterator|(Iterator ini, Iterator fin, Value t)|
find_if_not|Iterator|(Iterator ini, Iterator fin, Predicate f)|
transform_inplace|Iterator|(Iterator ini, Iterator fin, Function f)|
transform_inplace_if|Iterator|(Iterator ini, Iterator fin, Function f, Predicate p)|
transform_n|Iterator|(Iterator ini, Integer n, DestIterator out, Function f)|



#functional
ptr_fun|nullary_functor|(Ret(*fn)())|
constant_fn|constant_function<T>|(T t)|
make_equivalence|equivalent_to<void>|()|
fnref|function_ref<Signature>|(function or functoid name)|
#iterator
ssize|ptrdiff_t|(Object&)|
................................................................................
make_string_view|basic_string_view<Char>|(basic_string<Char>)|
make_string_view|basic_string_view<Char>|(Char[N])|
#tuple
tuple_index|with.[value]|<type, Tuple>|
tuple_shift|tuple<A_{2...n}>|(tuple<A_{1...n}>)|
tuple_pop|tuple<A_{1...n-1}>|(tuple<A_{1...n}>)|
#utility







v_in_place_type|std::in_place_type_t<T>|()|
v_in_place_index|std::in_place_index_t<Ind>|()|
CXXO_in_place_type(T)|std::in_place_type_t<T>|(type T)|
CXXO_in_place_index(I)|std::in_place_index_t<I>|(size_t I)|
#i12n
#fixed_vector
#mistack







>
>
>







 







>
>
>
>
>
>
>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
..
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
find_inversion|Iterator|(Iterator ini, Iterator fin, Comparison less)|
find_last_if|Iterator|(Iterator ini, Iterator fin, Predicate f)|
find_not|Iterator|(Iterator ini, Iterator fin, Value t)|
find_if_not|Iterator|(Iterator ini, Iterator fin, Predicate f)|
transform_inplace|Iterator|(Iterator ini, Iterator fin, Function f)|
transform_inplace_if|Iterator|(Iterator ini, Iterator fin, Function f, Predicate p)|
transform_n|Iterator|(Iterator ini, Integer n, DestIterator out, Function f)|
all_on|bool|[FuncIterator ini, FuncIterator fin, Value v)|
any_on|bool|[FuncIterator ini, FuncIterator fin, Value v)|
none_on|bool|[FuncIterator ini, FuncIterator fin, Value v)|
#functional
ptr_fun|nullary_functor|(Ret(*fn)())|
constant_fn|constant_function<T>|(T t)|
make_equivalence|equivalent_to<void>|()|
fnref|function_ref<Signature>|(function or functoid name)|
#iterator
ssize|ptrdiff_t|(Object&)|
................................................................................
make_string_view|basic_string_view<Char>|(basic_string<Char>)|
make_string_view|basic_string_view<Char>|(Char[N])|
#tuple
tuple_index|with.[value]|<type, Tuple>|
tuple_shift|tuple<A_{2...n}>|(tuple<A_{1...n}>)|
tuple_pop|tuple<A_{1...n-1}>|(tuple<A_{1...n}>)|
#utility
as_bytes_view|const_bytes_view|(void* ptr, size_t len)|
as_bytes_view|const_bytes_view|(array_ref<T> view)|
hexdump|int|(array_ref<char> dest, const_bytes_view src)|
hexdump|int|(array_ref<char> dest, array_ref<char const> src)|
hexdump|int|(array_ref<char> dest, void* ptr, size_t size)|
hexload|int|(array_ref<byte> dest, string_view src)|
hexload|int|(vector<byte> dest, string_view src)|
v_in_place_type|std::in_place_type_t<T>|()|
v_in_place_index|std::in_place_index_t<Ind>|()|
CXXO_in_place_type(T)|std::in_place_type_t<T>|(type T)|
CXXO_in_place_index(I)|std::in_place_index_t<I>|(size_t I)|
#i12n
#fixed_vector
#mistack