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

Overview
Comment:Commit 2020-07-20 - One (1) is the lowest biggest thing.

Fixes a few issues in algorithm and adds to the base feature set.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | clang_min_400 | y2020 | gcc_min_505 | pre-release
Files: files | file ages | folders
SHA3-256: e6c8807ace07f02a908c2be52882d9189eb6a2c141f9b479a8e31803839ae808
User & Date: luismachuca 2020-07-21 05:41:38
Context
2020-07-26
07:03
Commit 2020-07-24 - Fixes for C++20, Clang and MSVC.

Promotes ssize(), de-promotes make_array(), adds and fixes features to use under more recent Clang and MSVC versions. check-in: 22a54863 user: luismachuca tags: clang_min_400, gcc_min_408, msvc_min_1600, release, stable, y2020

2020-07-21
05:41
Commit 2020-07-20 - One (1) is the lowest biggest thing.

Fixes a few issues in algorithm and adds to the base feature set. check-in: e6c8807a user: luismachuca tags: clang_min_400, y2020, gcc_min_505, pre-release

2020-06-19
01:38
Commit 2020-06-18 - MSVC compatibility fixes and Geany-tag fixes.

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

Changes

Changes to cxxomfort/CHANGELOG.txt.

















1
2
3
4
5
6
7
















Commit 2020-06-18 - MSVC compatibility fixes and Geany-tag fixes.

  *  functional: Extended <tt>invoke</tt> to work on MSVC 2010, 2012.
  *  string: Fixed <tt>hash</tt> specs for string in MSVC 2012.
  *  system_error: Fixed <tt>fix::to_errc</tt> in MSVC 2012.
  *  type_traits: Fixed multiple definition of <tt>remove_all_extents</tt> in MSVC >= 2010.

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







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Commit 2020-07-20 - One (1) is the lowest biggest thing.

Fixes a few issues in algorithm and adds to the base feature set.

  *  cxxomfort: Moved tinyint out of cstdint and made into a utility.
  *  cxxomfort: Added utility <tt>rvoid</tt>.
  *  cxxomfort: Added utility <tt>bool_once</tt>.
  *  cxxomfort: Added the <tt>CXXO_TYPEOF_OR</tt> and <tt>CXXO_DECLTYPE_OR</tt> macros.
  *  cstdint: Reimplemented <tt>tinyint , tinyuint</tt>.
  *  algorithm: Corrections to <tt>minmax</tt> backports.
  *  algorithm: Fixed a bug in <tt>is_sorted</tt> that returns <tt>false</tt> if all elements are the same.
  *  limits: Added specializations for <tt>tinyint , tinyuint</tt>.
  *  limits: Added <tt>const_lowest</tt> member for numeric_limits in C++11 onwards.
  *  memory: Added a testing <tt>make_shared</tt> implementation for GCC/Clang in C++03 mode.
  *  docs: Documentation fixes for most <tt>cxxomfort::fix::</tt> provisions.

Commit 2020-06-18 - MSVC compatibility fixes and Geany-tag fixes.

  *  functional: Extended <tt>invoke</tt> to work on MSVC 2010, 2012.
  *  string: Fixed <tt>hash</tt> specs for string in MSVC 2012.
  *  system_error: Fixed <tt>fix::to_errc</tt> in MSVC 2012.
  *  type_traits: Fixed multiple definition of <tt>remove_all_extents</tt> in MSVC >= 2010.

Changes to cxxomfort/cxxomfort/algorithm.hpp.

202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
...
348
349
350
351
352
353
354


355
356
357
358
359
360
361
362
363
364
365
...
416
417
418
419
420
421
422
423
424
425
426
 * @sa @cppref{algorithm/is_sorted}
 */
template <typename Iterator, typename Compare>
inline bool is_sorted (Iterator ini, Iterator fin, Compare less) {
    if (ini == fin) return true;
    Iterator prev= ini++;
    for (; ini != fin; ++ini, ++prev) {
        if (!less(*prev,*ini)) return false;
    }
    return true;
}

//! @overload is_sorted
template <typename Iterator>
inline bool is_sorted (Iterator ini, Iterator fin) {
................................................................................

/**
 * @page std0algorithm <algorithm>
 * @brief Backports related to Standard header <tt><algorithm></tt>
 * 
 * @code
 * #include <cxxomfort/algorithm.hpp>


 * @endcode
 * 
 * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>)
 *
 * @section Interfaces 
 * 
 * Backports defined in this section:
 * 
 * * @c all_of(), @c any_of(), @c none_of() (C++11) - check if elements of a sequence fit a predicate.
 * * @c copy_if(), @c copy_n(), @c partition_copy() (C++11) - copy elements from a sequence.
 * * @c find_if_not() (C++11) - check if elements @e don't fit a predicate.
................................................................................
 * 
 * * @c randomly.cpp https://notabug.org/lmachucabezzaza/cxxomfort-examples/src/master/examples/randomly.cpp
 * * <em>More pending...</em>
 *
 * @section also See Also
 * 
 * @see @ref cxxomfort/algorithm.hpp (header reference)
 * @see @cppref{algorithm} (cppreference) 
 * @see @ref std0numeric (std numeric algorithms) , @ref cxxo-sup-algorithm (supplemental)
 * 
 * */







|







 







>
>


<
<







 







|



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
...
348
349
350
351
352
353
354
355
356
357
358


359
360
361
362
363
364
365
...
416
417
418
419
420
421
422
423
424
425
426
 * @sa @cppref{algorithm/is_sorted}
 */
template <typename Iterator, typename Compare>
inline bool is_sorted (Iterator ini, Iterator fin, Compare less) {
    if (ini == fin) return true;
    Iterator prev= ini++;
    for (; ini != fin; ++ini, ++prev) {
        if (less(*ini,*prev)) return false;
    }
    return true;
}

//! @overload is_sorted
template <typename Iterator>
inline bool is_sorted (Iterator ini, Iterator fin) {
................................................................................

/**
 * @page std0algorithm <algorithm>
 * @brief Backports related to Standard header <tt><algorithm></tt>
 * 
 * @code
 * #include <cxxomfort/algorithm.hpp>
 * // or as part of:
 * #include <cxxomfort/backports.hpp>
 * @endcode
 * 


 * @section Interfaces 
 * 
 * Backports defined in this section:
 * 
 * * @c all_of(), @c any_of(), @c none_of() (C++11) - check if elements of a sequence fit a predicate.
 * * @c copy_if(), @c copy_n(), @c partition_copy() (C++11) - copy elements from a sequence.
 * * @c find_if_not() (C++11) - check if elements @e don't fit a predicate.
................................................................................
 * 
 * * @c randomly.cpp https://notabug.org/lmachucabezzaza/cxxomfort-examples/src/master/examples/randomly.cpp
 * * <em>More pending...</em>
 *
 * @section also See Also
 * 
 * @see @ref cxxomfort/algorithm.hpp (header reference)
 * @see @cppref{header/algorithm} (cppreference) 
 * @see @ref std0numeric (std numeric algorithms) , @ref cxxo-sup-algorithm (supplemental)
 * 
 * */

Changes to cxxomfort/cxxomfort/array.hpp.

1
2
3
4
5

6
7
8
9
10
11
12
..
55
56
57
58
59
60
61











62
63
64
65
66
67
68


69
70
71
72
73
74
75
#ifndef CXXOMFORT_ARRAY_HPP
#define CXXOMFORT_ARRAY_HPP
/**
 * @file
 * @brief Implementations and Backports for Standard header <code>\<array\></code>.

 * @xrefitem std0algorithm "<array>" "Header"
 */

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


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

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

#endif













/**
 * @page std0array <array>
 * @brief Backports related to Standard header <tt><array></tt> 
 * 
 * @code
#include <cxxomfort/array.hpp>


 * @endcode
 * 
 * Including the header brings up @c std::array , accounting for eg.: location being @c std::tr1::array where set up in C++03+TR1.
 * 
 * If no TR1 is found and the user has defined the macro <tt>CXXOMFORT_USE_INTERNAL_TR1</tt>, cxxomfort uses this header to provide its own implementation of <tt>array</tt>.
 * 
 * 





>







 







>
>
>
>
>
>
>
>
>
>
>






|
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
..
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef CXXOMFORT_ARRAY_HPP
#define CXXOMFORT_ARRAY_HPP
/**
 * @file
 * @brief Implementations and Backports for Standard header <code>\<array\></code>.
 * @ingroup cxx11-backports
 * @xrefitem std0algorithm "<array>" "Header"
 */

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


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

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

#endif

#ifdef DOXYGEN_DOC
namespace cxxomfort { namespace cxxostd {
}}
namespace std {
	/**
	 * @brief C++11 array class
	 * */
	 template <typename T, size_t N> class array {};
}
	
#endif

/**
 * @page std0array <array>
 * @brief Backports related to Standard header <tt><array></tt> 
 * 
 * @code
 * #include <cxxomfort/array.hpp>
 * // or as part of:
 * #include <cxxomfort/backports.hpp>
 * @endcode
 * 
 * Including the header brings up @c std::array , accounting for eg.: location being @c std::tr1::array where set up in C++03+TR1.
 * 
 * If no TR1 is found and the user has defined the macro <tt>CXXOMFORT_USE_INTERNAL_TR1</tt>, cxxomfort uses this header to provide its own implementation of <tt>array</tt>.
 * 
 * 

Changes to cxxomfort/cxxomfort/backports.hpp.

9
10
11
12
13
14
15


16
17
18

19
20
21
22
23
24
25
#include <cxxomfort/backports.hpp>
 * @endcode
 * 
 * Including this header brings up the base cxxomfort 
 * utilities as well as the available backports for the major 
 * standard headers in the library.
 * 


 * */
#include "config.hpp"
#include "base.hpp"


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








>
>



>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <cxxomfort/backports.hpp>
 * @endcode
 * 
 * Including this header brings up the base cxxomfort 
 * utilities as well as the available backports for the major 
 * standard headers in the library.
 * 
 * For additions specific to cxxomfort see @c library.hpp .
 * 
 * */
#include "config.hpp"
#include "base.hpp"
#include "cxxo-utils.hpp"

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

Changes to cxxomfort/cxxomfort/base.hpp.

1
2
3
4
5

6
7
8






9
10
11
12
13
14
15
..
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...
122
123
124
125
126
127
128

129
130
131
#ifndef CXXOMFORT_BASE_HPP
#define CXXOMFORT_BASE_HPP
/**
 * @file
 * @brief Minimal cxxomfort setup.

 * 
 * For more complete cxxomfort setup (includes more headers, adds new names 
 * and functions) include "cxxomfort.hpp".






 */

//#include <cstddef>
//#include <ciso646>
#include "config.hpp"
#include CXXO_INCLUDE_SYS(cstddef)

................................................................................
#include "./base/alignof.hpp" // alignof impl
#include "./base/nullptr.hpp" // nullptr
#include "./base/static_assert.hpp" // static_assert
#include "./base/cstdint.hpp" // c++11 integer types ([u]intNN_t)
#include "./base/iterator.hpp" // iter. accessors (begin/end, next/prev)
#include "./base/move.hpp" // move emulation
#include "./base/explicit_cast.hpp" // explicit cast operator
#if (CXXOMFORT_COMPILER_ID!=CXXO_COMPILERID_OW)
#endif

#endif

/**
 * @page cxxomfort-base
 * 
 * The set of basic features of cxxomfort. 
 * These features are included automatically when 
................................................................................
 * Except for this page all features should be explicitly included to the 
 * project by @c #include -ing the necessary header.
 * 
 * * @ref cxxomfort
 * * @ref cxx11-backports 
 * * @ref cxx14-backports
 * * @ref cxx17-backports

 * 
 * 
 */





>


|
>
>
>
>
>
>







 







<
<
<







 







>



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
24
25
26
27
28
29
30



31
32
33
34
35
36
37
...
126
127
128
129
130
131
132
133
134
135
136
#ifndef CXXOMFORT_BASE_HPP
#define CXXOMFORT_BASE_HPP
/**
 * @file
 * @brief Minimal cxxomfort setup.
 * @ingroup cxxomfort-base
 * 
 * For more complete cxxomfort setup (includes more headers, adds new names 
 * and functions), use one of these:
 * 
 * @code
 * #include <cxxomfort/backports.hpp> // base + backports
 * #include <cxxomfort/cxxomfort.hpp> // base + backports + library supplements
 * @endcode
 * 
 */

//#include <cstddef>
//#include <ciso646>
#include "config.hpp"
#include CXXO_INCLUDE_SYS(cstddef)

................................................................................
#include "./base/alignof.hpp" // alignof impl
#include "./base/nullptr.hpp" // nullptr
#include "./base/static_assert.hpp" // static_assert
#include "./base/cstdint.hpp" // c++11 integer types ([u]intNN_t)
#include "./base/iterator.hpp" // iter. accessors (begin/end, next/prev)
#include "./base/move.hpp" // move emulation
#include "./base/explicit_cast.hpp" // explicit cast operator



#endif

/**
 * @page cxxomfort-base
 * 
 * The set of basic features of cxxomfort. 
 * These features are included automatically when 
................................................................................
 * Except for this page all features should be explicitly included to the 
 * project by @c #include -ing the necessary header.
 * 
 * * @ref cxxomfort
 * * @ref cxx11-backports 
 * * @ref cxx14-backports
 * * @ref cxx17-backports
 * * @ref cxx20-backports 
 * 
 * 
 */

Changes to cxxomfort/cxxomfort/base/explicit_cast.hpp.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 * * @c @ref explicit_cast (as a synonym in C++11)
 * * @c CXXO_EXPLICIT_OPERATOR
 * 
 */

#include "../config.hpp"
#include "../base/move.hpp"
#include <iostream> // debug
#define CXXOMFORT_IMPLEMENTS_n2333 CXXO_IMPLSTATUS_EMULATION()
#define CXXOMFORT_IMPLEMENTS_n2437 CXXO_IMPLSTATUS_EMULATION()
#define CXXOMFORT_IMPLEMENTS_explicit_operator CXXOMFORT_IMPLEMENTS_n2333


#if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 2)
    #pragma message CXXO_NOTICE("enabled 'explicit operator' emulation")







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 * * @c @ref explicit_cast (as a synonym in C++11)
 * * @c CXXO_EXPLICIT_OPERATOR
 * 
 */

#include "../config.hpp"
#include "../base/move.hpp"
//#include <ostream> // debug
#define CXXOMFORT_IMPLEMENTS_n2333 CXXO_IMPLSTATUS_EMULATION()
#define CXXOMFORT_IMPLEMENTS_n2437 CXXO_IMPLSTATUS_EMULATION()
#define CXXOMFORT_IMPLEMENTS_explicit_operator CXXOMFORT_IMPLEMENTS_n2333


#if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 2)
    #pragma message CXXO_NOTICE("enabled 'explicit operator' emulation")

Changes to cxxomfort/cxxomfort/config.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
..
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
/**
 * @file
 * @author Luis Machuca Bezzaza
 * @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 20200227UL
//! Defines the library version 
//! @deprecated 
#define CXXOMFORT_VERSION CXXOMFORT_DATE

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


/*
 * Behaviour macros
 */

#if defined(DOXYGEN_DOC)
/**
................................................................................
 * 
 * If this macro is defined and has a value <code>!=0</code>, 
 * cxxomfort headers will @e not add their backports to 
 * namespace @c std (eg.: "<code>std::as_const</code>). This option 
 * does not affect utilities defined as "base" (eg.: @c nullptr_t ).
 */
#define CXXOFLAG_NO_STD_USING 0

/**
 * @def CXXOFLAG_SHADOW_KEYWORD_constexpr
 * @ingroup cxxomfort-config
 * @brief Makes the compiler ignore @c constexpr keyword in standard where not supported (C++03).
 * 
 * If this macro is defined and has a value <code>>=0</code>, 
 * cxxomfort will, when in C++03 mode, "#define away" the word @c constexpr 
 * when found.
 */
#define CXXOFLAG_SHADOW_KEYWORD_constexpr 0


/**
 * @def CXXOFLAG_INCLUDE_PATH
 * @ingroup cxxomfort-config
 * @brief Set path to C++ compiler headers.
 * @note Customization point.
 * 







>
>
>
>



|






<







 







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







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
..
35
36
37
38
39
40
41












42
43
44
45
46
47
48
/**
 * @file
 * @author Luis Machuca Bezzaza
 * @ingroup cxxomfort-config
 *
 * This file contains configuration macros used by the cxxomfort library
 * and it is not intended to be directly used.
 * 
 * If you are directly including this 
 * perhaps you meant to include <tt>cxxomfort/backports.hpp</tt>.
 * 
 */

//! Library version and release date as YYYYMMDD
#define CXXOMFORT_DATE 20200720UL
//! Defines the library version 
//! @deprecated 
#define CXXOMFORT_VERSION CXXOMFORT_DATE

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


/*
 * Behaviour macros
 */

#if defined(DOXYGEN_DOC)
/**
................................................................................
 * 
 * If this macro is defined and has a value <code>!=0</code>, 
 * cxxomfort headers will @e not add their backports to 
 * namespace @c std (eg.: "<code>std::as_const</code>). This option 
 * does not affect utilities defined as "base" (eg.: @c nullptr_t ).
 */
#define CXXOFLAG_NO_STD_USING 0













/**
 * @def CXXOFLAG_INCLUDE_PATH
 * @ingroup cxxomfort-config
 * @brief Set path to C++ compiler headers.
 * @note Customization point.
 * 

Changes to cxxomfort/cxxomfort/cstddef.hpp.

31
32
33
34
35
36
37
38


39
40
41
42
43
44
45
..
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
	typedef decltype(NULL) NULL_t;
#elif (CXXO_COMPILER_SUPPORT_typeof)
	typedef __typeof__(NULL) NULL_t;
#else
	typedef int NULL_t;
#endif




struct enum_sample {
	enum type { value0 = 0, value1 = 1};
	enum { value = sizeof(type) };
};



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







|
>
>







 







>
>
|







|












31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
..
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
	typedef decltype(NULL) NULL_t;
#elif (CXXO_COMPILER_SUPPORT_typeof)
	typedef __typeof__(NULL) NULL_t;
#else
	typedef int NULL_t;
#endif

/**
 * @brief Sample enum that can be used to figure out size and signedness of enums at compiletime.
 * */
struct enum_sample {
	enum type { value0 = 0, value1 = 1};
	enum { value = sizeof(type) };
};



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

/**
 * @page std0cstddef <cstddef>
 * @brief Features related to Standard header <tt><cstddef></tt>.
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 * 
 * @section Interfaces 
 * 
 * Features included in this section and mapped to global nsmespace or <tt>std::</tt>:
 * 
 * * @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 std::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/cstdint.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
..
55
56
57
58
59
60
61

62
63
64
65
66
67
68
#ifndef CXXOMFORT_CSTDINT_HPP
#define CXXOMFORT_CSTDINT_HPP
/**
 * @file


 *



 */


#include <cxxomfort/base.hpp>

#if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
#pragma message CXXO_NOTICE("enabled <cstdint> support.")
#endif
#if (CXXOMFORT_CXX_STD>=2011)
#include <cstdint>
#else
#include <inttypes.h>
#include <cxxomfort/base/cstdint.hpp>
#endif


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

namespace cxxomfort { namespace fix {

struct tinyint {
	public:
	CXXO_CONSTEXPR 
	explicit tinyint (uint8_t c= 0) CXXO_NOEXCEPTNOTHROW 
	: u(c) {}
	tinyint& operator= (uint8_t x) CXXO_NOEXCEPTNOTHROW {
		u= x; 
		return *this;
	}
	operator unsigned int () const { return u; }
	private:
	uint8_t u;
};
static_assert (sizeof(tinyint)==1, "tinyint check size");
static_assert (alignof(tinyint)==1, "tinyint check align");


} }  // cxxomfort::fix



/**
 * @page std0cstdint <cstdint>
 * @brief Features related to Standard header <code>\<cstdint\></code>.
 * 
 * The features declared here include mostly the special type names 
 * for the supported integer ("integral") types:
................................................................................
 * * Exact size integer typedefs <code>[u]int<em>n</em>_t</code> such as @c int32_t .
 * * Fast arithmetic integer typedefs <code>uint_fast<em>n</em>_t</code> such as @c int_fast32_t .
 * * Maximum-size integer typedef @c intmax_t , @c uintmax_t .
 * * Pointer-sized integer typedefs @c intptr_t , @c uintptr_t .
 * 
 * The following non-backport interfaces are defined:
 * 

 * * @c cxxomfort::fix::uint8_t - a true numeric integral type with the semantics of @c u8int_t .
 * 
 * For platforms without access to a Standard <code><stdint.h></code>, 
 * cxxomfort makes this possible by providing a copy of 
 * <em>pstdint.h the Portable stdint</em>.
 * 
 * @warning For the definition of these types, cxxomfort assumes that 




>
>
|
>
>
>




>






|


<



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







 







>







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
..
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef CXXOMFORT_CSTDINT_HPP
#define CXXOMFORT_CSTDINT_HPP
/**
 * @file
 * @brief Implementations and additions tied to Standard header <tt>\<cstdint\></tt>.
 * @ingroup std0cstdint
 * 
 * This file will, when included, attempt to find and @c \#include  whichever 
 * headers provide the integer named types such as @c int16_t .
 * 
 */


#include <cxxomfort/base.hpp>
#include <cxxomfort/cxxo-utils.hpp> // tinyint_
#if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
#pragma message CXXO_NOTICE("enabled <cstdint> support.")
#endif
#if (CXXOMFORT_CXX_STD>=2011)
#include <cstdint>
#else
//#include <inttypes.h>
#include <cxxomfort/base/cstdint.hpp>
#endif


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


namespace cxxomfort { 

/**
 * @brief Numeric type that models a 1-byte signed int (like @c int8_t ).
 * */
typedef cxxomfort::tinyint_<signed char> tinyint;
/**
 * @brief Numeric type that models a 1-byte unsigned int (like @c uint8_t ).
 * */
typedef cxxomfort::tinyint_<unsigned char> tinyuint;

static_assert (sizeof(tinyint)==1 && alignof(tinyint)==1, "tinyint check");
static_assert (alignof(tinyuint)==1 && alignof(tinyuint)==1, "tinyuint check");


namespace fix {
	using cxxomfort::tinyint;
	using cxxomfort::tinyuint;
}

}

/**
 * @page std0cstdint <cstdint>
 * @brief Features related to Standard header <code>\<cstdint\></code>.
 * 
 * The features declared here include mostly the special type names 
 * for the supported integer ("integral") types:
................................................................................
 * * Exact size integer typedefs <code>[u]int<em>n</em>_t</code> such as @c int32_t .
 * * Fast arithmetic integer typedefs <code>uint_fast<em>n</em>_t</code> such as @c int_fast32_t .
 * * Maximum-size integer typedef @c intmax_t , @c uintmax_t .
 * * Pointer-sized integer typedefs @c intptr_t , @c uintptr_t .
 * 
 * The following non-backport interfaces are defined:
 * 
 * * @c cxxomfort::tinyint , @c cxxomfort::tinyuint - true numerical types with the same semantics of <tt>signed char, unsigned char</tt>.
 * * @c cxxomfort::fix::uint8_t - a true numeric integral type with the semantics of @c u8int_t .
 * 
 * For platforms without access to a Standard <code><stdint.h></code>, 
 * cxxomfort makes this possible by providing a copy of 
 * <em>pstdint.h the Portable stdint</em>.
 * 
 * @warning For the definition of these types, cxxomfort assumes that 

Changes to cxxomfort/cxxomfort/cuchar.hpp.

31
32
33
34
35
36
37


38
39
40
41
42
43
 * This section defines the @c char16_t and @c char32_t types in C++03 mode, 
 * besides the flag @c CXXO_charn_t_typedefs that tells whether the names are 
 * made available as typedefs or as their own separate types, depending on the compiler.
 * 
 * The types are made available for storage only; without intervening in the lexer 
 * (and thus in the compiler somehwow), it is not really possible to write 
 * extended char typed chaarcters in the source code, let alone literal strings of them.


 * 
 * Interfaces defined:
 * 
 * * @c char16_t , @c char32_t (C++11) in C++03 if they would be typedef.
 * 
 * */







>
>






31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 * This section defines the @c char16_t and @c char32_t types in C++03 mode, 
 * besides the flag @c CXXO_charn_t_typedefs that tells whether the names are 
 * made available as typedefs or as their own separate types, depending on the compiler.
 * 
 * The types are made available for storage only; without intervening in the lexer 
 * (and thus in the compiler somehwow), it is not really possible to write 
 * extended char typed chaarcters in the source code, let alone literal strings of them.
 * 
 * @section Interfaces 
 * 
 * Interfaces defined:
 * 
 * * @c char16_t , @c char32_t (C++11) in C++03 if they would be typedef.
 * 
 * */

Changes to cxxomfort/cxxomfort/cxxo-utils.hpp.

1
2
3
4
5
6

7
8
9
10
11
12
13
14
15


16
17
18
19


20
21
22
23
24



25
26

































































27
28
29
















30
31
32
33
34
35
36
37
38









39
40
41
42
43
44

45


46
47
48

49
50
51
52
53
54
55
56
..
61
62
63
64
65
66
67



68









































































































































































































69
70
71































72
#ifndef CXXOMFORT_CXXO_UTILS_HPP
#define CXXOMFORT_CXXO_UTILS_HPP

/**
 * @file
 * @brief Small utilities central to cxxomfort, not categorized under backport headers.

 * 
 * @code
#include <cxxomfort/cxxo-utils.hpp>
 * @endcode
 * 
 * Including this header brings up the base cxxomfort 
 * utilities as well.
 * 
 * Defined here are:


 * 
 * * @c rvoid (regular @c void )
 * * @c noop_fn , noop (noop general function)
 * * @c outp (output parameter wrapper)


 * 
 * */
#include "config.hpp"
#include "base.hpp"





namespace cxxomfort {


































































/**
 * @brief regular @c void 
















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










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

};




/**

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














































































































































































































} // cxxomfort 

































#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
...
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
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
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
399
400
401
402
403
404
#ifndef CXXOMFORT_CXXO_UTILS_HPP
#define CXXOMFORT_CXXO_UTILS_HPP

/**
 * @file
 * @brief Small utilities central to cxxomfort, not categorized under backport headers.
 * @ingroup cxxomfort-utils
 * 
 * @code
#include <cxxomfort/cxxo-utils.hpp>
 * @endcode
 * 
 * Including this header brings up the base cxxomfort 
 * utilities as well.
 * 
 * */
#include "config.hpp"
#include "base.hpp"



/**
 * @{
 * @ingroup cxxomfort-utils
 * 
 * */



/*
 * codegen utilities
 * */

namespace cxxomfort {


/**
 * @brief Automatically generates relational operators between the classes @a L and @a R .
 * @addtogroup cxxomfort-codegen
 * 
 * If classes @a L and @a R have working operators <tt>==</tt> and <tt><</tt>, invoking this macro 
 * <b>outside</b> their class definition will automatically generate compatible 
 * non-member operators != , <= , >, >= .
 * 
 * All generated operators have the signature <tt>bool(L const&, R const&)</tt> and are @c noexcept or @c throw() .
 * 
 * */
#define CXXO_GENERATE_RELATIONALS2(L,R) \
inline bool operator!= (L const& vl, R const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl==vr); } \
inline bool operator>  (L const& vl, R const& vr) CXXO_NOEXCEPTNOTHROW { return vr<vl; } \
inline bool operator<= (L const& vl, R const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl>vr); } \
inline bool operator>= (L const& vl, R const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl<vr); } \

/**
 * @brief Automatically generates nonmember relational operators >, >=, <= and != .
 * @addtogroup cxxomfort-codegen
 * 
 * If class @a T has working operators <tt>==</tt> and <tt><</tt>, invoking this macro 
 * <b>outside</b> the class definition will automatically generate compatible 
 * non-member operators != , <= , >, >= .
 * 
 * All generated operators return @c bool and are @c noexcept or @c throw() .
 * 
 * */
#define CXXO_GENERATE_RELATIONALS(T) \
inline bool operator!= (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl==vr); } \
inline bool operator>  (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return vr<vl; } \
inline bool operator<= (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl>vr); } \
inline bool operator>= (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl<vr); } \

#define CXXO_GENERATE_FRIEND_RELATIONALS(T) \
friend bool operator!= (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl==vr); } \
friend bool operator>  (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return vr<vl; } \
friend bool operator<= (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl>vr); } \
friend bool operator>= (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl<vr); } \

#define CXXO_GENERATE_RELATIONALS_T(T) \
template <TPARAMS> \
inline bool operator!= (T<TARGS> const& vl, T<TARGS> const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl==vr); } \
template <TPARAMS> \
inline bool operator>  (T<TARGS> const& vl, T<TARGS> const& vr) CXXO_NOEXCEPTNOTHROW { return vr<vl; } \
template <TPARAMS> \
inline bool operator<= (T<TARGS> const& vl, T<TARGS> const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl>vr); } \
template <TPARAMS> \
inline bool operator>= (T<TARGS> const& vl, T<TARGS> const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl<vr); } \



}

// ----

/*
 * type utilities
 * 
 * */

namespace cxxomfort {


/**
 * @brief regular @c void 
 * 
 * This is basically a "null type": it can only be default-constructed and copy-constructed, it does not hold a value, and it can be returned from functions.
 * 
 * It is intended to be used in contexts where you need to do nothing but 
 * can't use @c void for that (for example, for returning a value from a function).
 * 
 * Regular void is based on proposal @e p0146r1 which defines an operable void type with the following properties:
 * 
 * * @c rvoid can be default-constructed
 * * @c rvoid can be copy-constructed and copy-assigned
 * * All instances of @c rvoid compare equal 
 * * Arrays of @c rvoid can be made
 * * Functions can take @c rvoid as arguments, and return @c rvoid 
 * 
 * @see @wg21{p0146r1}
 * 
 * */
struct rvoid {
#if (CXXOMFORT_CXX_STD >= 2011)
	constexpr explicit rvoid () = default;
#else
	explicit rvoid () CXXO_NOEXCEPTNOTHROW {};
#endif
};

//! All instances of @c rvoid compare equal:
CXXO_CONSTEXPR static inline
bool operator== (rvoid const, rvoid const) CXXO_NOEXCEPTNOTHROW { return true; }
//! All instances of @c rvoid compare equal:
CXXO_CONSTEXPR static inline 
bool operator!= (rvoid const, rvoid const) CXXO_NOEXCEPTNOTHROW { return false; }

// ----

/**
 * @brief noop function 
 * */
struct noop_t {

    void operator() (...) const CXXO_NOEXCEPTNOTHROW {  }

};
//! noop functor - when evaluated with arguments, it does nothing
static CXXO_CONSTEXPR14	const noop_t noop = {};


/**
 * @brief denotes a reference used as an output argument to a function.
 * @see https://foonathan.net/2016/10/output-parameter/
 * */
template <typename T>
class outp {
	public:
	typedef T value_type;
#if (CXXOMFORT_CXX_STD >= 2011)
	outp () = delete;
................................................................................
	operator T& () CXXO_NOEXCEPT { return t; }
	operator T const& () const CXXO_NOEXCEPTNOTHROW { return t; }
	
	private:
	T& t;
};

// 
// priority tag
// 

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

template <>
struct prio<0> { enum { value = 0 }; };


// 
// tinyint_ impl
// 

template <typename Base> struct tinyint_;

template <typename T, typename B>
CXXO_CONSTEXPR static inline 
T to_integral (tinyint_<B> const) CXXO_NOEXCEPTNOTHROW ;


template <typename Base>
struct tinyint_ {
	static_assert( sizeof(Base)==1, "only basic types signed char, unsigned char allowed");
	public:
#if (CXXOMFORT_CXX_STD>=2014)
	constexpr tinyint_ () noexcept = default;
	constexpr tinyint_ (tinyint_ const&) noexcept = default;
	constexpr tinyint_& operator= (tinyint_ const&) noexcept = default;
#elif (CXXOMFORT_CXX_STD>=2011)
	constexpr tinyint_ () noexcept = default;
	constexpr tinyint_ (tinyint_ const&) noexcept = default;
	tinyint_& operator= (tinyint_ const&) noexcept = default;
#else
	// tinyint_ (tinyint_ const& t) ; // autogenerated
	//tinyint_& operator= (tinyint_ const&) throw() ; // autogenerated
#endif
	CXXO_CONSTEXPR 
	tinyint_ (Base const b= 0) CXXO_NOEXCEPTNOTHROW 
	: v(b) {}
	template <typename Others> CXXO_CONSTEXPR
	explicit tinyint_ (Others const o) CXXO_NOEXCEPTNOTHROW 
	: v(static_cast<Base>(o)) {}

	tinyint_& operator= (Base const b) CXXO_NOEXCEPTNOTHROW {
		v= b; 
		return *this;
	}

	// tinyints are explicitly convertible to any type to which their base form casts
	template <typename T>
	CXXO_EXPLICIT_OPERATOR(T) () const CXXO_NOEXCEPTNOTHROW {
		return v;
	}

	tinyint_ const& operator+ () const CXXO_NOEXCEPTNOTHROW { return *this; }
	CXXO_CONSTEXPR 
	tinyint_  operator- () const CXXO_NOEXCEPTNOTHROW { return -v; }
	CXXO_CONSTEXPR 
	tinyint_  operator~ () const CXXO_NOEXCEPTNOTHROW { return ~v; }

	tinyint_& operator++ () CXXO_NOEXCEPTNOTHROW { ++v; return *this; }
	tinyint_& operator-- () CXXO_NOEXCEPTNOTHROW { --v; return *this; }

	friend  CXXO_CONSTEXPR 
	bool operator== (tinyint_ const n1, tinyint_ const n2) CXXO_NOEXCEPTNOTHROW {
		return n1.v == n2.v;
	}
	friend 
	bool operator< (tinyint_ const n1, tinyint_ const n2) CXXO_NOEXCEPTNOTHROW {
		return n1.v < n2.v;
	}
	
	tinyint_& operator+= (tinyint_ const x2) CXXO_NOEXCEPTNOTHROW { v+= x2.v; return *this; }
	tinyint_& operator-= (tinyint_ const x2) CXXO_NOEXCEPTNOTHROW { v-= x2.v; return *this; }
	tinyint_& operator*= (tinyint_ const x2) CXXO_NOEXCEPTNOTHROW { v*= x2.v; return *this; }
	tinyint_& operator/= (tinyint_ const x2) CXXO_NOEXCEPTNOTHROW { v/= x2.v; return *this; }
	tinyint_& operator%= (tinyint_ const x2) CXXO_NOEXCEPTNOTHROW { v%= x2.v; return *this; }
	tinyint_& operator<<= (tinyint_ const x2) CXXO_NOEXCEPTNOTHROW { v<<= x2.v; return *this; }
	tinyint_& operator>>= (tinyint_ const x2) CXXO_NOEXCEPTNOTHROW { v>>= x2.v; return *this; }
	
	
	template <typename T> friend CXXO_CONSTEXPR
	T to_integral (tinyint_ const x) CXXO_NOEXCEPTNOTHROW {
		return static_cast<T>(x.v);
	}

	Base v;
};

typedef tinyint_<signed char> tinyint;
typedef tinyint_<unsigned char> tinyuint;

// relationals

CXXO_GENERATE_RELATIONALS(tinyint);
CXXO_GENERATE_RELATIONALS(tinyuint);

/*
 * arithmetic operators with other types promotes to them
 * */

#define TINYINT_OPERATOR_i(IntType,SYM)  \
CXXO_CONSTEXPR static inline  \
IntType operator SYM (tinyint n1, IntType n2) CXXO_NOEXCEPTNOTHROW { \
	return to_integral<IntType>(n1) SYM n2; \
} \
CXXO_CONSTEXPR static inline  \
IntType operator SYM (IntType n1, tinyint n2) CXXO_NOEXCEPTNOTHROW { \
	return n1 SYM to_integral<IntType>(n2); \
} \

#define TINYINT_OPERATOR_u(IntType,SYM)  \
CXXO_CONSTEXPR static inline  \
IntType operator SYM (tinyuint n1, IntType n2) CXXO_NOEXCEPTNOTHROW { \
	return to_integral<IntType>(n1) SYM n2; \
} \
CXXO_CONSTEXPR static inline  \
IntType operator SYM (IntType n1, tinyuint n2) CXXO_NOEXCEPTNOTHROW { \
	return n1 SYM to_integral<IntType>(n2); \
} \


TINYINT_OPERATOR_i(signed short,+);
TINYINT_OPERATOR_i(signed short,-);
TINYINT_OPERATOR_i(signed short,*);
TINYINT_OPERATOR_i(signed short,/);
TINYINT_OPERATOR_i(signed short,%);
TINYINT_OPERATOR_i(signed int,+);
TINYINT_OPERATOR_i(signed int,-);
TINYINT_OPERATOR_i(signed int,*);
TINYINT_OPERATOR_i(signed int,/);
TINYINT_OPERATOR_i(signed int,%);
TINYINT_OPERATOR_i(signed long,+);
TINYINT_OPERATOR_i(signed long,-);
TINYINT_OPERATOR_i(signed long,*);
TINYINT_OPERATOR_i(signed long,/);
TINYINT_OPERATOR_i(signed long,%);

TINYINT_OPERATOR_u(unsigned short,+);
TINYINT_OPERATOR_u(unsigned short,-);
TINYINT_OPERATOR_u(unsigned short,*);
TINYINT_OPERATOR_u(unsigned short,/);
TINYINT_OPERATOR_u(unsigned short,%);
TINYINT_OPERATOR_u(unsigned int,+);
TINYINT_OPERATOR_u(unsigned int,-);
TINYINT_OPERATOR_u(unsigned int,*);
TINYINT_OPERATOR_u(unsigned int,/);
TINYINT_OPERATOR_u(unsigned int,%);
TINYINT_OPERATOR_u(unsigned long,+);
TINYINT_OPERATOR_u(unsigned long,-);
TINYINT_OPERATOR_u(unsigned long,*);
TINYINT_OPERATOR_u(unsigned long,/);
TINYINT_OPERATOR_u(unsigned long,%);


#undef TINYINT_OPERATOR_i
#undef TINYINT_OPERATOR_u



// 
// bool_once
// 

/**
 * @brief Evaluates a @c bool variable and "unchecks" it, returnnig its old value.
 * @returns The previously held value of @a flag .
 * @param flag A @e writable @c bool type value.
 * 
 * The use case is such as performing repetitive tasks eg.: inside a loop, but where the very first iteration of the loop has a different, added code path:
 * 
 * @code
 * 
 * // before
 * 
 * // this falls outside of the loop and can cause code desycn due to repetition
 * repetitive_task(x, y, 0);
 * for (size_t idx= 1; idx < last; ++i) {
 * 		separation_task(w);
 * 		repetitive_task(x, y, idx);
 * }
 * 
 * // after
 * 
 * bool first= true;
 * for (size_t idx= 0; idx < last; ++idx) {
 * 		if (!bool_once(first)) {
 * 			separation_task(w);
 * 		}
 * 		// now the task is strictly part of the loop
 * 		repetitive_task(x, y, idx);
 * }
 * @endcode
 * 
 * See also <tt>std::exchange()</tt>.
 * 
 * */
bool bool_once (bool& flag) CXXO_NOEXCEPTNOTHROW {
	return flag ? (flag=false), true : false;
} 


} // cxxomfort 


/**
 * @}
 * 
 * */

/**
 * @page cxxomfort-utils
 * @brief Cxxomfort independent utilities
 * 
 * @c cxxomfort ships with a few independent utilities not dependent on features of specific C++ Standards. These are accessed by directly including the header:
 * 
 * @code
 * #include <cxxomfort/cxxo-utils.hpp>
 * // alternatively included from general cxxomfort tools
 * #include <cxxomfort/backports.hpp>
 * @endcode
 * 
 * The features provided by the header include:
 * 
 * Defined here are:
 * 
 * * @ref @c cxxomfort::rvoid (regular @c void ) based on early @wg21{p0146r1}.
 * * @c noop_fn , noop (noop general function)
 * * @ref @c cxxomfort::bool_once() (unchecks a @c bool l-value that checks @c true )
 * * @ref @c cxxomfort::outp (output parameter wrapper)
 * * @ref @c cxxomfort::prio<N> (priority tag)
 * * Base implementation for tiny[u]int.
 * * @c CXXO_GENERATE_RELATIONALS , @c CXXO_GENERATE_RELATIONALS2
 * 
 * */

#endif

Changes to cxxomfort/cxxomfort/cxxomfort.hpp.

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
..
21
22
23
24
25
26
27
28

29
30
31
32
33
34
35
/**
 * @file cxxomfort.hpp
 * @brief Backports library for C++.
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 * @license MIT License (see LICENSE.txt)
 * @mainpage Cxxomfort Backport Tools for C++.
 *
 * Cxxomfort is a small, header-only library that backports nifty features and goodies from C++11 and later versions to previous versions such as C++03, as well as featuring some proposals still in the works. It was written to facilitate working with the evolving C++ Standard when I was coming back to the language during the C++11 transition, as well as reduce stress of code rewrite while at the same time assisting in backwards and forwards portability.
 * 
 * This is a precompiled help built using 
 * <a href="http://www.doxygen.nl/" target="_blank">Doxygen</a> and covers only 
 * the published interfaces (names, functions, etc) and their usage; for 
 * information on installation and configuration, check the repository's page:
 *
 * http://ryan.gulix.cl/fossil.cgi/cxxomfort
................................................................................
 *  <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>







|







 







|
>







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
..
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
 * @file cxxomfort.hpp
 * @brief Backports library for C++.
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 * @license MIT License (see LICENSE.txt)
 * @mainpage Cxxomfort Backport Tools for C++.
 *
 * Cxxomfort is a small, header-only library that provides backports of various C++ features and goodies to previous Standard versions. It was written to facilitate working with the evolving C++ Standard when I was coming back to the language during the C++11 transition, as well as reduce stress of code rewrite while at the same time assisting in backwards and forwards portability.
 * 
 * This is a precompiled help built using 
 * <a href="http://www.doxygen.nl/" target="_blank">Doxygen</a> and covers only 
 * the published interfaces (names, functions, etc) and their usage; for 
 * information on installation and configuration, check the repository's page:
 *
 * http://ryan.gulix.cl/fossil.cgi/cxxomfort
................................................................................
 *  <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 , alignof
 * <br/> @subpage cxxomfort-utils "Independent Utilities" @endlink
 *  </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>

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

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
..
90
91
92
93
94
95
96

97
98
99
100
101
102
103
std::pair<FIterator,FIterator> 
minmax_element (FIterator ini, FIterator fin, Comparator less) {
    std::pair<FIterator, FIterator> result(ini, fin);
 
    if (ini == fin) return result;
    if (++ini == fin) return result;

    if (less(*ini, *result.ini)) {
        result.second = result.ini;
        result.ini = ini;
    } else {
        result.second = ini;
    }
    while (++ini != fin) {
        FIterator i = ini;
        if (++ini == fin) {
            if (less(*i, *result.ini)) result.ini = i;
            else if (!(less(*i, *result.second))) result.second = i;
            break;
        } else {
            if (less(*ini, *i)) {
                if (less(*ini, *result.ini)) result.ini = ini;
                if (!(less(*i, *result.second))) result.second = i;
            } else {
                if (less(*i, *result.ini)) result.ini = i;
                if (!(less(*ini, *result.second))) result.second = ini;
            }
        }
    }
    return result;

}
................................................................................
 */

} // cxxomfort::algorithm
} // cxxomfort


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

#else
#if (CXXOMFORT_CXX_STD < 2011)
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_COMPILER_VERSION >=404 && CXXOMFORT_COMPILER_VERSION < 600 && CXXOMFORT_CXX_EMULATION==2011 )
    // GCC already has defined these in 4.4-4.6 c++0x mode
    #else
namespace std {
    using ::cxxomfort::cxxostd::minmax;







|
|
|






|




|


|







 







>







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
..
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
std::pair<FIterator,FIterator> 
minmax_element (FIterator ini, FIterator fin, Comparator less) {
    std::pair<FIterator, FIterator> result(ini, fin);
 
    if (ini == fin) return result;
    if (++ini == fin) return result;

    if (less(*ini, *result.first)) {
        result.second = result.first;
        result.first = ini;
    } else {
        result.second = ini;
    }
    while (++ini != fin) {
        FIterator i = ini;
        if (++ini == fin) {
            if (less(*i, *result.first)) result.first = i;
            else if (!(less(*i, *result.second))) result.second = i;
            break;
        } else {
            if (less(*ini, *i)) {
                if (less(*ini, *result.first)) result.first = ini;
                if (!(less(*i, *result.second))) result.second = i;
            } else {
                if (less(*i, *result.first)) result.first = i;
                if (!(less(*ini, *result.second))) result.second = ini;
            }
        }
    }
    return result;

}
................................................................................
 */

} // cxxomfort::algorithm
} // cxxomfort


#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#elif (CXXO_COMPILER_SUPPORT_std_cxx11_algorithms)
#else
#if (CXXOMFORT_CXX_STD < 2011)
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_COMPILER_VERSION >=404 && CXXOMFORT_COMPILER_VERSION < 600 && CXXOMFORT_CXX_EMULATION==2011 )
    // GCC already has defined these in 4.4-4.6 c++0x mode
    #else
namespace std {
    using ::cxxomfort::cxxostd::minmax;

Changes to cxxomfort/cxxomfort/impl/relationals.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
#ifndef CXXOMFORT_IMPL_RELATIONALS_HPP
#define CXXOMFORT_IMPL_RELATIONALS_HPP
/**
 * @file
 * @brief Macros for generating relational operators.
 */

// automatic generation of relational operators

/**
 * @brief Automatically generates relational operators between the classes @a L and @a R .
 * @ingroup cxxomfort-codegen
 * 
 * If classes @a L and @a R have working operators <tt>==</tt> and <tt><</tt>, invoking this macro 
 * <b>outside</b> their class definition will automatically generate compatible 
 * non-member operators != , <= , >, >= .
 * 
 * All generated operators have the signature <tt>bool(L const&, R const&)</tt> and are @c noexcept or @c throw() .
 * 
 * */
#define CXXO_GENERATE_RELATIONALS2(L,R) \
inline bool operator!= (L const& vl, R const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl==vr); } \
inline bool operator>  (L const& vl, R const& vr) CXXO_NOEXCEPTNOTHROW { return vr<vl; } \
inline bool operator<= (L const& vl, R const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl>vr); } \
inline bool operator>= (L const& vl, R const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl<vr); } \

/**
 * @brief Automatically generates nonmember relational operators >, >=, <= and != .
 * @ingroup cxxomfort-codegen
 * 
 * If class @a T has working operators <tt>==</tt> and <tt><</tt>, invoking this macro 
 * <b>outside</b> the class definition will automatically generate compatible 
 * non-member operators != , <= , >, >= .
 * 
 * All generated operators return @c bool and are @c noexcept or @c throw() .
 * 
 * */
#define CXXO_GENERATE_RELATIONALS(T) \
inline bool operator!= (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl==vr); } \
inline bool operator>  (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return vr<vl; } \
inline bool operator<= (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl>vr); } \
inline bool operator>= (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl<vr); } \

#define CXXO_GENERATE_FRIEND_RELATIONALS(T) \
friend bool operator!= (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl==vr); } \
friend bool operator>  (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return vr<vl; } \
friend bool operator<= (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl>vr); } \
friend bool operator>= (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl<vr); } \

#define CXXO_GENERATE_RELATIONALS_T(T) \
template <TPARAMS> \
inline bool operator!= (T<TARGS> const& vl, T<TARGS> const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl==vr); } \
template <TPARAMS> \
inline bool operator>  (T<TARGS> const& vl, T<TARGS> const& vr) CXXO_NOEXCEPTNOTHROW { return vr<vl; } \
template <TPARAMS> \
inline bool operator<= (T<TARGS> const& vl, T<TARGS> const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl>vr); } \
template <TPARAMS> \
inline bool operator>= (T<TARGS> const& vl, T<TARGS> const& vr) CXXO_NOEXCEPTNOTHROW { return !(vl<vr); } \


#endif







|

|
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

1
2
3
4
5
6
7
8
9
10


11















































12
#ifndef CXXOMFORT_IMPL_RELATIONALS_HPP
#define CXXOMFORT_IMPL_RELATIONALS_HPP
/**
 * @file
 * @brief Macros for generating relational operators.
 */

// This header now redirects to cxxo-utils

#include <cxxomfort/cxxo-utils.hpp>


















































#endif

Changes to cxxomfort/cxxomfort/limits.hpp.

17
18
19
20
21
22
23



24
25






















26
27
28
29
30
31
32
..
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
...
120
121
122
123
124
125
126



127
128
129
130
131
132
133
#include <limits>
//#include <type_traits>
#if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
#pragma message CXXO_NOTICE("enabled <limits> support.")
#endif





namespace cxxomfort {























namespace impl {

template <uintmax_t N, size_t base=2> struct log_ {
    static const size_t value = 1 + log_<N/base, base>::value;
};

template <size_t base>
................................................................................
}

namespace fix { 

/**
 * @brief An extension to <tt>numeric_limits</tt> that deals specifically with integer-like types.
 * @ingroup cxxomfort-fix

 * 
 * For a given integral or integer-like type @a Ty , <tt>integral_limits<Ty></tt> 
 * provides an interface to <tt>std::numeric_limits<Ty></tt> and in fact 
 * inherits from the latter. The interface is expanded to add some useful information 
 * about the integral type that is only available at compile time as macros 
 * pre-C++11.

 * 
 * <tt>integral_limits</tt> provides the following new members: 
 * 
 * * @c const_min - minimum value as a value (<tt>::min</tt> is constexpr in C++>=11).
 * * @c const_max - maximum value as a value (<tt>::max</tt> is constexpr in C++>=11).
 * * @c digits_base<N> - the total number of digits required to represent any value in the given base.
 * 
 * @e Pending members : 
 * 
 * * @c narrower_type - an alias to the next smaller integral type of the same signedness.
 * * @c wider_type - an alias to the next larger integral type of the same signedness.
 * * @c lo_mask - an integral value that can be AND-ed with this type to keep only the lower bits.
 * * @c hi_mask - an integral value that can be AND-ed with this type to keep only the higher bits.
 * 
 * @subsection Specializations 
 * 
 * cxxomfort provides specializations of the new <tt>integral_limits</tt> for 
 * all the types that are defined as integral. The list explicitly includes: 

 * short, int, long, long long in their signed and unsigned variants.
 * 
 * */
template <typename T>
struct integral_limits {
    static_assert (std::is_integral<T>::value, "integral_limits is only defined for compiler integral types");
};

#define SPECIA_IMPL(Ty_,Min_,Max_) \
template <> struct integral_limits<Ty_>           \
: public std::numeric_limits<Ty_> {               \
    typedef std::numeric_limits<Ty_> Base_;       \
    static const Ty_ const_min= Min_;             \

    static const Ty_ const_max= Max_;             \
    template <unsigned short B> struct digits_base {   \
        static const unsigned short value=             \
        /* (digits - is_signed) / impl::log_<B>::value; */  \
        impl::log_<const_max,B>::value;   \
    };                                            \


}

SPECIA_IMPL(bool,false,true);
SPECIA_IMPL(signed int,INT_MIN,INT_MAX);
SPECIA_IMPL(unsigned int,0,UINT_MAX);
SPECIA_IMPL(char,CHAR_MIN,CHAR_MAX);
SPECIA_IMPL(signed char,SCHAR_MIN,SCHAR_MAX);
................................................................................
 * @brief Backports related to Standard header <tt><limits></tt> 
 * 
 * @code
 * #include <cxxomfort/limits.hpp>
 * @endcode
 * 
 * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>)



 * Interfaces defined here:
 *
 * (none from Standard C++)
 * 
 * Non-backport interfaces (<tt>cxxomfort::fix</tt>):
 * 
 * * @link cxxomfort::fix::integral_limits <tt>integral_limits</tt> @endlink - Allows access to the constant values of integral_limits in C++ < C++11.







>
>
>
|

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







 







>






>



|
|













>
|












>






>
>







 







>
>
>







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
..
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
...
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#include <limits>
//#include <type_traits>
#if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
#pragma message CXXO_NOTICE("enabled <limits> support.")
#endif


/*
 * Specialization for tinu[u]int 
 * */
namespace std {

template<> struct numeric_limits<cxxomfort::tinyint>
: std::numeric_limits<signed char> {
	static CXXO_CONSTEXPR cxxomfort::tinyint const min () CXXO_NOEXCEPTNOTHROW { return cxxomfort::tinyint(SCHAR_MIN); }
	static CXXO_CONSTEXPR cxxomfort::tinyint const max () CXXO_NOEXCEPTNOTHROW { return cxxomfort::tinyint(SCHAR_MAX); }
#if (CXXOMFORT_CXX_STD>=2011)
	static CXXO_CONSTEXPR cxxomfort::tinyint const lowest () CXXO_NOEXCEPTNOTHROW { return min(); }
#endif
};

template<> struct numeric_limits<cxxomfort::tinyuint>
: std::numeric_limits<unsigned char> {
	static CXXO_CONSTEXPR cxxomfort::tinyuint const min () CXXO_NOEXCEPTNOTHROW { return cxxomfort::tinyuint(0); }
	static CXXO_CONSTEXPR cxxomfort::tinyuint const max () CXXO_NOEXCEPTNOTHROW { return cxxomfort::tinyuint(UCHAR_MAX); }
#if (CXXOMFORT_CXX_STD>=2011)
	static CXXO_CONSTEXPR cxxomfort::tinyuint const lowest () CXXO_NOEXCEPTNOTHROW { return min(); }
#endif
};

}
// numeric_limits specializations

namespace cxxomfort {
namespace impl {

template <uintmax_t N, size_t base=2> struct log_ {
    static const size_t value = 1 + log_<N/base, base>::value;
};

template <size_t base>
................................................................................
}

namespace fix { 

/**
 * @brief An extension to <tt>numeric_limits</tt> that deals specifically with integer-like types.
 * @ingroup cxxomfort-fix
 * @xrefitem cxxomfort-fix "Fixes"
 * 
 * For a given integral or integer-like type @a Ty , <tt>integral_limits<Ty></tt> 
 * provides an interface to <tt>std::numeric_limits<Ty></tt> and in fact 
 * inherits from the latter. The interface is expanded to add some useful information 
 * about the integral type that is only available at compile time as macros 
 * pre-C++11.
 * 
 * 
 * <tt>integral_limits</tt> provides the following new members: 
 * 
 * * @c const_min - minimum value as a value (<tt>::min</tt> is constexpr function in C++>=11).
 * * @c const_max - maximum value as a value (<tt>::max</tt> is constexpr function in C++>=11).
 * * @c digits_base<N> - the total number of digits required to represent any value in the given base.
 * 
 * @e Pending members : 
 * 
 * * @c narrower_type - an alias to the next smaller integral type of the same signedness.
 * * @c wider_type - an alias to the next larger integral type of the same signedness.
 * * @c lo_mask - an integral value that can be AND-ed with this type to keep only the lower bits.
 * * @c hi_mask - an integral value that can be AND-ed with this type to keep only the higher bits.
 * 
 * @subsection Specializations 
 * 
 * cxxomfort provides specializations of the new <tt>integral_limits</tt> for 
 * all the types that are defined as integral. The list explicitly includes: 
 * 
 * <tt>short,  int,  long,  long long</tt> in their signed and unsigned variants.
 * 
 * */
template <typename T>
struct integral_limits {
    static_assert (std::is_integral<T>::value, "integral_limits is only defined for compiler integral types");
};

#define SPECIA_IMPL(Ty_,Min_,Max_) \
template <> struct integral_limits<Ty_>           \
: public std::numeric_limits<Ty_> {               \
    typedef std::numeric_limits<Ty_> Base_;       \
    static const Ty_ const_min= Min_;             \
    static const Ty_ const_lowest = Min_;         \
    static const Ty_ const_max= Max_;             \
    template <unsigned short B> struct digits_base {   \
        static const unsigned short value=             \
        /* (digits - is_signed) / impl::log_<B>::value; */  \
        impl::log_<const_max,B>::value;   \
    };                                            \
    typedef void narrower_type; \
    typedef void wider_type; \
}

SPECIA_IMPL(bool,false,true);
SPECIA_IMPL(signed int,INT_MIN,INT_MAX);
SPECIA_IMPL(unsigned int,0,UINT_MAX);
SPECIA_IMPL(char,CHAR_MIN,CHAR_MAX);
SPECIA_IMPL(signed char,SCHAR_MIN,SCHAR_MAX);
................................................................................
 * @brief Backports related to Standard header <tt><limits></tt> 
 * 
 * @code
 * #include <cxxomfort/limits.hpp>
 * @endcode
 * 
 * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>)
 * 
 * @section Interfaces
 * 
 * Interfaces defined here:
 *
 * (none from Standard C++)
 * 
 * Non-backport interfaces (<tt>cxxomfort::fix</tt>):
 * 
 * * @link cxxomfort::fix::integral_limits <tt>integral_limits</tt> @endlink - Allows access to the constant values of integral_limits in C++ < C++11.

Changes to cxxomfort/cxxomfort/memory.hpp.

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





















29
30
31
32
33
34
35
...
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
#include <cstdlib>

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


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





















}
	#endif
#endif

#include "impl/11-conditional.hpp"
#include <cxxomfort/type_traits.hpp> // is_convertible

................................................................................
 * 
 * Interfaces defined here:
 *
 * * @c alignof() (C++11) (See @e base_features ).
 * * @c addressof() (C++11) - get the memory address of an object.
 * * Pointer traits and Allocator traits (C++11) - tools for assisting in the design of containers.
 * * @link cxxomfort::cxxostd::aligned_storage @c aligned_storage @endlink </code> (C++11) - create an unitialized buffer for storing an object of a given type.
 * * @link cxxomfort::cxxostd::unique_ptr @c unique_ptr @endlink (C++11) - smart pointer that owns and holds a resource.
 * * @c @ref make_unique() (C++14) - assist for creating @c unique_ptr .
 * * @c destroy() , @c destroy_at() (C++17) - memory management by calling destructors.

 *
 * Interfaces repointed here when in TR1:
 * 
 * * @c std::shared_ptr  and related utilities.
 * * @c std::weak_ptr  and related utilities.
 * * @c std::default_deleter
 * 
 * Non-backport interfaces (<tt>cxxomfort::fix</tt>):
 *
 * * <tt>to_bool()</tt> overloads:
 *   * <tt>to_bool(std::shared_ptr const&)</tt> - briefer validity check to @c bool .
 *   * <tt>to_bool(std::unique_ptr const&)</tt> - briefer validity check to @c bool .
 * * <tt>#cxxomfort::fix::malloc_deleter</tt>.
 *


 * @note <b>Cxxomfort</b> expects an implementation of <tt>std::shared_ptr</tt> 
 * to exist and work in order, as part of the general TR1 requirement.
 * 






























 * @subsection also See Also
 *
 * * @see @cppref{header/memory} (cppreference)
 *
 * */







|

|
|


<

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







 







|


>

|







|
|
|
|
|
>
>



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




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
...
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
#include <cstdlib>

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


#if (CXXOMFORT_CXX_STD < 2011 && CXXOFLAG_namespace_tr1>0)
	#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG)
		#include <tr1/memory>
		#include <tr1/functional> // for hash
namespace std {
	using tr1::shared_ptr;

	using tr1::weak_ptr;

	template <typename T>
	shared_ptr<T> make_shared () {
		return shared_ptr<T>( new T() );
	}

	template <typename T, typename A1>
	shared_ptr<T> make_shared (A1 const& a1) {
		return shared_ptr<T>( new T(a1) );
	}

	template <typename T, typename A1, typename A2>
	shared_ptr<T> make_shared (A1 const& a1, A2 const& a2) {
		return shared_ptr<T>( new T(a1,a2) );
	}

	template <typename T, typename A1, typename A2, typename A3>
	shared_ptr<T> make_shared (A1 const& a1, A2 const& a2, A3 const& a3) {
		return shared_ptr<T>( new T(a1,a2,a3) );
	}

}
	#endif
#endif

#include "impl/11-conditional.hpp"
#include <cxxomfort/type_traits.hpp> // is_convertible

................................................................................
 * 
 * Interfaces defined here:
 *
 * * @c alignof() (C++11) (See @e base_features ).
 * * @c addressof() (C++11) - get the memory address of an object.
 * * Pointer traits and Allocator traits (C++11) - tools for assisting in the design of containers.
 * * @link cxxomfort::cxxostd::aligned_storage @c aligned_storage @endlink </code> (C++11) - create an unitialized buffer for storing an object of a given type.
 * * @link cxxomfort::cxxostd::unique_ptr @c unique_ptr emulation @endlink (C++11) - smart pointer that owns and holds a resource.
 * * @c @ref make_unique() (C++14) - assist for creating @c unique_ptr .
 * * @c destroy() , @c destroy_at() (C++17) - memory management by calling destructors.
 * * @c make_shared() - construct shared smart pointers safely.
 *
 * Interfaces repointed here when found in TR1:
 * 
 * * @c std::shared_ptr  and related utilities.
 * * @c std::weak_ptr  and related utilities.
 * * @c std::default_deleter
 * 
 * Non-backport interfaces (<tt>cxxomfort::fix</tt>):
 *
 * * <tt>to_bool()</tt> overloads to quickly check validity of a smart pointer:
 *   * <tt>to_bool(std::shared_ptr const&)</tt>
 *   * <tt>to_bool(std::unique_ptr const&)</tt>
 * * <tt>#cxxomfort::fix::malloc_deleter</tt> - function object that wrapps @c free() .
 * 
 * @section Notes
 * 
 * @note <b>Cxxomfort</b> expects an implementation of <tt>std::shared_ptr</tt> 
 * to exist and work in order, as part of the general TR1 requirement.
 * 
 * @section to_bool "to_bool" observers 
 * 
 * The library provides the overloaded name <tt>cxxomfort::fix::to_bool()</tt> as a mechanism to check if a smart pointer is currently managing an object. The use case for these overloads is to explicitly provide "conversion" to @c bool in contexts such as @c if blocks that don't have implicit conversion in older versions of C++:
 * 
 * @code
 * // does not work pre-C++17:
 * 
 * shared_ptr<Foo> managedfoo = make_shared<Foo>(args...);
 * // this fails: no implicit conversion of managed pointer to bool
 * if (bool f = (managedfoo)) {
 * 		...code
 * }
 * 
 * // works in all versions of C++, no extra cost:
 * 
 * shared_ptr<Foo> managedfoo = make_shared<Foo>(args...);
 * if (bool f = to_bool(managedfoo)) {
 * 		...code
 * }
 * 
 * // note that this is basically equivalent to the following 
 * // in all versions (maps to static_cast in > C++11):
 * 
 * shared_ptr<Foo> managedfoo = make_shared<Foo>(args...);
 * if (bool f = explicit_cast<bool>(managedfoo)) {
 * 		...code
 * }
 * @endcode
 * 
 * 
 * @section also See Also
 *
 * * @see @cppref{header/memory} (cppreference)
 *
 * */

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

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# @author Luis Machuca Bezzaza  <luis.machuca@gulix.cl>
# @version 3
#library general
arrayref|array_ref<T>|(T&[N])|
carrayref|array_ref<T const>|(T[N])|
carrayref|array_ref<T const>|(array_ref)|
seq_|"sequence type"|<T>(...sequence of T)|
to_byte|std::byte|(Integral byte)|
to_errc|std::errc|(integral_errc_value)|
typeid_demangle|std::string|(typeid construct)|
type_name|std::string_view|<T>() [parametrized on T]|
#algorithm
copy_leftmost_n|ItDest|(ItSrc ini, ItSrc fin, Integer n, ItDest dest)|
copy_rightmost_n|ItDest|(ItSrc ini, ItSrc fin, Integer n, ItDest dest)|
count_frequencies_map|Iterator|(Iterator ini, Iterator fin, ValueMapIndex[]& v)|
find_inversion|Iterator|(Iterator ini, Iterator fin, Comparison less)|







|

|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# @author Luis Machuca Bezzaza  <luis.machuca@gulix.cl>
# @version 3
#library general
arrayref|array_ref<T>|(T&[N])|
carrayref|array_ref<T const>|(T[N])|
carrayref|array_ref<T const>|(array_ref)|
seq_|"sequence type"|<T>(), sequence of T...|
to_byte|std::byte|(Integral byte)|
to_errc|std::errc|(integral errc_value)|
typeid_demangle|std::string|(typeid construct)|
type_name|std::string_view|<T>() [parametrized on T]|
#algorithm
copy_leftmost_n|ItDest|(ItSrc ini, ItSrc fin, Integer n, ItDest dest)|
copy_rightmost_n|ItDest|(ItSrc ini, ItSrc fin, Integer n, ItDest dest)|
count_frequencies_map|Iterator|(Iterator ini, Iterator fin, ValueMapIndex[]& v)|
find_inversion|Iterator|(Iterator ini, Iterator fin, Comparison less)|