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

Overview
Comment:Commit 2018-12-31 - A year ends in function.
  • cxxomfort: Most of the code in Features (not in Supplementals) has been edited to not require using.hpp.
  • config: Fixed an error that undefined "emulation" mode in GCC 4.7 to 4.9 when using "-std=c++11" rather than "-std=c++0x".
  • config: Minor fixed for GCC 4.4, even if still unsupported.
  • array: Added file.
  • functional: Added std::invoke for C++11, C++14.
  • functional: Added std::not_fn from C++17.
  • random: Added std::default_random_engine to C++03.
  • string_view: Removed constexpr from member functions that can't support it in C++11.
  • string_view: Added relational operators.
  • library:algorithm: Added valcmp (generic version of strcmp, memcmp).
  • library:algorithm: Added erase, erase_if from Fundamentals V2.
  • library:functional: Added function_ref from llvm.
  • library:functional: Added function_caller, function_facet.
  • library:random: Added numerical_recipes, MMIX typedefs for lcg.
  • library:random: Added splitmix64, from Sebastiano Vigna.
  • library:random: Added reseed, randint from Fundamentals V2.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA3-256:b64fff24b793e8889632448ccd460612056222d6968aee6245c7b108e8cea2f9
User & Date: luismachuca 2019-01-01 02:38:05
Context
2019-01-01
02:38
Commit 2018-12-31 - A year ends in function.
  • cxxomfort: Most of the code in Features (not in Supplementals) has been edited to not require using.hpp.
  • config: Fixed an error that undefined "emulation" mode in GCC 4.7 to 4.9 when using "-std=c++11" rather than "-std=c++0x".
  • config: Minor fixed for GCC 4.4, even if still unsupported.
  • array: Added file.
  • functional: Added std::invoke for C++11, C++14.
  • functional: Added std::not_fn from C++17.
  • random: Added std::default_random_engine to C++03.
  • string_view: Removed constexpr from member functions that can't support it in C++11.
  • string_view: Added relational operators.
  • library:algorithm: Added valcmp (generic version of strcmp, memcmp).
  • library:algorithm: Added erase, erase_if from Fundamentals V2.
  • library:functional: Added function_ref from llvm.
  • library:functional: Added function_caller, function_facet.
  • library:random: Added numerical_recipes, MMIX typedefs for lcg.
  • library:random: Added splitmix64, from Sebastiano Vigna.
  • library:random: Added reseed, randint from Fundamentals V2.
Leaf check-in: b64fff24 user: luismachuca tags: trunk
2018-12-23
20:01
Commit 2018-12-22 - Various fixes.
  • cxxomfort: Removed deprecated header files.
  • cxxomfort: Documentation fixes.
  • string_view : Added find, rfind.
  • typeindex: Fixed relational operators which caused compilation error in GCC 03 mode.
check-in: e1adbc84 user: luismachuca tags: trunk
Changes

Changes to cxxomfort/cxxomfort/algorithm.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
..
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
...
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
...
174
175
176
177
178
179
180


181
182

183
184
185
186

187
188
189
190
191
192
193
...
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
...
259
260
261
262
263
264
265
266
267

268
269
270
#ifndef CXXOMFORT_ALGORITHM_HPP
#define CXXOMFORT_ALGORITHM_HPP
/**
 * @file cxxomfort/algorithm.hpp
 * @brief Implementations and Backports for Standard header <code>\<algorithm\></code>.

 * 
 */

#include "base.hpp"
#include CXXO_INCLUDE_SYS(algorithm)
#include "util/meta.hpp" // conditional

namespace cxxomfort { namespace cxxostd {




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

/**
 * @brief Finds like @c find_if but the predicate is reversed.
 * @xrefitem std0algorithm "" ""
 * @ingroup cxx11-backports
 **/
template<class It, class Pred>
It find_if_not(It ini, It fin, Pred f) {
    for (; ini != fin; ++ini) {
        if (!f(*ini)) {
            return ini;
................................................................................
    for (Size i = 0; i < n; ++first, (void) ++i) {
        f(*first);
    }
    return first;
}


} //~namespace algorithm
} //~namespace cxxomfort



// These are in their own files
// included in c++11 onwards
#include "impl/11-is_xxx_of.hpp"
#include "impl/11-minmax.hpp"
................................................................................
// c++17 onwards
#include "impl/17-clamp.hpp"

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




#if (CXXOMFORT_CXX_STD < 2011) && (CXXO_COMPILER_SUPPORT_std_cxx11_algorithms == 0) 


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


    //! copy_if
    using ::cxxomfort::cxxostd::copy_if;
    //! copy_n
    using ::cxxomfort::cxxostd::copy_n;
    using ::cxxomfort::cxxostd::partition_copy;

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

/**
 * @page std0algorithm
 * @brief Backports from @c <algorithm> 
 * 
 * Interfaces defined in this section:
 * 
 * * @c all_of(), @c any_of(), @c none_of() (C++11)
 * * @c copy_if(), @c copy_n(), @c partition_copy() (C++11)
 * * @c find_if_not() (C++11)
 * * @c is_permutation(), @c next_permutation(), @c prev_permutation() (C++11)
 * * @c is_sorted() (C++11)
 * * @c minmax() , @c minmax_element() (C++11)
 * * @c equal() , @c mismatch() overloads (C++14)
 * * @c clamp() (C++17)
 * * @c for_each_n() (C++17)
 * 
 * Pending:
 * 
 * * @c shuffle
 * 
 * 
 *
................................................................................
generate( begin(s1), end(s1), rand);
vector<int> s2;
copy_if( begin(s1), end(s1), back_inserter(s2), even);
for_each_n( begin(s1), end(s1), print);

 * @endcode
 * 
 * See also: 
 * @link numeric.hpp "<numeric>" @endlink , @ref cxxo-sup-algorithm , 

 * <a href="https://en.cppreference.com/w/cpp/header/algorithm">\<algorithm\> \@cppreference</a>.
 * 
 * */





>









>
>
>








|







 







|







 







|
|







 







>
>

|
>




>







 







|
|
|
|
|
|
|
|
|







 







|
<
>
|


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
..
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
...
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
...
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
...
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
...
267
268
269
270
271
272
273
274

275
276
277
278
#ifndef CXXOMFORT_ALGORITHM_HPP
#define CXXOMFORT_ALGORITHM_HPP
/**
 * @file cxxomfort/algorithm.hpp
 * @brief Implementations and Backports for Standard header <code>\<algorithm\></code>.
 * @xrefitem std0algorithm "<algorithm>" "Header"
 * 
 */

#include "base.hpp"
#include CXXO_INCLUDE_SYS(algorithm)
#include "util/meta.hpp" // conditional

namespace cxxomfort { namespace cxxostd {

//#if (CXXO_COMPILER_SUPPORT_std_cxx11_algorithms==0)
#if (CXXOMFORT_CXX_STD<2011)

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

/**
 * @brief Finds like @c find_if but the predicate is reversed.
 * @xrefitem std0algorithm "" "Search"
 * @ingroup cxx11-backports
 **/
template<class It, class Pred>
It find_if_not(It ini, It fin, Pred f) {
    for (; ini != fin; ++ini) {
        if (!f(*ini)) {
            return ini;
................................................................................
    for (Size i = 0; i < n; ++first, (void) ++i) {
        f(*first);
    }
    return first;
}


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



// These are in their own files
// included in c++11 onwards
#include "impl/11-is_xxx_of.hpp"
#include "impl/11-minmax.hpp"
................................................................................
// c++17 onwards
#include "impl/17-clamp.hpp"

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

#if (CXXOMFORT_CXX_STD>=2011 || CXXO_COMPILER_SUPPORT_std_cxx11_algorithms==1)
    //#pragma message CXXO_NOTICE("adding nothing from algorithm to std")

#else // (CXXO_COMPILER_SUPPORT_std_cxx11_algorithms == 0) 
    //#pragma message CXXO_NOTICE("checking if to add from algorithm to std")

    #if (defined( CXXOFLAG_NO_STD_USING ) && CXXOFLAG_NO_STD_USING>0)
    #else
namespace std {
   // #pragma message CXXO_NOTICE("adding from algorithm to std")

    //! copy_if
    using ::cxxomfort::cxxostd::copy_if;
    //! copy_n
    using ::cxxomfort::cxxostd::copy_n;
    using ::cxxomfort::cxxostd::partition_copy;

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

/**
 * @page std0algorithm
 * @brief Backports from @c <algorithm> 
 * 
 * Interfaces defined in this section:
 * 
 * * @c all_of(), @c any_of(), @c none_of() (C++11) - check if elements of a sequence fit a predicate.
 * * @c copy_if(), @c copy_n(), @c partition_copy() (C++11) - copy elements from a sequence.
 * * @c find_if_not() (C++11) - check if elements @e don't fit a predicate.
 * * @c is_permutation(), @c next_permutation(), @c prev_permutation() (C++11) - check the sorting status of a sequence.
 * * @c is_sorted() (C++11) - check the sorting status of a sequence.
 * * @c minmax() , @c minmax_element() (C++11) - minimum and maximum elements in a sequence.
 * * @c equal() , @c mismatch() overloads (C++14) - compare sequences.
 * * @c clamp() (C++17) - constrain values.
 * * @c for_each_n() (C++17) - execute functors across a sequence.
 * 
 * Pending:
 * 
 * * @c shuffle
 * 
 * 
 *
................................................................................
generate( begin(s1), end(s1), rand);
vector<int> s2;
copy_if( begin(s1), end(s1), back_inserter(s2), even);
for_each_n( begin(s1), end(s1), print);

 * @endcode
 * 
 * @section also See Also

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

Added cxxomfort/cxxomfort/array.hpp.













































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef CXXOMFORT_ARRAY_HPP
#define CXXOMFORT_ARRAY_HPP
/**
 * @file
 *
 */

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

#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC,>0) && CXXOMFORT_CXX_EMULATION < 2011)

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


#endif

#endif

Added cxxomfort/cxxomfort/backports.hpp.



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef CXXOMFORT_BACKPORTS_HPP
#define CXXOMFORT_BACKPORTS_HPP

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

#include "array.hpp"
#include "algorithm.hpp" // <algorithm> backports (copy_if, minmax, etc...)
#include "cstddef.hpp" // <cstddef> backports (byte, nullptr, etc...)
#include "cstdint.hpp" // <cstdint> backports (integer types)
#include "cuchar.hpp" // <cuchar> backports, besides char16_t, char32_t
#include "forward_list.hpp" // <forward_list> backports
#include "functional.hpp" // <functional> backports (transparent functors, etc...)
#include "iterator.hpp" // <iterator> backports (begin, end, size, data, etc...)
#include "memory.hpp" // <memory> backports (pointer_traits, alignof, unique_ptr, etc...)
#include "numeric.hpp" // <numeric> backports (iota, etc...)
#include "random.hpp" // <random> backports (rename fixes, std::random_device, etc...)
#include "string.hpp" // <string> backports (to_string, etc...)
#include "string_view.hpp" // <string_view> backports
#include "system_error.hpp" // <system_error> backports
#include "tuple.hpp" // <tuple> backports (tuple get<type>, etc...)
#include "type_traits.hpp" // <type_traits> backports (common_type, decay, is_literal, is_null_pointer, etc...)
#include "utility.hpp" // <utility> backports (declval, exchange, pair, etc...)

#endif

Changes to cxxomfort/cxxomfort/config.hpp.

342
343
344
345
346
347
348

349
350
351

352
353
354
355
356
357
358
/*
 * Opens the namespace where tr1 extensions live
 * */
#if (CXXOMFORT_CXX_STD < 2011 && \
    (CXXOMFORT_CXX_EMULATION < 2011 && CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC) || \
    (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC && CXXOMFORT_COMPILER_VERSION < 1600) \
)

    #define CXXO_OPEN_STDTR1() namespace std { namespace tr1 {
    #define CXXO_CLOSE_STDTR1() } }
#else 

    #define CXXO_OPEN_STDTR1() namespace std { 
    #define CXXO_CLOSE_STDTR1() } 
#endif

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







>



>







342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
/*
 * Opens the namespace where tr1 extensions live
 * */
#if (CXXOMFORT_CXX_STD < 2011 && \
    (CXXOMFORT_CXX_EMULATION < 2011 && CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC) || \
    (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC && CXXOMFORT_COMPILER_VERSION < 1600) \
)
    #define CXXO_namespace_tr1 std::tr1
    #define CXXO_OPEN_STDTR1() namespace std { namespace tr1 {
    #define CXXO_CLOSE_STDTR1() } }
#else 
    #define CXXO_namespace_tr1 std
    #define CXXO_OPEN_STDTR1() namespace std { 
    #define CXXO_CLOSE_STDTR1() } 
#endif

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

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

14
15
16
17
18
19
20
21


22
23
24
25
26
27
28
29
30
31
32

#define CXXO_COMPILER_SUPPORT_compiler_intrinsics_is_x 0

// c++03 stuff

//! If compiler provides support for <code>\<functional\></code>'s classic binders.
#define CXXO_COMPILER_SUPPORT_functional_oldstyle (CXXOMFORT_CXX_STD<2017)
//! If compiler includes tr1/random header in c++03 mode


#define CXXO_COMPILER_SUPPORT_tr1_random 0
//! If compiler includes tr1/tuple header in c++03 mode
#define CXXO_COMPILER_SUPPORT_tr1_tuple 0
//! If compiler includes tr1/type_traits header in c++03 mode
#define CXXO_COMPILER_SUPPORT_tr1_type_traits 0
//! If compiler provides support for @c __typeof__ in C++03.
#define CXXO_COMPILER_SUPPORT_typeof 0
//! If compiler provides support for variadic macros (<code>__VA_ARG__</code>).
#define CXXO_COMPILER_SUPPORT_va_args 0

// c++11 stuff







|
>
>

|

|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

#define CXXO_COMPILER_SUPPORT_compiler_intrinsics_is_x 0

// c++03 stuff

//! If compiler provides support for <code>\<functional\></code>'s classic binders.
#define CXXO_COMPILER_SUPPORT_functional_oldstyle (CXXOMFORT_CXX_STD<2017)
//! If compiler includes <cstdint> features in std::tr1
#define CXXO_COMPILER_SUPPORT_tr1_cstdint 0
//! If compiler includes <random> features in std::tr1
#define CXXO_COMPILER_SUPPORT_tr1_random 0
//! If compiler includes <tuple> features in std::tr1
#define CXXO_COMPILER_SUPPORT_tr1_tuple 0
//! If compiler includes <type_traits> features in std::tr1
#define CXXO_COMPILER_SUPPORT_tr1_type_traits 0
//! If compiler provides support for @c __typeof__ in C++03.
#define CXXO_COMPILER_SUPPORT_typeof 0
//! If compiler provides support for variadic macros (<code>__VA_ARG__</code>).
#define CXXO_COMPILER_SUPPORT_va_args 0

// c++11 stuff

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

8
9
10
11
12
13
14


15
16
17
18
19

20

21

22
23
24
25
26
27
28
Here follows a list of C++11 features for Clang:

TODO
 */

#define CXXOMFORT_COMPILER_ID CXXO_COMPILERID_CLANG
#define CXXOMFORT_COMPILER_VERSION 100*__clang_major__+__clang_minor__



#define CXXO_PRAGMA(x) _Pragma (#x)
//#define CXXO_NOTICE(msg) GCC message (" cxxomfort warning -- " msg )
//#define CXXO_WARNING(msg) CXXO_NOTICE_IMPL_( "cxxomfort warning: " msg)


#define CXXO_NOTICE_IMPL_(msg) msg

#define CXXO_NOTICE(msg) CXXO_NOTICE_IMPL_( "cxxomfort notice: " msg)

#define CXXO_WARNING(msg) CXXO_NOTICE_IMPL_( "cxxomfort warning: " msg)

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

#undef  CXXO_COMPILER_SUPPORT_compiler_intrinsics_is_x







>
>





>

>

>







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
Here follows a list of C++11 features for Clang:

TODO
 */

#define CXXOMFORT_COMPILER_ID CXXO_COMPILERID_CLANG
#define CXXOMFORT_COMPILER_VERSION 100*__clang_major__+__clang_minor__
#define CXXOMFORT_COMPILER_VERSION_FULL CXXOMFORT_COMPILER_VERSION


#define CXXO_PRAGMA(x) _Pragma (#x)
//#define CXXO_NOTICE(msg) GCC message (" cxxomfort warning -- " msg )
//#define CXXO_WARNING(msg) CXXO_NOTICE_IMPL_( "cxxomfort warning: " msg)

#undef  CXXO_NOTICE_IMPL_
#define CXXO_NOTICE_IMPL_(msg) msg
#undef  CXXO_NOTICE
#define CXXO_NOTICE(msg) CXXO_NOTICE_IMPL_( "cxxomfort notice: " msg)
#undef  CXXO_WARNING
#define CXXO_WARNING(msg) CXXO_NOTICE_IMPL_( "cxxomfort warning: " msg)

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

#undef  CXXO_COMPILER_SUPPORT_compiler_intrinsics_is_x

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

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
..
83
84
85
86
87
88
89











90
91
92
93
94
95
96
..
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
...
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
...
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
...
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
...
255
256
257
258
259
260
261




262
263
// GCC has a known bug where __cplusplus is not a YYYYMM tag in old versions in C++03 mode
#if (__cplusplus==1)
    #undef CXXOMFORT_CXX_STD
    #define CXXOMFORT_CXX_STD 1997
#endif

// GCC advertises C++11 mode with "-std=c++0x" and a macro
#if (CXXOMFORT_CXX_STD <= 2011 && defined(__GXX_EXPERIMENTAL_CXX0X__))
    #undef  CXXOMFORT_CXX_EMULATION
    #define CXXOMFORT_CXX_EMULATION 2011
#endif


/**
 * GCC headers tend to be organized via a 
................................................................................


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













#if (CXXOMFORT_COMPILER_VERSION >= 403)
    #if (defined(__GXX_EXPERIMENTAL_CXX0X__))
        #if (CXXOMFORT_COMPILER_VERSION==403)
            #pragma message CXXO_WARNING( "Configuration not supported (nullptr and other basic features might be missing)" )
        #endif
        #undef  CXXO_COMPILER_SUPPORT_static_assert
................................................................................
        #define CXXO_COMPILER_SUPPORT_decltype 2343
    #endif
    #undef  CXXO_COMPILER_SUPPORT_compiler_intrinsics_is_x
    #define CXXO_COMPILER_SUPPORT_compiler_intrinsics_is_x 1
#endif

#if (CXXOMFORT_COMPILER_VERSION >= 404)
    #if defined(__GXX_EXPERIMENTAL_CXX0X__)
        // Note: *Unsupported* c++0x emulation mode
        #undef  CXXO_COMPILER_SUPPORT_auto
        #define CXXO_COMPILER_SUPPORT_auto 1984
        #undef  CXXO_COMPILER_SUPPORT_conditional_enableif 
        #define CXXO_COMPILER_SUPPORT_conditional_enableif 1
        #undef  CXXO_COMPILER_SUPPORT_default_delete
        #define CXXO_COMPILER_SUPPORT_default_delete 1
................................................................................
        #undef  CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers
        #define CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers 1
        #undef  CXXO_COMPILER_SUPPORT_unique_ptr
        #define CXXO_COMPILER_SUPPORT_unique_ptr 1
        #undef  CXXO_COMPILER_SUPPORT_variadic
        #define CXXO_COMPILER_SUPPORT_variadic 1
    #else
        #undef  CXXO_COMPILER_SUPPORT_tr1_random
        #undef  CXXO_COMPILER_SUPPORT_tr1_tuple
        #define CXXO_COMPILER_SUPPORT_tr1_random 1
        #define CXXO_COMPILER_SUPPORT_tr1_tuple 1
        
        #if !defined(CXXOFLAG_MAKE_TYPEDEF_charn_t)
            #define CXXOFLAG_MAKE_TYPEDEF_charn_t // necessary because of SSO in <string>
        #endif

    #endif
#endif
#if (CXXOMFORT_COMPILER_VERSION >= 405)
    #if defined(__GXX_EXPERIMENTAL_CXX0X__)
        #undef  CXXO_COMPILER_SUPPORT_alignof
        #define CXXO_COMPILER_SUPPORT_alignof 1
        #undef  CXXO_COMPILER_SUPPORT_explicit_operator
        #define CXXO_COMPILER_SUPPORT_explicit_operator 2437
        #undef  CXXO_COMPILER_SUPPORT_rvref
        #define CXXO_COMPILER_SUPPORT_rvref 2844
    #endif
#endif
#if (CXXOMFORT_COMPILER_VERSION >= 406)
    #if defined(__GXX_EXPERIMENTAL_CXX0X__)
        #undef  CXXO_COMPILER_SUPPORT_alignof
        #define CXXO_COMPILER_SUPPORT_alignof 1
        #undef  CXXO_COMPILER_SUPPORT_auto
        #define CXXO_COMPILER_SUPPORT_auto 1
        #undef  CXXO_COMPILER_SUPPORT_cstd_cstdint
        #define CXXO_COMPILER_SUPPORT_cstd_cstdint 1
        #undef  CXXO_COMPILER_SUPPORT_cstd_system_error
................................................................................
        #define CXXO_NOEXCEPT noexcept
        #undef  CXXO_COMPILER_SUPPORT_nullptr
        #define CXXO_COMPILER_SUPPORT_nullptr 1
        #undef  CXXO_COMPILER_SUPPORT_rvref
        #define CXXO_COMPILER_SUPPORT_rvref 3053
        #undef  CXXO_COMPILER_SUPPORT_static_assert
        #define CXXO_COMPILER_SUPPORT_static_assert 1
        #undef  CXXO_COMPILER_SUPPORT_std_cxx11_algorithms
        #define CXXO_COMPILER_SUPPORT_std_cxx11_algorithms 1
        #undef  CXXO_COMPILER_SUPPORT_std_iterator_helpers
        #define CXXO_COMPILER_SUPPORT_std_iterator_helpers 1
        #undef  CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers
        #define CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers 1
        #undef  CXXO_COMPILER_SUPPORT_std_cxx11_constructible_traits
        #define CXXO_COMPILER_SUPPORT_std_cxx11_constructible_traits 1
        #undef  CXXO_COMPILER_SUPPORT_unique_ptr
        #define CXXO_COMPILER_SUPPORT_unique_ptr 1
        #undef  CXXO_COMPILER_SUPPORT_variadic
        #define CXXO_COMPILER_SUPPORT_variadic 1
    #else
        #undef  CXXO_COMPILER_SUPPORT_tr1_random
        #define CXXO_COMPILER_SUPPORT_tr1_random 1
        #undef  CXXO_COMPILER_SUPPORT_tr1_type_traits
        #define CXXO_COMPILER_SUPPORT_tr1_type_traits 1
        #undef  CXXO_COMPILER_SUPPORT_tr1_tuple
        #define CXXO_COMPILER_SUPPORT_tr1_tuple 1
    #endif
#endif

#if (CXXOMFORT_COMPILER_VERSION >= 407)
    #if defined(__GXX_EXPERIMENTAL_CXX0X__)
        #undef  CXXO_COMPILER_SUPPORT_constexpr
        #define CXXO_COMPILER_SUPPORT_constexpr 2235
        #undef  CXXO_COMPILER_SUPPORT_user_defined_literals
        #define CXXO_COMPILER_SUPPORT_user_defined_literals 1
    #endif
#endif

................................................................................
// via usage of the __cplusplus value
#if (CXXOMFORT_CXX_STD == 2013)
    #define CXXOMFORT_CXX_EMULATION 2014
#endif


#if (CXXOMFORT_COMPILER_VERSION >= 408)
    #if defined(__GXX_EXPERIMENTAL_CXX0X__)
        #undef  CXXO_COMPILER_SUPPORT_attribute
        #define CXXO_COMPILER_SUPPORT_attribute 1
        #undef  CXXO_COMPILER_SUPPORT_alignment_tools
        #define CXXO_COMPILER_SUPPORT_alignment_tools 1
        #undef  CXXO_COMPILER_SUPPORT_decltype
        #define CXXO_COMPILER_SUPPORT_decltype 2
        // 4.8 is considered to have full C++11 support for practical purposes
        // but it's untested so far
    #endif
#endif
#if (CXXOMFORT_COMPILER_VERSION >= 409)
    #if defined(__GXX_EXPERIMENTAL_CXX0X__)
        // 4.8 is considered to have full C++11 support for practical purposes
        // but it's untested so far
        #else
        #undef CXXOMFORT_CXX_STD
        #define CXXOMFORT_CXX_STD 2003
        #endif
#endif

#if (CXXOMFORT_COMPILER_VERSION >= 500)
    #if (CXXOMFORT_CXX_STD>=2011)
        #undef  CXXO_COMPILER_SUPPORT_attribute_deprecated
        #define CXXO_COMPILER_SUPPORT_attribute_deprecated 1
    #endif
................................................................................
        #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






#endif







|







 







>
>
>
>
>
>
>
>
>
>
>







 







|







 







|
|
|
|








|









|







 







<
<











<
<
<
<
<
<




|







 







|











|


|
|
|
|







 







>
>
>
>


61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
..
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
...
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
...
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
...
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
...
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
...
258
259
260
261
262
263
264
265
266
267
268
269
270
// GCC has a known bug where __cplusplus is not a YYYYMM tag in old versions in C++03 mode
#if (__cplusplus==1)
    #undef CXXOMFORT_CXX_STD
    #define CXXOMFORT_CXX_STD 1997
#endif

// GCC advertises C++11 mode with "-std=c++0x" and a macro
#if (CXXOMFORT_CXX_STD < 2011 && defined(__GXX_EXPERIMENTAL_CXX0X__))
    #undef  CXXOMFORT_CXX_EMULATION
    #define CXXOMFORT_CXX_EMULATION 2011
#endif


/**
 * GCC headers tend to be organized via a 
................................................................................


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

// set up TR1 headers
#if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011)
    #undef  CXXO_COMPILER_SUPPORT_tr1_cstdint
    #define CXXO_COMPILER_SUPPORT_tr1_cstdint 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_random
    #define CXXO_COMPILER_SUPPORT_tr1_random 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_type_traits
    #define CXXO_COMPILER_SUPPORT_tr1_type_traits 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_tuple
    #define CXXO_COMPILER_SUPPORT_tr1_tuple 1
#endif

#if (CXXOMFORT_COMPILER_VERSION >= 403)
    #if (defined(__GXX_EXPERIMENTAL_CXX0X__))
        #if (CXXOMFORT_COMPILER_VERSION==403)
            #pragma message CXXO_WARNING( "Configuration not supported (nullptr and other basic features might be missing)" )
        #endif
        #undef  CXXO_COMPILER_SUPPORT_static_assert
................................................................................
        #define CXXO_COMPILER_SUPPORT_decltype 2343
    #endif
    #undef  CXXO_COMPILER_SUPPORT_compiler_intrinsics_is_x
    #define CXXO_COMPILER_SUPPORT_compiler_intrinsics_is_x 1
#endif

#if (CXXOMFORT_COMPILER_VERSION >= 404)
    #if (CXXOMFORT_CXX_STD< 2011) && (CXXOMFORT_CXX_EMULATION==2011)
        // Note: *Unsupported* c++0x emulation mode
        #undef  CXXO_COMPILER_SUPPORT_auto
        #define CXXO_COMPILER_SUPPORT_auto 1984
        #undef  CXXO_COMPILER_SUPPORT_conditional_enableif 
        #define CXXO_COMPILER_SUPPORT_conditional_enableif 1
        #undef  CXXO_COMPILER_SUPPORT_default_delete
        #define CXXO_COMPILER_SUPPORT_default_delete 1
................................................................................
        #undef  CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers
        #define CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers 1
        #undef  CXXO_COMPILER_SUPPORT_unique_ptr
        #define CXXO_COMPILER_SUPPORT_unique_ptr 1
        #undef  CXXO_COMPILER_SUPPORT_variadic
        #define CXXO_COMPILER_SUPPORT_variadic 1
    #else
//        #undef  CXXO_COMPILER_SUPPORT_tr1_random
//        #undef  CXXO_COMPILER_SUPPORT_tr1_tuple
//        #define CXXO_COMPILER_SUPPORT_tr1_random 1
//        #define CXXO_COMPILER_SUPPORT_tr1_tuple 1
        
        #if !defined(CXXOFLAG_MAKE_TYPEDEF_charn_t)
            #define CXXOFLAG_MAKE_TYPEDEF_charn_t // necessary because of SSO in <string>
        #endif

    #endif
#endif
#if (CXXOMFORT_COMPILER_VERSION >= 405)
    #if (CXXOMFORT_CXX_STD< 2011) && (CXXOMFORT_CXX_EMULATION==2011)
        #undef  CXXO_COMPILER_SUPPORT_alignof
        #define CXXO_COMPILER_SUPPORT_alignof 1
        #undef  CXXO_COMPILER_SUPPORT_explicit_operator
        #define CXXO_COMPILER_SUPPORT_explicit_operator 2437
        #undef  CXXO_COMPILER_SUPPORT_rvref
        #define CXXO_COMPILER_SUPPORT_rvref 2844
    #endif
#endif
#if (CXXOMFORT_COMPILER_VERSION >= 406)
    #if (CXXOMFORT_CXX_STD< 2011) && (CXXOMFORT_CXX_EMULATION==2011)
        #undef  CXXO_COMPILER_SUPPORT_alignof
        #define CXXO_COMPILER_SUPPORT_alignof 1
        #undef  CXXO_COMPILER_SUPPORT_auto
        #define CXXO_COMPILER_SUPPORT_auto 1
        #undef  CXXO_COMPILER_SUPPORT_cstd_cstdint
        #define CXXO_COMPILER_SUPPORT_cstd_cstdint 1
        #undef  CXXO_COMPILER_SUPPORT_cstd_system_error
................................................................................
        #define CXXO_NOEXCEPT noexcept
        #undef  CXXO_COMPILER_SUPPORT_nullptr
        #define CXXO_COMPILER_SUPPORT_nullptr 1
        #undef  CXXO_COMPILER_SUPPORT_rvref
        #define CXXO_COMPILER_SUPPORT_rvref 3053
        #undef  CXXO_COMPILER_SUPPORT_static_assert
        #define CXXO_COMPILER_SUPPORT_static_assert 1


        #undef  CXXO_COMPILER_SUPPORT_std_iterator_helpers
        #define CXXO_COMPILER_SUPPORT_std_iterator_helpers 1
        #undef  CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers
        #define CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers 1
        #undef  CXXO_COMPILER_SUPPORT_std_cxx11_constructible_traits
        #define CXXO_COMPILER_SUPPORT_std_cxx11_constructible_traits 1
        #undef  CXXO_COMPILER_SUPPORT_unique_ptr
        #define CXXO_COMPILER_SUPPORT_unique_ptr 1
        #undef  CXXO_COMPILER_SUPPORT_variadic
        #define CXXO_COMPILER_SUPPORT_variadic 1
    #else






    #endif
#endif

#if (CXXOMFORT_COMPILER_VERSION >= 407)
    #if (CXXOMFORT_CXX_STD< 2011) && (CXXOMFORT_CXX_EMULATION==2011)
        #undef  CXXO_COMPILER_SUPPORT_constexpr
        #define CXXO_COMPILER_SUPPORT_constexpr 2235
        #undef  CXXO_COMPILER_SUPPORT_user_defined_literals
        #define CXXO_COMPILER_SUPPORT_user_defined_literals 1
    #endif
#endif

................................................................................
// via usage of the __cplusplus value
#if (CXXOMFORT_CXX_STD == 2013)
    #define CXXOMFORT_CXX_EMULATION 2014
#endif


#if (CXXOMFORT_COMPILER_VERSION >= 408)
    #if (CXXOMFORT_CXX_STD< 2011) && (CXXOMFORT_CXX_EMULATION==2011)
        #undef  CXXO_COMPILER_SUPPORT_attribute
        #define CXXO_COMPILER_SUPPORT_attribute 1
        #undef  CXXO_COMPILER_SUPPORT_alignment_tools
        #define CXXO_COMPILER_SUPPORT_alignment_tools 1
        #undef  CXXO_COMPILER_SUPPORT_decltype
        #define CXXO_COMPILER_SUPPORT_decltype 2
        // 4.8 is considered to have full C++11 support for practical purposes
        // but it's untested so far
    #endif
#endif
#if (CXXOMFORT_COMPILER_VERSION >= 409)
    #if (CXXOMFORT_CXX_STD< 2011) && (CXXOMFORT_CXX_EMULATION==2011)
        // 4.8 is considered to have full C++11 support for practical purposes
        // but it's untested so far
    #else
    //    #undef CXXOMFORT_CXX_STD
    //    #define CXXOMFORT_CXX_STD 2003
    #endif
#endif

#if (CXXOMFORT_COMPILER_VERSION >= 500)
    #if (CXXOMFORT_CXX_STD>=2011)
        #undef  CXXO_COMPILER_SUPPORT_attribute_deprecated
        #define CXXO_COMPILER_SUPPORT_attribute_deprecated 1
    #endif
................................................................................
        #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

#if (CXXOMFORT_COMPILER_VERSION < 600)
    #undef  CXXO_COMPILER_SUPPORT_cstd_cuchar
    #define CXXO_COMPILER_SUPPORT_cstd_cuchar 0
#endif

#endif

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

122
123
124
125
126
127
128


129
130
131
132
133
134
135
#endif

// -- TODO -- get my claws on a MSVC 2012 / 2013 for actual testing
// At least VC2012
#if (CXXOMFORT_COMPILER_VERSION >= 1700) // VC12 or higher
    #undef  CXXO_COMPILER_SUPPORT_cstd_cstdint 
    #define CXXO_COMPILER_SUPPORT_cstd_cstdint 1


    #undef  CXXO_COMPILER_SUPPORT_enum_class
    #define CXXO_COMPILER_SUPPORT_enum_class 1
    #undef  CXXO_COMPILER_SUPPORT_foreach
    #define CXXO_COMPILER_SUPPORT_foreach 1
    #undef  CXXO_COMPILER_SUPPORT_std_common_type
    #define CXXO_COMPILER_SUPPORT_std_common_type 1
    #undef  CXXO_COMPILER_SUPPORT_std_is_trivially







>
>







122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#endif

// -- TODO -- get my claws on a MSVC 2012 / 2013 for actual testing
// At least VC2012
#if (CXXOMFORT_COMPILER_VERSION >= 1700) // VC12 or higher
    #undef  CXXO_COMPILER_SUPPORT_cstd_cstdint 
    #define CXXO_COMPILER_SUPPORT_cstd_cstdint 1
    #undef  CXXO_COMPILER_SUPPORT_cstd_typeindex
    #define CXXO_COMPILER_SUPPORT_cstd_typeindex 1
    #undef  CXXO_COMPILER_SUPPORT_enum_class
    #define CXXO_COMPILER_SUPPORT_enum_class 1
    #undef  CXXO_COMPILER_SUPPORT_foreach
    #define CXXO_COMPILER_SUPPORT_foreach 1
    #undef  CXXO_COMPILER_SUPPORT_std_common_type
    #define CXXO_COMPILER_SUPPORT_std_common_type 1
    #undef  CXXO_COMPILER_SUPPORT_std_is_trivially

Changes to cxxomfort/cxxomfort/cstddef.hpp.

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
 * @page std0cstddef
 * @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 , <code>@ref nullptr_t</code> (C++11)
 * * <code>@ref static_assert </code>(C++11)
 * * @c max_align_t (C++11)
 * * <code>@ref byte</code> (C++17)
 * 
 * See also: @ref cstdio.hpp , @ref cstdint.hpp , @ref cxxomfort-base , 
 * <a href="https://en.cppreference.com/w/cpp/header/cstddef">\<cstddef\> \@cppreference</a>.
 * 
 * 
 * **/







|
|



|




31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
 * @page std0cstddef
 * @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)
 * * @ref @c static_assert (C++11)
 * * @c max_align_t (C++11)
 * * <code>@ref byte</code> (C++17)
 * 
 * See also: @ref std0cstdio , @ref std0cstdint , @ref cxxomfort-base , 
 * <a href="https://en.cppreference.com/w/cpp/header/cstddef">\<cstddef\> \@cppreference</a>.
 * 
 * 
 * **/

Changes to cxxomfort/cxxomfort/cstdint.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#ifndef CXXOMFORT_CSTDINT_HPP
#define CXXOMFORT_CSTDINT_HPP
/**
 * @file
 *
 */

#include <cxxomfort/config.hpp>
#if (defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1))
#pragma message CXXO_NOTICE("enabled <cstdint> support.")
#endif
#include <cxxomfort/base/cstdint.hpp>
#include <cxxomfort/base.hpp>

/**







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#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
#include <cxxomfort/base/cstdint.hpp>
#include <cxxomfort/base.hpp>

/**

Changes to cxxomfort/cxxomfort/cxxomfort.hpp.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
..
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
 * </tr><tr>
 *  <th rowspan="2">Backports & Standard&nbsp;C++</th>
 *  <td align="center"> @subpage cxx03-backports -- @subpage cxx11-backports --  @subpage cxx14-backports -- @subpage cxx17-backports --  @subpage cxx20-backports
 *  <br/> @subpage transparent-headers "Transparent Headers"
 *  </td>
 *  </tr><tr><td align="center"> 
 @subpage std0cstddef "<cstddef>" - @subpage std0cstdint "<cstdint>" - <cstdio> - <cuchar>
 <br/> @subpage std0algorithm "<algorithm>" - @subpage cxxomfort/functional.hpp "<functional>" -  @subpage std0iterator "<iterator>" - @subpage std0numeric "<numeric>" - @subpage std0string "<string>" - @subpage cxxomfort/string_view.hpp "<string_view>" 
 <br/> @subpage std0memory "<memory>" - @subpage std0tuple "<tuple>" - @subpage std0utility "<utility>" 
 <br/> @subpage cxxomfort/type_traits.hpp "<type_traits>" - @subpage cxxomfort/typeindex.hpp "<typeindex>" 
 <br/> @subpage cxxomfort/array.hpp "<array>" - @subpage cxxomfort/forward_list.hpp "<forward_list>" 
 <br/> @subpage system_error.hpp "<system_error>"
 *  </tr>
 * </tr><tr>
 *  <th rowspan="2">Supplements</th>
 *  <td align="center">  @subpage cxxo-sup "Library Supplements" --  @subpage cxxo-extras "Extra Projects"
 *  </td>
 * </tr><tr>
 * <td align="center"> @c #array_ref - @c #i12n - @c #fixed_vector - foreach emulation - typesafe enum
................................................................................
 * MIT License. Check @ref LICENSE.txt for more information.
 * 
 */

//
// Setup
#include "config.hpp"


//
// Main Features
//
// (pending minor reorganization as of v0.49)
#include "base.hpp"
//#include "using.hpp"
#include "algorithm.hpp" // <algorithm> backports (copy_if, minmax, etc...)
#include "cstddef.hpp" // <cstddef> backports (byte, nullptr, etc...)
#include "cstdint.hpp" // <cstdint> backports (integer types)
#include "cuchar.hpp" // <cuchar> backports, besides char16_t, char32_t
#include "forward_list.hpp" // <forward_list> backports
#include "functional.hpp" // <functional> backports (transparent functors, etc...)
#include "iterator.hpp" // <iterator> backports (begin, end, size, data, etc...)
#include "memory.hpp" // <memory> backports (pointer_traits, alignof, unique_ptr, etc...)
#include "numeric.hpp" // <numeric> backports (iota, etc...)
#include "random.hpp" // <random> backports (rename fixes, std::random_device, etc...)
#include "string.hpp" // <string> backports (to_string, etc...)
#include "string_view.hpp" // <string_view> backports
#include "system_error.hpp" // <system_error> backports
#include "tuple.hpp" // <tuple> backports (tuple get<type>, etc...)
#include "type_traits.hpp" // <type_traits> backports (common_type, decay, is_literal, is_null_pointer, etc...)
#include "utility.hpp" // <utility> backports (declval, exchange, pair, etc...)
#include "using.hpp" // namespaces in order


#include "library.hpp" // cxxomfort library supplements
#include "limits.hpp" // compile-time integral limits


#endif








|

|
|
|







 







>

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

>

<




27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
..
63
64
65
66
67
68
69
70
71

72


73

















74
75
76
77

78
79
80
81
 * </tr><tr>
 *  <th rowspan="2">Backports & Standard&nbsp;C++</th>
 *  <td align="center"> @subpage cxx03-backports -- @subpage cxx11-backports --  @subpage cxx14-backports -- @subpage cxx17-backports --  @subpage cxx20-backports
 *  <br/> @subpage transparent-headers "Transparent Headers"
 *  </td>
 *  </tr><tr><td align="center"> 
 @subpage std0cstddef "<cstddef>" - @subpage std0cstdint "<cstdint>" - <cstdio> - <cuchar>
 <br/> @subpage std0algorithm "<algorithm>" - @subpage std0functional "<functional>" -  @subpage std0iterator "<iterator>" - @subpage std0numeric "<numeric>" - @subpage std0string "<string>" - @subpage std0string_view "<string_view>" 
 <br/> @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 std0system_error "<system_error>"
 *  </tr>
 * </tr><tr>
 *  <th rowspan="2">Supplements</th>
 *  <td align="center">  @subpage cxxo-sup "Library Supplements" --  @subpage cxxo-extras "Extra Projects"
 *  </td>
 * </tr><tr>
 * <td align="center"> @c #array_ref - @c #i12n - @c #fixed_vector - foreach emulation - typesafe enum
................................................................................
 * MIT License. Check @ref LICENSE.txt for more information.
 * 
 */

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


// Backports


#include "backports.hpp"

















//#include "using.hpp" // namespaces in order

// Supplements
#include "library.hpp" // cxxomfort library supplements



#endif

Changes to cxxomfort/cxxomfort/docgen/isr.hpp.

25
26
27
28
29
30
31

32
33
34
35
36
37
38
 * * From <code>\<forward_list\></code>: The header proper for C++03, and its utilities.
 * * From <code>\<functional\></code>: <code>@ref reference_wrapper</code>, @c ref() .
 * * From @link std0iterator <code>\<iterator\></code> @endlink : Iterator accessors @c rbegin() , @c rend() .
 * * From @link std0memory <code>\<memory\></code> @endlink : @c addressof() , @c pointer_traits , @c allocator_traits , etc.
 * * From @link std0numeric <code>\<numeric\></code> @endlink : @c iota() .
 * * From @link std0random <code>\<random\></code> @endlink : @c shuffle_order_engine and @c knuth_b , <code>#uniform_int_distribution</code>, etc.
 * * From @link std0string <code>\<string\></code> @endlink : @c to_string() , @c stoul() and siblings, etc.

 * * From <code>\<system_error\></code>: <code>@ref errc</code> , @c system_error and others, etc.
 * * From <code>\<type_traits\></code>: @c #decay , @c #enable_if , @c #conditional , etc.
 * * From <code>\<utility\></code>: @c declval() , etc.
 * 
 * See also: @ref cxx03-backports @ref cxx14-backports @ref cxx17-backports .
 */








>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 * * From <code>\<forward_list\></code>: The header proper for C++03, and its utilities.
 * * From <code>\<functional\></code>: <code>@ref reference_wrapper</code>, @c ref() .
 * * From @link std0iterator <code>\<iterator\></code> @endlink : Iterator accessors @c rbegin() , @c rend() .
 * * From @link std0memory <code>\<memory\></code> @endlink : @c addressof() , @c pointer_traits , @c allocator_traits , etc.
 * * From @link std0numeric <code>\<numeric\></code> @endlink : @c iota() .
 * * From @link std0random <code>\<random\></code> @endlink : @c shuffle_order_engine and @c knuth_b , <code>#uniform_int_distribution</code>, etc.
 * * From @link std0string <code>\<string\></code> @endlink : @c to_string() , @c stoul() and siblings, etc.
 * * From @link std0string_view <code>\<string_view\></code> @endlink : @c string_view , etc.
 * * From <code>\<system_error\></code>: <code>@ref errc</code> , @c system_error and others, etc.
 * * From <code>\<type_traits\></code>: @c #decay , @c #enable_if , @c #conditional , etc.
 * * From <code>\<utility\></code>: @c declval() , etc.
 * 
 * See also: @ref cxx03-backports @ref cxx14-backports @ref cxx17-backports .
 */

Changes to cxxomfort/cxxomfort/functional.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
























#ifndef CXXOMFORT_FUNCTIONAL_HPP
#define CXXOMFORT_FUNCTIONAL_HPP

/**
 * @file
 * @brief Implementations and backports tied to <code>\<functional\></code>.
 * 
 * Interfaces defined in this file:
 * 
 * * Bit functoids @c bit_and , @c bit_or , @c bit_xor (C++03, only for some cases)
 * * @link impl/14-functional-transparent.hpp Transparent / Heterogegenous Functors @endlink (C++14)
 * * (Only for non-available TR1) #reference_wrapper and its assisting functions.
 *
 * 
 * Features planned for future versions:
 * 
 * * @c not_fn() (C++17)
 * * Recovered function adaptors @c bind1st() , @c bind2nd() and @c ptr_fun (C++17/C++20).
 * 
 * See also: @ref cxxo-sup-functional , 
 * <a href="https://en.cppreference.com/w/cpp/header/functional">\<functional\> \@cppreference</a>.
 * 
 */



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

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














namespace cxxomfort {
namespace cxxostd {
}







}







// The bit_and and sibling functors from <functional> are missing in MSVC 2008
#include "./impl/03-functional_bit.hpp"

#include "./impl/14-functional-transparent.hpp"

//#include "./impl/17-notfn.hpp"

//#include "./umpl/03-restore_binders.hpp"

// extra power for std::hash
#include "./impl/hash.hpp"

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

/**
 * @file
 * @brief Implementations and backports tied to <code>\<functional\></code>.
 * @xrefitem std0functional "<functional>" "Header File"

 * 



 * */













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

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

#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC,>0) && CXXOMFORT_CXX_EMULATION < 2011)
#include <tr1/functional>
namespace std {
    namespace placeholders { using namespace ::std::tr1::placeholders; };
    using tr1::reference_wrapper;
    using tr1::ref;
    using tr1::cref;
    using tr1::hash;
    using tr1::bind;
    using tr1::function;
}
#endif

namespace cxxomfort {
namespace cxxostd {

#if (CXXOMFORT_CXX_STD >= 2017)
#elif (CXXOMFORT_CXX_STD >= 2011)
template<typename F, typename... Args>
auto invoke(F f, Args&&... args) 
-> decltype(std::ref(f)(std::forward<Args>(args)...))
{
    return std::ref(f)(std::forward<Args>(args)...);
}

#else

#endif

}} // cxxomfort::cxxostd

// The bit_and and sibling functors from <functional> are missing in MSVC 2008
#include "./impl/03-functional_bit.hpp"

#include "./impl/14-functional-transparent.hpp"

#include "./impl/n4022-not_fn.hpp"

//#include "./umpl/03-restore_binders.hpp"

// extra power for std::hash
#include "./impl/hash.hpp"

#endif

/**
 * @page std0functional
 * @brief Backports related to <functional>
 * 
 * Interfaces defined in this section:
 * 
 * * Bit functoids @c bit_and , @c bit_or , @c bit_xor (C++03, only for some cases).
 * * @link impl/14-functional-transparent.hpp Transparent / Heterogegenous Functors @endlink (C++14).
 * * @link cxxomfort::cxxostd::reference_wrapper reference_wrapper @endlink (C++03) and its assisting functions.
 *
 * 
 * @section future "Planned for the future"
 * 
 * * @c not_fn() (C++17) - generalically negate any functor.
 * * Recovered function adaptors @c bind1st() , @c bind2nd() and @c ptr_fun (C++17/C++20).
 * 
 * 
 * @section also See Also
 * 
 * * @see @cppref{header/functional} 
 * * @see @ref cxxo-sup-functional (supplemental)
 * 
 */

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

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

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

namespace std {








|







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

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

namespace std {

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

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

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

// fix renamed functors in <random> between C++03 TR1 and C++11
#if ((CXXOMFORT_CXX_STD < 2011) && (CXXOMFORT_CXX_EMULATION < 2011))
namespace std { 
namespace tr1 {

// These are only "good enough to work" fixes.


template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
class linear_congruential_engine 
: public linear_congruential<_UIntType, __a, __c, __m> {
    private:







|
<
<







7
8
9
10
11
12
13
14


15
16
17
18
19
20
21

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

// fix renamed functors in <random> between C++03 TR1 and C++11
#if ((CXXOMFORT_CXX_STD < 2011) && (CXXOMFORT_CXX_EMULATION < 2011))
namespace std { namespace tr1 { 


// These are only "good enough to work" fixes.


template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
class linear_congruential_engine 
: public linear_congruential<_UIntType, __a, __c, __m> {
    private:

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

6
7
8
9
10
11
12


13
14
15
16
17
18
19
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 *
 */

#include "../config.hpp"

#if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION==0)


    #define CXXOMFORT_USING_addressof
#endif // c++11

namespace cxxomfort {
namespace cxxostd {

/**







>
>







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 *
 */

#include "../config.hpp"

#if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION==0)
    #define CXXOMFORT_USING_addressof
#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_COMPILER_VERSION<406 && CXXOMFORT_CXX_EMULATION==2011)
    #define CXXOMFORT_USING_addressof
#endif // c++11

namespace cxxomfort {
namespace cxxostd {

/**

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

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
..
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
 * @file 
 * @brief Implementation of std::decay
 */

#include <cxxomfort/config.hpp>
#include <cxxomfort/type_traits.hpp> // remove_reference etc
#include <cxxomfort/using.hpp>

// obtained directly from cppreference.

namespace cxxomfort {
namespace cxxostd {

/**
 * @brief Given a type, applies the same transformations as the ones 
 * used in the language for implicit conversion at call site: 
 * array-to-pointer, function-to-pointer and loss of reference.
 * @see https://en.cppreference.com/w/cpp/types/decay
 * @ingroup cxx11-backports
................................................................................
            typename std::add_pointer<U>::type,
            typename std::remove_cv<U>::type
        >::type
    >::type type;
};


} // cxxostd
}

#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#else
    #if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011 /* && CXXO_COMPILER_SUPPORT_tr1_type_traits==0 */ )
    namespace std {
        using ::cxxomfort::cxxostd::decay;
    }
    #endif
#endif

#endif







|



|
<







 







|
<











7
8
9
10
11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
..
38
39
40
41
42
43
44
45

46
47
48
49
50
51
52
53
54
55
56
/**
 * @file 
 * @brief Implementation of std::decay
 */

#include <cxxomfort/config.hpp>
#include <cxxomfort/type_traits.hpp> // remove_reference etc
//#include <cxxomfort/using.hpp>

// obtained directly from cppreference.

namespace cxxomfort { namespace cxxostd {


/**
 * @brief Given a type, applies the same transformations as the ones 
 * used in the language for implicit conversion at call site: 
 * array-to-pointer, function-to-pointer and loss of reference.
 * @see https://en.cppreference.com/w/cpp/types/decay
 * @ingroup cxx11-backports
................................................................................
            typename std::add_pointer<U>::type,
            typename std::remove_cv<U>::type
        >::type
    >::type type;
};


}  }  // cxxomfort::cxxostd


#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#else
    #if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011 /* && CXXO_COMPILER_SUPPORT_tr1_type_traits==0 */ )
    namespace std {
        using ::cxxomfort::cxxostd::decay;
    }
    #endif
#endif

#endif

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

1
2
3
4
5
6
7
8
9
10
11
..
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef CXXOMFORT_IMPL_MINMAX_HPP
#define CXXOMFORT_IMPL_MINMAX_HPP
/**
 * @file cxxomfort/algorithm.hpp
 */

#define CXXOMFORT_IMPLEMENTS_n1990 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_minmax CXXOMFORT_IMPLEMENTS_n1990

#include <cxxomfort/config.hpp>

................................................................................
/**
 * @ingroup cxx11-backports
 * @{
 */

/**
 * Return a <code>pair(min,max)</code> from two arguments and a comparator @a Less .
 * @xrefitem std0algorithm "<algorithm> backports" ""
 * @return A @c pair (min, max)
 * */
template <typename T, typename Comparator>
std::pair<T const&, T const&> minmax (T const& a, T const& b, Comparator Less) {
    return Less(b,a) ? 
    std::pair<T const&, T const&>(b, a) : std::pair<T const&, T const&>(a, b)
    ;
................................................................................
    std::pair<T const&,T const&>(b, a) : std::pair<T const&,T const&>(a, b)
    ;
}

/**
 * @brief Returns the pair (minimum,maximum) for the given sequence and comparator @p less .
 * @param less A comparator object with the same semantics as <code>std::less</code> .
 * @xrefitem std0algorithm "<algorithm> backports" ""
 * @return A <code>std::pair</code> containing the minimum and maximum.
 */
template <typename FIterator, typename Comparator>
std::pair<FIterator,FIterator> 
minmax_element (FIterator ini, FIterator fin, Comparator less) {
    std::pair<FIterator, FIterator> result(ini, fin);
 



|







 







|







 







|







1
2
3
4
5
6
7
8
9
10
11
..
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef CXXOMFORT_IMPL_MINMAX_HPP
#define CXXOMFORT_IMPL_MINMAX_HPP
/**
 * @file 
 */

#define CXXOMFORT_IMPLEMENTS_n1990 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_minmax CXXOMFORT_IMPLEMENTS_n1990

#include <cxxomfort/config.hpp>

................................................................................
/**
 * @ingroup cxx11-backports
 * @{
 */

/**
 * Return a <code>pair(min,max)</code> from two arguments and a comparator @a Less .
 * @xrefitem std0algorithm "<algorithm> backports" "Search"
 * @return A @c pair (min, max)
 * */
template <typename T, typename Comparator>
std::pair<T const&, T const&> minmax (T const& a, T const& b, Comparator Less) {
    return Less(b,a) ? 
    std::pair<T const&, T const&>(b, a) : std::pair<T const&, T const&>(a, b)
    ;
................................................................................
    std::pair<T const&,T const&>(b, a) : std::pair<T const&,T const&>(a, b)
    ;
}

/**
 * @brief Returns the pair (minimum,maximum) for the given sequence and comparator @p less .
 * @param less A comparator object with the same semantics as <code>std::less</code> .
 * @xrefitem std0algorithm "<algorithm> backports" "Search"
 * @return A <code>std::pair</code> containing the minimum and maximum.
 */
template <typename FIterator, typename Comparator>
std::pair<FIterator,FIterator> 
minmax_element (FIterator ini, FIterator fin, Comparator less) {
    std::pair<FIterator, FIterator> result(ini, fin);
 

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

1
2
3
4
5

6
7
8
9
10
11
12
..
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
...
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
...
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
...
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
#ifndef CXXOMFORT_IMPL_STRING_HPP
#define CXXOMFORT_IMPL_STRING_HPP
/**
 * @file
 * @brief Implementation for std::to_string and allies 

 *
 */

#include <cxxomfort/base.hpp>
#include <cxxomfort/util/type_traits.hpp> // is_arithmetic w/o C++11 dependency
#include <string>
#include <cstdio>
................................................................................
#if (CXXOMFORT_CXX_STD >= 2011)
#else
    #define CXXOMFORT_USING_to_string
#endif

#if (defined(CXXOMFORT_NOTICES))
    #if (CXXOMFORT_NOTICES > 1)
    #pragma message CXXO_NOTICE("enabled to_string helper.")
    #endif
#endif

#define CXXO_INTEGERDIGITS(T) std::numeric_limits< T >::digits10 + 3
#define CXXO_FLOATDIGITS(T) std::numeric_limits< T >::digits10 + 8

//
................................................................................
};


} //cxxomfort::cxxostd::detail_string


/**
 * @fn to_string
 * @brief Converts an integral variable into a @c std::string .
 * @ingroup cxx11-backports
 * @param i A variable of one of C++'s integer ("integral") types.
 * @return a @c std::string

 * */
static inline std::string to_string (int i) {
    return detail_string::stringexpr(i);
}
//! @overload to_string
static inline std::string to_string (unsigned int u) {
    return detail_string::stringexpr(u);
}
//! @overload to_string
static inline std::string to_string (short i) {
    return detail_string::stringexpr(i);
}
//! @overload to_string
static inline std::string to_string (unsigned short u) {
    return detail_string::stringexpr(u);
}
//! @overload to_string(unsigned short)
static inline std::string to_string (long long i) {
    return detail_string::stringexpr(i);
}
//! @overload to_string(unsigned short)
static inline std::string to_string (unsigned long long u) {
    return detail_string::stringexpr(u);
}
//! @overload to_string
static inline std::string to_string (long i) {
    return detail_string::stringexpr(i);
}
//! @overload to_string
static inline std::string to_string (unsigned long u) {
    return detail_string::stringexpr(u);
}
//! @overload to_string
static inline std::string to_string (float i) {
    return detail_string::stringexpr(i);
}
//! @overload to_string
static inline std::string to_string (double i) {
    return detail_string::stringexpr(i);
}
//! @overload to_string
static inline std::string to_string (long double i) {
    return detail_string::stringexpr(i);
}

/*
std::wstring to_wstring (unsigned int i) {
    return detail::stringexpr(i);
................................................................................

std::wstring to_wstring (int i) {
    return detail::stringexpr(i);
}
*/



//! Converts a string expression to <code>unsigned long</code>.



static inline unsigned long       stoul (std::string const& str, size_t* pinv, int base=10) {
    return detail_string::string_to_integral<unsigned long>(str,pinv,base);
//    return strtoul (str.c_str(), pinv, base);
}


//! Converts a string expression to <code>unsigned long long</code>.



static inline unsigned long long  stoull (std::string const& str, size_t* pinv, int base=10) {
    return detail_string::string_to_integral<unsigned long long>(str,pinv,base);
//    return strtoull (str.c_str(), pinv, base);
}

//! Converts a string expression to <code>signed long</code>.




static inline signed long         stol (std::string const& str, size_t * pinv, int base=10) {
    return detail_string::string_to_integral<signed long>(str,pinv,base);
//    return strtol (str.c_str(), pinv, base);
}

//! Converts a string expression to <code>signed long long</code>.




static inline signed long long    stoll (std::string const& str, size_t * pinv, int base=10) {
    return detail_string::string_to_integral<signed long long>(str,pinv,base);
//    return strtoll (str.c_str(), pinv, base);
}

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


#if (CXXOMFORT_CXX_STD >= 2011)
#elif (CXXOMFORT_CXX_EMULATION==0)
namespace std {

    //! using to_string (backport to c++03)
    //! @ref cxx03-backports
    using ::cxxomfort::cxxostd::to_string;

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



>







 







|







 







|


|

>

|
|

|



|



|



|



|



|



|



|



|



|







 







>
|
>
>
>





>
|
>
>
>





|
>
>
>
>





|
>
>
>
>







 







<







1
2
3
4
5
6
7
8
9
10
11
12
13
..
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
...
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
...
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
...
319
320
321
322
323
324
325

326
327
328
329
330
331
332
#ifndef CXXOMFORT_IMPL_TO_STRING_HPP
#define CXXOMFORT_IMPL_TO_STRING_HPP
/**
 * @file
 * @brief Implementation for std::to_string and allies 
 * @xrefitem std0string "<string>"
 *
 */

#include <cxxomfort/base.hpp>
#include <cxxomfort/util/type_traits.hpp> // is_arithmetic w/o C++11 dependency
#include <string>
#include <cstdio>
................................................................................
#if (CXXOMFORT_CXX_STD >= 2011)
#else
    #define CXXOMFORT_USING_to_string
#endif

#if (defined(CXXOMFORT_NOTICES))
    #if (CXXOMFORT_NOTICES > 1)
    #pragma message CXXO_NOTICE("backport to_string.")
    #endif
#endif

#define CXXO_INTEGERDIGITS(T) std::numeric_limits< T >::digits10 + 3
#define CXXO_FLOATDIGITS(T) std::numeric_limits< T >::digits10 + 8

//
................................................................................
};


} //cxxomfort::cxxostd::detail_string


/**
 * @fn to_string(int)
 * @brief Converts an integral variable into a @c std::string .
 * @ingroup cxx11-backports
 * @param integer A variable of one of C++'s integer ("integral") types (see overloads).
 * @return a @c std::string
 * @xrefitem std0string "<string>" "String Conversions - to_string"
 * */
static inline std::string to_string (int integer) {
    return detail_string::stringexpr(integer);
}
//! @overload to_string(int)
static inline std::string to_string (unsigned int u) {
    return detail_string::stringexpr(u);
}
//! @overload to_string(int)
static inline std::string to_string (short i) {
    return detail_string::stringexpr(i);
}
//! @overload to_string(int)
static inline std::string to_string (unsigned short u) {
    return detail_string::stringexpr(u);
}
//! @overload to_string(int)
static inline std::string to_string (long long i) {
    return detail_string::stringexpr(i);
}
//! @overload to_string(int)
static inline std::string to_string (unsigned long long u) {
    return detail_string::stringexpr(u);
}
//! @overload to_string(int)
static inline std::string to_string (long i) {
    return detail_string::stringexpr(i);
}
//! @overload to_string(int)
static inline std::string to_string (unsigned long u) {
    return detail_string::stringexpr(u);
}
//! @overload to_string(int)
static inline std::string to_string (float i) {
    return detail_string::stringexpr(i);
}
//! @overload to_string(int)
static inline std::string to_string (double i) {
    return detail_string::stringexpr(i);
}
//! @overload to_string(int)
static inline std::string to_string (long double i) {
    return detail_string::stringexpr(i);
}

/*
std::wstring to_wstring (unsigned int i) {
    return detail::stringexpr(i);
................................................................................

std::wstring to_wstring (int i) {
    return detail::stringexpr(i);
}
*/


/**
 * @brief Converts a @c string expression to a <code>unsigned long</code>.
 * @param base Base to convert from, which can be 2, 8, 10 (default) or 16.
 * @xrefitem std0string "<string>" "Conversions"
 **/
static inline unsigned long       stoul (std::string const& str, size_t* pinv, int base=10) {
    return detail_string::string_to_integral<unsigned long>(str,pinv,base);
//    return strtoul (str.c_str(), pinv, base);
}

/**
 * @brief Converts a @c string expression to a <code>unsigned long long</code>.
 * @param base Base to convert from, which can be 2, 8, 10 (default) or 16.
 * @xrefitem std0string "<string>" "Conversions"
 **/
static inline unsigned long long  stoull (std::string const& str, size_t* pinv, int base=10) {
    return detail_string::string_to_integral<unsigned long long>(str,pinv,base);
//    return strtoull (str.c_str(), pinv, base);
}

/**
 * @brief Converts a @c string expression to a <code>long</code>.
 * @param base Base to convert from, which can be 2, 8, 10 (default) or 16.
 * @xrefitem std0string "<string>" "Conversions"
 **/
static inline signed long         stol (std::string const& str, size_t * pinv, int base=10) {
    return detail_string::string_to_integral<signed long>(str,pinv,base);
//    return strtol (str.c_str(), pinv, base);
}

/**
 * @brief Converts a @c string expression to a <code>long long</code>.
 * @param base Base to convert from, which can be 2, 8, 10 (default) or 16.
 * @xrefitem std0string "<string>" "Conversions"
 **/
static inline signed long long    stoll (std::string const& str, size_t * pinv, int base=10) {
    return detail_string::string_to_integral<signed long long>(str,pinv,base);
//    return strtoll (str.c_str(), pinv, base);
}

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


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

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

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
..
33
34
35
36
37
38
39




40
41
42
43
44
45
46
..
68
69
70
71
72
73
74
75
76
77
78
79
80
81
 */

#include <cxxomfort/base.hpp>
#include <typeinfo>
#include <functional> // std::hash
#include <string> // for debug of hash_code
#include <cxxomfort/impl/relationals.hpp>
#include <cxxomfort/using.hpp> // std::tr1::hash

namespace cxxomfort { namespace cxxostd { 

static inline size_t ty_id () {
    static size_t i= 0;
    return i++;
}
................................................................................
struct impl_hash_code {
    static const size_t value;
};

template<typename T> 
const size_t impl_hash_code<T>::value = ty_id();





class type_index {
    public:
    type_index (std::type_info const& t)
    : TR(&t) {}
    
    type_index& operator= (std::type_info const& r) CXXO_NOEXCEPTNOTHROW {
        TR= &r;
................................................................................
    }

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

CXXO_GENERATE_RELATIONALS0(type_index);

} }

#endif // 









|







 







>
>
>
>







 







|






16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
..
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
..
72
73
74
75
76
77
78
79
80
81
82
83
84
85
 */

#include <cxxomfort/base.hpp>
#include <typeinfo>
#include <functional> // std::hash
#include <string> // for debug of hash_code
#include <cxxomfort/impl/relationals.hpp>
//#include <cxxomfort/using.hpp> // std::tr1::hash

namespace cxxomfort { namespace cxxostd { 

static inline size_t ty_id () {
    static size_t i= 0;
    return i++;
}
................................................................................
struct impl_hash_code {
    static const size_t value;
};

template<typename T> 
const size_t impl_hash_code<T>::value = ty_id();

/**
 * An orderable, comparable view of a <code>std::type_info</code>.
 * 
 * */
class type_index {
    public:
    type_index (std::type_info const& t)
    : TR(&t) {}
    
    type_index& operator= (std::type_info const& r) CXXO_NOEXCEPTNOTHROW {
        TR= &r;
................................................................................
    }

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

CXXO_GENERATE_RELATIONALS(type_index);

} }

#endif // 


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

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

namespace cxxomfort { namespace cxxostd { namespace iterator {

/**
 * @fn cbegin
 * @brief Returns an iterator to the beginning of a given container or sequence.
 * @ingroup cxx14-backports
 * @xrefitem std0iterator
 * */

/**
 * @fn cend
 * @brief Returns an iterator to the end of a given container or sequence.
 * @ingroup cxx14-backports
 * @xrefitem std0iterator
 * */

#if (CXXOMFORT_CXX_STD >= 2011)

template <typename C>
constexpr auto
cbegin (C const& c)  -> decltype(std::begin(c)) {







|






|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

namespace cxxomfort { namespace cxxostd { namespace iterator {

/**
 * @fn cbegin
 * @brief Returns an iterator to the beginning of a given container or sequence.
 * @ingroup cxx14-backports
 * @xrefitem std0iterator "<iterator>" ""
 * */

/**
 * @fn cend
 * @brief Returns an iterator to the end of a given container or sequence.
 * @ingroup cxx14-backports
 * @xrefitem std0iterator "<iterator>" ""
 * */

#if (CXXOMFORT_CXX_STD >= 2011)

template <typename C>
constexpr auto
cbegin (C const& c)  -> decltype(std::begin(c)) {

Added cxxomfort/cxxomfort/impl/17-INVOKE.hpp.













































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef CXXOMFORT_IMPL_17_INVOKE_HPP
#define CXXOMFORT_IMPL_17_INVOKE_HPP

namespace cxxomfort { namespace cxxostd {

#if (CXXOMFORT_CXX_STD >= 2017)
#elif (CXXOMFORT_CXX_STD >= 2011)
// drawn from cppreference's page on std::invoke_result

// Conforming C++14 implementation (is also a valid C++11 implementation):
namespace detail {

namespace detail {

template <class T>
struct is_reference_wrapper : std::false_type {};
template <class U>
struct is_reference_wrapper<std::reference_wrapper<U>> : std::true_type {};
 
template<class T>
struct invoke_impl {
    template<class F, class... Args>
    static auto call(F&& f, Args&&... args)
        -> decltype(std::forward<F>(f)(std::forward<Args>(args)...));
};
 
template<class B, class MT>
struct invoke_impl<MT B::*> {
    template<class T, class Td = typename std::decay<T>::type,
        class = typename std::enable_if<std::is_base_of<B, Td>::value>::type
    >
    static auto get(T&& t) -> T&&;
 
    template<class T, class Td = typename std::decay<T>::type,
        class = typename std::enable_if<is_reference_wrapper<Td>::value>::type
    >
    static auto get(T&& t) -> decltype(t.get());
 
    template<class T, class Td = typename std::decay<T>::type,
        class = typename std::enable_if<!std::is_base_of<B, Td>::value>::type,
        class = typename std::enable_if<!is_reference_wrapper<Td>::value>::type
    >
    static auto get(T&& t) -> decltype(*std::forward<T>(t));
 
    template<class T, class... Args, class MT1,
        class = typename std::enable_if<std::is_function<MT1>::value>::type
    >
    static auto call(MT1 B::*pmf, T&& t, Args&&... args)
        -> decltype((invoke_impl::get(std::forward<T>(t)).*pmf)(std::forward<Args>(args)...));
 
    template<class T>
    static auto call(MT B::*pmd, T&& t)
        -> decltype(invoke_impl::get(std::forward<T>(t)).*pmd);
};
 
template<class F, class... Args, class Fd = typename std::decay<F>::type>
auto INVOKE(F&& f, Args&&... args)
    -> decltype(invoke_impl<Fd>::call(std::forward<F>(f), std::forward<Args>(args)...));
 

template <typename AlwaysVoid, typename, typename...>
struct invoke_result { };

template <typename F, typename...Args>
struct invoke_result<decltype(void(detail::INVOKE(std::declval<F>(), std::declval<Args>()...))),
                 F, Args...> {
    using type = decltype(detail::INVOKE(std::declval<F>(), std::declval<Args>()...));
};
} // namespace detail
 
template <class> struct result_of;
template <class F, class... ArgTypes>
struct result_of<F(ArgTypes...)> : detail::invoke_result<void, F, ArgTypes...> {};
 
template <class F, class... ArgTypes>
struct invoke_result : detail::invoke_result<void, F, ArgTypes...> {};


#else
// nothing to do for c++03

#endif

} }

#endif

Changes to cxxomfort/cxxomfort/impl/17-as_const.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
#ifndef CXXOMFORT_IMPL_AS_CONST_HPP
#define CXXOMFORT_IMPL_AS_CONST_HPP
/**
 * @file
 * @brief Implements std::add_const 
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 *
 */

// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2015/n4380.html

#define CXXOMFORT_IMPLEMENTS_n4380 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_as_const CXXOMFORT_IMPLEMENTS_n4380


#include "../config.hpp"
#include <utility>
#include "../util/type_traits.hpp" // add_const

namespace cxxomfort {
namespace cxxostd {

/**
 * @brief returns a @c const  view of object @p t . A @ref cxx17-backports .
 * @return A reference to its argument with @c const qualifier added.
 * @ingroup cxx17-backports

 * @xrefitem std:utility "<utility>" ""
 */
template< typename T >
inline CXXO_CONSTEXPR typename cxxomfort::traits::add_const< T >::type & 
as_const( T& t ) CXXO_NOEXCEPT {
    return t;
}

} // utility
















} // cxxomfort


#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#else
namespace std {
    using cxxomfort::cxxostd::as_const;

}
#endif

#if defined (DOXYGEN_DOC)
namespace cxxomfort {
    //! @brief Const view
    template <typename T> T const& as_const (T&) {}
}

#endif

#endif // file




|




<



<












>








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






>



<
<
<
<
|
<
<
<

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
#ifndef CXXOMFORT_IMPL_AS_CONST_HPP
#define CXXOMFORT_IMPL_AS_CONST_HPP
/**
 * @file
 * @brief Implements std::add_const by David Alan Martin
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 *
 */



#define CXXOMFORT_IMPLEMENTS_n4380 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_as_const CXXOMFORT_IMPLEMENTS_n4380


#include "../config.hpp"
#include <utility>
#include "../util/type_traits.hpp" // add_const

namespace cxxomfort {
namespace cxxostd {

/**
 * @brief returns a @c const  view of object @p t . A @ref cxx17-backports .
 * @return A reference to its argument with @c const qualifier added.
 * @ingroup cxx17-backports
 * @see @wg21{n4380}
 * @xrefitem std:utility "<utility>" ""
 */
template< typename T >
inline CXXO_CONSTEXPR typename cxxomfort::traits::add_const< T >::type & 
as_const( T& t ) CXXO_NOEXCEPT {
    return t;
}

// extend with p1011r0 - as_ptr_const
#define CXXOMFORT_IMPLEMENTS_p1011r0 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_as_ptr_const CXXOMFORT_IMPLEMENTS_p1011r0

/**
 * @brief returns a @c const  view of a pointer @p t . An extension to @c as_const() .
 * @return A pointer to a const view of the argument.
 * @ingroup cxx17-backports
 * @see @wg21{p1011r0} , @ref as_const()
 * @xrefitem std0utility "<utility>" ""
 */
template< typename T >
inline CXXO_CONSTEXPR14 typename cxxomfort::traits::add_const< T >::type *
as_ptr_const( T* const t ) CXXO_NOEXCEPTNOTHROW {
    return t;
}
    
} } // cxxomfort::cxxostd


#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#else
namespace std {
    using cxxomfort::cxxostd::as_const;

}
#endif









#endif // file

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

113
114
115
116
117
118
119
120
121
122
123
124
125
126
127

template <typename C>
bool empty (C const& c) {
    return c.empty();
}

template <typename T, size_t N>
CXXO_CONSTEXPR bool empty (T const (&a)[N]) CXXO_NOEXCEPT {
    return false;
}

#if (CXXOMFORT_CXX_STD>=2011 && CXXOMFORT_CXX_STD<2017)
template <typename T>
constexpr bool empty (std::initializer_list<T> const& i) noexcept {
    return i.size()==0;







|







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127

template <typename C>
bool empty (C const& c) {
    return c.empty();
}

template <typename T, size_t N>
CXXO_CONSTEXPR bool empty (T const (&)[N]) CXXO_NOEXCEPT {
    return false;
}

#if (CXXOMFORT_CXX_STD>=2011 && CXXOMFORT_CXX_STD<2017)
template <typename T>
constexpr bool empty (std::initializer_list<T> const& i) noexcept {
    return i.size()==0;

Added cxxomfort/cxxomfort/impl/17-not_fn.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
#ifndef CXXOMFORT_IMPL_17_NOT_FN_HPP
#define CXXOMFORT_IMPL_17_NOT_FN_HPP
/**
 * @file impl/17-not_fn.hpp
 * @brief Implementation of std::not_fn
 * 
 * 
 */

#include <cxxomfort/base.hpp>
#include <functional>
#include "11-decay.hpp"

namespace cxxomfort { namespace cxxostd {

template <typename Fn>
struct not_fn_t {
    private:
    typedef typename std::decay<Fn>::type Dn;
    
    public:
    
    explicit not_fn_t (Fn& fn)
    : fn(f) {}
    
#if (CXXOMFORT_CXX_STD >= 2011)
    template <typename... Args>
    bool operator() (Args&&... args) const {
        return !(f.operator()(args...));
    }
#else
    bool operator() () const {
        return !f();
    }
    template <typename T1>
    bool operator() (T1 t) const {
        return !f(t);
    }
    template <typename T1, typename T2>
    bool operator() (T1 t1, T2 t2) const {
        return !f(t1,t2);
    }
    template <typename T1, typename T2, typename T3>
    bool operator() (T1 t1, T2 t2, T3 t3) const {
        return !f(t1,t2,t3);
    }
#endif
    Dn f;
};


} }



#endif

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

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

#include <cstring>
#include <algorithm>
#include <cxxomfort/impl/n3334-array_ref.hpp>
#include <cxxomfort/util/type_traits.hpp>

#include <ostream>

namespace cxxomfort { namespace cxxostd {

/**
 * @brief View of a string or string-like object








 * */
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:
    // using membertype::value_type;
    typedef typename membertype::value_type      value_type;
    typedef typename membertype::size_type          size_type;
    typedef typename membertype::difference_type    difference_type;
    typedef typename membertype::pointer            pointer;
    typedef typename membertype::const_pointer   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;

    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(v) );
    

    CXXO_CONSTEXPR basic_string_view (pointer px, size_t sz) CXXO_NOEXCEPTNOTHROW
    : membertype(px,sz)
    {}
    

    CXXO_CONSTEXPR basic_string_view (pointer px) CXXO_NOEXCEPTNOTHROW 
    : membertype(px, CTraits::length(px) )
    {}


    template<size_t N>
    CXXO_CONSTEXPR basic_string_view (CharT const(&arr)[N])
    : membertype(arr,N)
    {}

    using membertype::max_size;
    using membertype::size;
    using membertype::empty;
    using membertype::data;

    CXXO_CONSTEXPR 
    size_type  length () const CXXO_NOEXCEPTNOTHROW { return this->size(); }
    
    using membertype::begin;
    using membertype::end;
    

    using membertype::operator[];

    reference       at (size_type idx) { return this->at(idx); }
    const_reference at (size_type idx) const { return this->at(idx); }
    
    using membertype::front;
    using membertype::back;
    

    size_type  copy (CharT* d, size_type count, size_type pos=0) const;

    basic_string_view    substr (size_type pos, size_type count = npos) const;
    
    int        compare (basic_string_view r) const CXXO_NOEXCEPTNOTHROW;
    int        compare (pointer r) const CXXO_NOEXCEPTNOTHROW;
    


    CXXO_CONSTEXPR  
    size_type  find (basic_string_view, size_type pos=0) const CXXO_NOEXCEPTNOTHROW;

    CXXO_CONSTEXPR
    size_type  find (CharT, size_type pos= 0) const CXXO_NOEXCEPTNOTHROW;
    CXXO_CONSTEXPR

    size_type  find (const_pointer s, size_type pos= 0) const CXXO_NOEXCEPTNOTHROW {
        return find(basic_string_view(s), pos);
    }
    CXXO_CONSTEXPR
    size_type  find (const_pointer s, size_type pos, size_type count) const CXXO_NOEXCEPTNOTHROW {
        return find(basic_string_view(s,count), pos);
    }
    

    size_type  rfind (basic_string_view, size_type pos=0) const CXXO_NOEXCEPTNOTHROW ;

    size_type  rfind (CharT, size_type pos= 0) const CXXO_NOEXCEPTNOTHROW ;

    size_type  rfind (const_pointer s, size_type pos= 0) const CXXO_NOEXCEPTNOTHROW {
        return rfind(basic_string_view(s), pos);
    }
    CXXO_CONSTEXPR

    size_type  ffind (const_pointer s, size_type pos, size_type count) const CXXO_NOEXCEPTNOTHROW {
        return ffind(basic_string_view(s,count), pos);
    }








    
};

// Copies the substring [pos, pos + rcount) to the character string pointed to by dest, 
// where rcount is the smaller of count and size() - pos
template <typename Ch, typename ChT>
typename basic_string_view<Ch,ChT>::size_type basic_string_view<Ch,ChT>::copy 
................................................................................
    using namespace std;
    // rcount is the smaller of count and size() - pos. 
    size_type rcount = min(count, size()-pos);
    return basic_string_view(data()+pos,rcount);
}

template <typename Ch, typename ChT>












CXXO_CONSTEXPR
typename basic_string_view<Ch,ChT>::size_type basic_string_view<Ch,ChT>::find 
(basic_string_view<Ch,ChT> s, size_type pos) const CXXO_NOEXCEPTNOTHROW {
    if (pos >= this->length()) return npos;
    using namespace std;
    const_iterator st = this->begin()+pos;
    const_iterator loc = search(
        st, this->end(), s.begin(), s.end());
    if (loc==this->end()) return npos;
    else return static_cast<size_type>(loc - this->begin());
}


template <typename Ch, typename ChT>
CXXO_CONSTEXPR
typename basic_string_view<Ch,ChT>::size_type basic_string_view<Ch,ChT>::find 
(Ch c, size_type pos) const CXXO_NOEXCEPTNOTHROW {
    using namespace std;
    if (pos >= this->length()) return npos;
    const_iterator pf = std::find(this->begin()+pos, this->end(), c);
    if (pf == this->end()) return npos;
    else return pf - this->begin();
}

// searches the last occurrence

template <typename Ch, typename ChT>
CXXO_CONSTEXPR
typename basic_string_view<Ch,ChT>::size_type basic_string_view<Ch,ChT>::rfind 
(basic_string_view<Ch,ChT> s, size_type pos) const CXXO_NOEXCEPTNOTHROW {
    if (pos >= this->length()) return npos;
    using namespace std;
    const_iterator st = this->begin()+pos;
    const_iterator loc = find_end(
        st, this->end(), s.begin(), s.end());
    if (loc==this->end()) return npos;
    else return static_cast<size_type>(loc - this->begin());
}







//CXXO_GENERATE_RELATIONALS_T(basic_string_view,CharT,Traits);


typedef basic_string_view<char> string_view;

typedef basic_string_view<wchar_t> wstring_view;
#if (CXXOMFORT_CXX_STD >= 2011)
typedef basic_string_view<char16_t> u16string_view;
typedef basic_string_view<char32_t> u32string_view;
#endif





template <class Ch, class ChTraits>
std::basic_ostream<Ch, ChTraits>&
operator<<  (std::basic_ostream<Ch, ChTraits>& os, basic_string_view<Ch, ChTraits> v) {
    using namespace std;
    //size_t const n= max(static_cast<size_t>(os.width()), v.size());
    //os.rdbuf()->sputn(v.data(), n);
    for (size_t i= 0; i < v.size(); ++i) { os<< v[i]; }







>





|
>
>
>
>
>
>
>
>







<











>









>




>




>









>





|
>

>





|
>

>





>
>
|

>
|

<
>



|




>

>

>



<
>
|
|


>
>
>
>
>
>
>







 







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













|












<











>
>
>
>
>

<

>

>







>
>
>







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
...
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
215
216

217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
 *
 */

#include <cstring>
#include <algorithm>
#include <cxxomfort/impl/n3334-array_ref.hpp>
#include <cxxomfort/util/type_traits.hpp>
#include <cxxomfort/impl/relationals.hpp>
#include <ostream>

namespace cxxomfort { namespace cxxostd {

/**
 * @brief Read-only view of a string or string-like object
 * 
 * A basic_string_view is a non-owning reference / view to a buffer 
 * 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 typename membertype::pointer            pointer;
    typedef typename membertype::const_pointer   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(v) );
    
    //! String view to a buffer of characters at position @e px and length @e sz .
    CXXO_CONSTEXPR basic_string_view (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 (pointer px) CXXO_NOEXCEPTNOTHROW 
    : membertype(px, CTraits::length(px) )
    {}

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

    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); }
    
    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;
    int        compare (pointer r) const CXXO_NOEXCEPTNOTHROW;
    
    
    //! Find a substring.
    CXXO_CONSTEXPR14
    size_type  find (basic_string_view, size_type pos=0) const CXXO_NOEXCEPTNOTHROW;
    //! Find a character.
    CXXO_CONSTEXPR14
    size_type  find (CharT, size_type pos= 0) const CXXO_NOEXCEPTNOTHROW;

    //! Find a substring.
    size_type  find (const_pointer s, size_type pos= 0) const CXXO_NOEXCEPTNOTHROW {
        return find(basic_string_view(s), pos);
    }
    //! Find a substring.
    size_type  find (const_pointer s, size_type pos, size_type count) const CXXO_NOEXCEPTNOTHROW {
        return find(basic_string_view(s,count), pos);
    }
    
    //! Find last instance of a string.
    size_type  rfind (basic_string_view, size_type pos=0) const CXXO_NOEXCEPTNOTHROW ;
    //! Find last instance of a character.
    size_type  rfind (CharT, size_type pos= 0) const CXXO_NOEXCEPTNOTHROW ;
    //! Find last instance of a string.
    size_type  rfind (const_pointer s, size_type pos= 0) const CXXO_NOEXCEPTNOTHROW {
        return rfind(basic_string_view(s), pos);
    }

    //! Find last instance of a string.
    size_type  rfind (const_pointer s, size_type pos, size_type count) const CXXO_NOEXCEPTNOTHROW {
        return rfind(basic_string_view(s,count), pos);
    }

    friend bool operator== (basic_string_view const& c1, basic_string_view const& c2) CXXO_NOEXCEPTNOTHROW {
        return c1.compare(c2)==0;
    }

    friend bool operator< (basic_string_view const& c1, basic_string_view const& c2) CXXO_NOEXCEPTNOTHROW {
        return c1.compare(c2)<0;
    }
    
};

// Copies the substring [pos, pos + rcount) to the character string pointed to by dest, 
// where rcount is the smaller of count and size() - pos
template <typename Ch, typename ChT>
typename basic_string_view<Ch,ChT>::size_type basic_string_view<Ch,ChT>::copy 
................................................................................
    using namespace std;
    // rcount is the smaller of count and size() - pos. 
    size_type rcount = min(count, size()-pos);
    return basic_string_view(data()+pos,rcount);
}

template <typename Ch, typename ChT>
int basic_string_view<Ch,ChT>::compare 
(basic_string_view r) const CXXO_NOEXCEPTNOTHROW {
    size_type rlen = size() < r.size() ? size() : r.size();
    int compareres= ChT::compare(this->data(), r.data(), rlen);
    if (compareres==0) {
        return size() == r.size() ? 0 : (size() < r.size() ? -1 : +1);
    }
    else return compareres;
}


template <typename Ch, typename ChT>
CXXO_CONSTEXPR14 
typename basic_string_view<Ch,ChT>::size_type basic_string_view<Ch,ChT>::find 
(basic_string_view<Ch,ChT> s, size_type pos) const CXXO_NOEXCEPTNOTHROW {
    if (pos >= this->length()) return npos;
    using namespace std;
    const_iterator st = this->begin()+pos;
    const_iterator loc = search(
        st, this->end(), s.begin(), s.end());
    if (loc==this->end()) return npos;
    else return static_cast<size_type>(loc - this->begin());
}


template <typename Ch, typename ChT>
CXXO_CONSTEXPR14    
typename basic_string_view<Ch,ChT>::size_type basic_string_view<Ch,ChT>::find 
(Ch c, size_type pos) const CXXO_NOEXCEPTNOTHROW {
    using namespace std;
    if (pos >= this->length()) return npos;
    const_iterator pf = std::find(this->begin()+pos, this->end(), c);
    if (pf == this->end()) return npos;
    else return pf - this->begin();
}

// searches the last occurrence

template <typename Ch, typename ChT>

typename basic_string_view<Ch,ChT>::size_type basic_string_view<Ch,ChT>::rfind 
(basic_string_view<Ch,ChT> s, size_type pos) const CXXO_NOEXCEPTNOTHROW {
    if (pos >= this->length()) return npos;
    using namespace std;
    const_iterator st = this->begin()+pos;
    const_iterator loc = find_end(
        st, this->end(), s.begin(), s.end());
    if (loc==this->end()) return npos;
    else return static_cast<size_type>(loc - this->begin());
}

#define TPARAMS typename Ch, typename ChT
#define TARGS Ch,ChT
CXXO_GENERATE_RELATIONALS_T(basic_string_view);
#undef TARGS
#undef TPARAMS



//! Name for a strng view of @c char .
typedef basic_string_view<char> string_view;
//! Name for a string view of @c wchar_t .
typedef basic_string_view<wchar_t> wstring_view;
#if (CXXOMFORT_CXX_STD >= 2011)
typedef basic_string_view<char16_t> u16string_view;
typedef basic_string_view<char32_t> u32string_view;
#endif


/**
 * Outputs the given string to a C++ output stream.
 * */
template <class Ch, class ChTraits>
std::basic_ostream<Ch, ChTraits>&
operator<<  (std::basic_ostream<Ch, ChTraits>& os, basic_string_view<Ch, ChTraits> v) {
    using namespace std;
    //size_t const n= max(static_cast<size_t>(os.width()), v.size());
    //os.rdbuf()->sputn(v.data(), n);
    for (size_t i= 0; i < v.size(); ++i) { os<< v[i]; }

Changes to cxxomfort/cxxomfort/impl/20-endian.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
..
48
49
50
51
52
53
54


55
56
57
58
59

60
#define CXXOMFORT_IMPL_20_ENDIAN_HPP
/**
 * @file 
 * @brief Implementation of std::endian
 * */
#include <cxxomfort/config.hpp>
#include <cxxomfort/impl/typesafe_enum-core.hpp>






#define CXXOMFORT_IMPLEMENTS_p0463r1 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_endian CXXOMFORT_IMPLEMENTS_p0463r1


namespace cxxomfort {
namespace cxxostd {






















#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC || defined(_WIN32))
#define CXXO_endian_members() little = 0,  big = 1,  native = little
#else





#define CXXO_endian_members()    little = __ORDER_LITTLE_ENDIAN__, big    = __ORDER_BIG_ENDIAN__,  native = __BYTE_ORDER__



#endif



/**
 * @brief Endianness enumeration for C++.
 * @ingroup cxx17-backports
 * @see https://en.cppreference.com/w/cpp/types/endian
 * @anchor std_endian

 * 
 * @c endian is a typed enumeration that describes the potential values 
 * for a system's endianness. The enumeration has three values: @c little , 
 * @c big and @c native . @c native will equal one of the other two 
 * when the system has that endianness, or will equal none of them 
 * in a system with a different (non-little, non-big) endianness.
 * 
................................................................................
}} // cxxomfort::std

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

    #if (CXXO_COMPILER_SUPPORT_cstd_endian>0)
    #else


    namespace std { using cxxomfort::cxxostd::endian;
    }
    #endif
#endif // no std using


#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
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
..
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#define CXXOMFORT_IMPL_20_ENDIAN_HPP
/**
 * @file 
 * @brief Implementation of std::endian
 * */
#include <cxxomfort/config.hpp>
#include <cxxomfort/impl/typesafe_enum-core.hpp>
#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC)
#include <endian.h>
#endif



#define CXXOMFORT_IMPLEMENTS_p0463r1 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_endian CXXOMFORT_IMPLEMENTS_p0463r1


namespace cxxomfort {
namespace cxxostd {

namespace detail {

union endian_tester {
    uint32_t   n;
    uint8_t    p[4];
};

const endian_tester sample = {0x01020304}; // this initializes .n

struct endian_finally {
    enum { 
        little = 0x00000001, 
        big    = 0x01000000,
        other  = 0x00000000 
    };
};


} // detail


#if 0 && (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC || defined(_WIN32))
    #define CXXO_endian_members() little = 0,  big = 1,  native = little


#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, < 406))
    #define CXXO_endian_members() little = __LITTLE_ENDIAN, big = __BIG_ENDIAN, native = __BYTE_ORDER

#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, >= 406))
    #define CXXO_endian_members()    little = __ORDER_LITTLE_ENDIAN__, big    = __ORDER_BIG_ENDIAN__,  native = __BYTE_ORDER__

#else
    #define CXXO_endian_members()  little = detail::endian_finally::little, big = detail::endian_finally::big , native = 0xffffffffUL & 0x1UL
#endif



/**
 * @brief Endianness enumeration for C++.
 * @ingroup cxx17-backports
 * @see https://en.cppreference.com/w/cpp/types/endian
 * @anchor std_endian
 * @xrefitem std0type_traits "" ""
 * 
 * @c endian is a typed enumeration that describes the potential values 
 * for a system's endianness. The enumeration has three values: @c little , 
 * @c big and @c native . @c native will equal one of the other two 
 * when the system has that endianness, or will equal none of them 
 * in a system with a different (non-little, non-big) endianness.
 * 
................................................................................
}} // cxxomfort::std

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

    #if (CXXO_COMPILER_SUPPORT_cstd_endian>0)
    #else
    namespace std { 
        //! Using in namespace std;
        using cxxomfort::cxxostd::endian;
    }
    #endif
#endif // no std using


#endif

Changes to cxxomfort/cxxomfort/impl/character.hpp.

1
2



3



4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
#ifndef CXXOMFORT_IMPL_CHARACTER_HPP
#define CXXOMFORT_IMPL_CHARACTER_HPP







#include <cstddef>
#include <cxxomfort/util/type_traits.hpp>
//#include <cxxomfort/type_traits.hpp>

namespace cxxomfort{ namespace impl{ namespace type_traits {

namespace ct = cxxomfort::traits;


template <typename T> struct is_character_type: ct::false_type {};
template <> struct is_character_type<char> : ct::true_type {};
template <> struct is_character_type<signed char> : ct::true_type {};
template <> struct is_character_type<unsigned char> : ct::true_type {};
template <> struct is_character_type<wchar_t> : ct::true_type {};

#if (CXXOMFORT_CXX_STD >= 2011)


>
>
>
|
>
>
>








>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef CXXOMFORT_IMPL_CHARACTER_HPP
#define CXXOMFORT_IMPL_CHARACTER_HPP
/**
 * @file
 * @brief Meta information for character types.
 * 
 * Utility file similar to @c functionmeta.hpp .
 * 
 * */
#include <cstddef>
#include <cxxomfort/util/type_traits.hpp>
//#include <cxxomfort/type_traits.hpp>

namespace cxxomfort{ namespace impl{ namespace type_traits {

namespace ct = cxxomfort::traits;

//! Check if a type T is one of C++'s native character types.
template <typename T> struct is_character_type: ct::false_type {};
template <> struct is_character_type<char> : ct::true_type {};
template <> struct is_character_type<signed char> : ct::true_type {};
template <> struct is_character_type<unsigned char> : ct::true_type {};
template <> struct is_character_type<wchar_t> : ct::true_type {};

#if (CXXOMFORT_CXX_STD >= 2011)

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

#include <cxxomfort/base.hpp>
#include <cxxomfort/cstddef.hpp>
#include <cxxomfort/impl/11-conditional.hpp>
#include <cxxomfort/type_traits.hpp>

namespace cxxomfort { namespace impl {

template <typename T, typename=void>
struct enum_traits {
};

template <typename T, typename std::enable_if<std::is_enum<T> >::type>
struct enum_traits<T> {
    enum { is_enum = true };
    enum { is_scoped = false };
    enum { is_native = true };
    typedef T enum_type;
    typedef typename std::underlying_type<T>::type underlying_type;
};


} }

#endif

Changes to cxxomfort/cxxomfort/impl/foreach_gcc.hpp.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// http://www.boost.org/LICENSE_1_0.txt)

//#include <functional>
#include <cxxomfort/config.hpp>
#include <cxxomfort/base/iterator.hpp> // global begin, end
#include <cxxomfort/util/type_traits.hpp>
#include <cxxomfort/util/meta.hpp>
#include <cxxomfort/using.hpp>
//#include <cxxomfort/memory.hpp> // alignof, aligned_storage

namespace cxxomfort {
namespace impl {

template <typename T> struct impl_is_array { enum { value = false }; };








|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// http://www.boost.org/LICENSE_1_0.txt)

//#include <functional>
#include <cxxomfort/config.hpp>
#include <cxxomfort/base/iterator.hpp> // global begin, end
#include <cxxomfort/util/type_traits.hpp>
#include <cxxomfort/util/meta.hpp>
//#include <cxxomfort/using.hpp>
//#include <cxxomfort/memory.hpp> // alignof, aligned_storage

namespace cxxomfort {
namespace impl {

template <typename T> struct impl_is_array { enum { value = false }; };

Changes to cxxomfort/cxxomfort/impl/forward_list-impl.hpp.

1
2
3
4

5
6
7
8
9
10
11
12
13
14
15
...
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
#ifndef CXXOMFORT_IMPL_FORWARD_LIST_IMPL_HPP
#define CXXOMFORT_IMPL_FORWARD_LIST_IMPL_HPP

#include "../config.hpp"

#include <stdexcept>
#include <iterator>
#include <utility>
#include <functional>
#include <memory>
#include <algorithm>
#include <stdexcept>
#include <cassert>
#include <new>
// for debug only
//#include <iostream>
................................................................................
    }
}

template <typename T, typename A>
void forward_list<T,A>::remove (T const& t) {
    using namespace std;
    const std::equal_to<T> eq;
    remove ( bind(eq, std::placeholders::_1, t) );
}

/*
template <typename T, typename A>
template<typename Comparison>
void forward_list<T,A>::unique (Comparison p) {
    // No need to unique a list with at most one element




>



<







 







|







1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
...
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
#ifndef CXXOMFORT_IMPL_FORWARD_LIST_IMPL_HPP
#define CXXOMFORT_IMPL_FORWARD_LIST_IMPL_HPP

#include "../config.hpp"
#include <cxxomfort/functional.hpp> // functors, bind, placeholders
#include <stdexcept>
#include <iterator>
#include <utility>

#include <memory>
#include <algorithm>
#include <stdexcept>
#include <cassert>
#include <new>
// for debug only
//#include <iostream>
................................................................................
    }
}

template <typename T, typename A>
void forward_list<T,A>::remove (T const& t) {
    using namespace std;
    const std::equal_to<T> eq;
    remove_if ( bind(eq, placeholders::_1, t) );
}

/*
template <typename T, typename A>
template<typename Comparison>
void forward_list<T,A>::unique (Comparison p) {
    // No need to unique a list with at most one element

Changes to cxxomfort/cxxomfort/impl/functionmeta.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
..
64
65
66
67
68
69
70
71
72














































73
74
75
#ifndef CXXOMFORT_IMPL_FUNCTIONMETA_HPP
#define CXXOMFORT_IMPL_FUNCTIONMETA_HPP












namespace cxxomfort { namespace impl {

template <typename T> struct functiontype {};

template <typename Ret>
struct functiontype<Ret()> {
    typedef Ret (*pointer)();
};

#if (CXXOMFORT_CXX_STD >= 2011)
template <typename Ret, typename... Args>
struct functiontype<Ret(Args...)> {

    typedef Ret (*pointer)(Args...);


    typedef Ret (type)(Args...);

    typedef std::tuple<Args...> arguments;


    typedef Ret return_type;


};

#else












template <typename Ret, typename A1>
struct functiontype<Ret(A1)> {
    typedef Ret (*pointer)(A1);
    typedef Ret (type)(A1);
    typedef std::tuple<A1> arguments;
    typedef Ret return_type;

};
template <typename Ret, typename A1, typename A2>
struct functiontype<Ret(A1,A2)> {
    typedef Ret (*pointer)(A1,A2);
    typedef Ret (type)(A1,A2);
    typedef std::tuple<A1,A2> arguments;
    typedef Ret return_type;

};
template <typename Ret, typename A1, typename A2, typename A3>
struct functiontype<Ret(A1,A2,A3)> {
    typedef Ret (*pointer)(A1,A2,A3);
    typedef Ret (type)(A1,A2,A3);
    typedef std::tuple<A1,A2,A3> arguments;
    typedef Ret return_type;

};
template <typename Ret, typename A1, typename A2, typename A3, typename A4>
struct functiontype<Ret(A1,A2,A3,A4)> {
    typedef Ret (*pointer)(A1,A2,A3,A4);
    typedef Ret (type)(A1,A2,A3,A4);

    typedef Ret return_type;

};
template <typename Ret, typename A1, typename A2, typename A3, typename A4, typename A5>
struct functiontype<Ret(A1,A2,A3,A4,A5)> {
    typedef Ret (*pointer)(A1,A2,A3,A4,A5);
    typedef Ret (type)(A1,A2,A3,A4,A5);

    typedef Ret return_type;

};
#endif

template <size_t, typename Function>
struct fn_arg_t {};

template <typename R, typename A1>
................................................................................
    typedef A1 type;
};

template <typename R, typename A1, typename A2>
struct fn_arg_t<0, R(A1,A2)> {
    typedef A1 type;
};
















































} }

#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
..
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
#ifndef CXXOMFORT_IMPL_FUNCTIONMETA_HPP
#define CXXOMFORT_IMPL_FUNCTIONMETA_HPP

/**
 * @file
 * @brief Meta information for function types.
 * 
 * Interfaces defined in this file:
 * 
 * * @c functiontype - traits for properties about function signatures (return type, arity, etc).
 * * @c function_caller - wraps a normal C function into a zero-cost functor.
 * 
 * */

namespace cxxomfort { namespace impl {

template <typename T> struct functiontype {};

#if (CXXOMFORT_CXX_STD >= 2011)





template <typename Ret, typename... Args>
struct functiontype<Ret(Args...)> {
    //! Type of the pointer to a function
    typedef Ret (*pointer)(Args...);
    typedef Ret (* const const_pointer)(Args...);
    //! Type of the function
    typedef Ret (type)(Args...);
    //! Type of a tuple containing all arguments
    typedef std::tuple<Args...> arguments;
    //typedef Args... argument_pack;
    // Return type
    typedef Ret return_type;
    // Arity (number of arguments)
    enum { arity = sizeof...(Args) };
};

#else

template <typename Ret>
struct functiontype<Ret()> {
    typedef Ret(*pointer)();
    typedef Ret(* const const_pointer)();
    typedef Ret(type)();
    typedef Ret(&reference)();
    typedef std::tuple<> arguments;
    typedef Ret return_type;
    enum { arity = 0 };
};

template <typename Ret, typename A1>
struct functiontype<Ret(A1)> {
    typedef Ret (*pointer)(A1);
    typedef Ret (type)(A1);
    typedef std::tuple<A1> arguments;
    typedef Ret return_type;
    enum { arity = 1 };
};
template <typename Ret, typename A1, typename A2>
struct functiontype<Ret(A1,A2)> {
    typedef Ret (*pointer)(A1,A2);
    typedef Ret (type)(A1,A2);
    typedef std::tuple<A1,A2> arguments;
    typedef Ret return_type;
    enum { arity = 2};
};
template <typename Ret, typename A1, typename A2, typename A3>
struct functiontype<Ret(A1,A2,A3)> {
    typedef Ret (*pointer)(A1,A2,A3);
    typedef Ret (type)(A1,A2,A3);
    typedef std::tuple<A1,A2,A3> arguments;
    typedef Ret return_type;
    enum { arity = 3};
};
template <typename Ret, typename A1, typename A2, typename A3, typename A4>
struct functiontype<Ret(A1,A2,A3,A4)> {
    typedef Ret (*pointer)(A1,A2,A3,A4);
    typedef Ret (type)(A1,A2,A3,A4);
    typedef std::tuple<A1,A2,A3,A4> arguments;
    typedef Ret return_type;
    enum { arity = 4 };
};
template <typename Ret, typename A1, typename A2, typename A3, typename A4, typename A5>
struct functiontype<Ret(A1,A2,A3,A4,A5)> {
    typedef Ret (*pointer)(A1,A2,A3,A4,A5);
    typedef Ret (type)(A1,A2,A3,A4,A5);
    typedef std::tuple<A1,A2,A3,A4,A5> arguments;
    typedef Ret return_type;
    enum { arity = 5};
};
#endif

template <size_t, typename Function>
struct fn_arg_t {};

template <typename R, typename A1>
................................................................................
    typedef A1 type;
};

template <typename R, typename A1, typename A2>
struct fn_arg_t<0, R(A1,A2)> {
    typedef A1 type;
};


// 
// function_caller
//
template <typename Fn, Fn const * f>
struct function_caller {
    typedef cxxomfort::impl::functiontype<Fn> FT;
    typedef typename FT::return_type return_type;

#if (CXXOMFORT_CXX_STD>=2011)    

    template <typename... Args>
    typename FT::return_type operator() (Args&&... args) const {
        return f(std::forward<Args...>(args...));
    }

#else
    
    template <typename A>
    typename FT::return_type operator() 
    (A a) const {
        return f(a);
    }

    template <typename A1, typename A2>
    typename FT::return_type operator() 
    (A1 a1, A2 a2) const {
        return f(a1,a2);
    }


#endif

};

template <typename T, T(* const fn)() >
struct function_caller<T(), fn> {
    typedef cxxomfort::impl::functiontype<T()> FT;
    typedef typename FT::return_type return_type;
    T operator() () const {
        return fn();
    }
};




} }

#endif

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef CXXOMFORT_IMPL_HASH_HPP
#define CXXOMFORT_IMPL_HASH_HPP

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

namespace cxxomfort {  namespace cxxostd {

/*
 *  A version of std::hash that allows for better specialization. 
 * When not specialized, it just delegates to std::hash.
 */
template <typename T, typename = void >
struct hash
: public ::std::hash<T> {
    enum { uses_std = true };
};

// specialize for enum
template <typename E>
struct hash<E , typename std::enable_if< std::is_enum<E>::value>::type >
: public hash< typename ::std::underlying_type<E>::type> {



|











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef CXXOMFORT_IMPL_HASH_HPP
#define CXXOMFORT_IMPL_HASH_HPP

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

namespace cxxomfort {  namespace cxxostd {

/*
 *  A version of std::hash that allows for better specialization. 
 * When not specialized, it just delegates to std::hash.
 */
template <typename T, typename = void >
struct hash
: public CXXO_namespace_tr1::hash<T> {
    enum { uses_std = true };
};

// specialize for enum
template <typename E>
struct hash<E , typename std::enable_if< std::is_enum<E>::value>::type >
: public hash< typename ::std::underlying_type<E>::type> {

Changes to cxxomfort/cxxomfort/impl/ic_types.hpp.

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
struct zuC : std::integral_constant<size_t,X> {};

/*
 * integral constant<unsigned short> ( integral_constant<int,8>() ) --> integral_constant<unsigned short,8>()
 * */
template <typename To, typename I, I X>
std::integral_constant<To,static_cast<To>(X)> 
integral_constant_cast (std::integral_constant<I,X> const& c) {
    return std::integral_constant<To,static_cast<To>(X)>();
}

} // ic_types
} } }



#endif  // guard







|









61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
struct zuC : std::integral_constant<size_t,X> {};

/*
 * integral constant<unsigned short> ( integral_constant<int,8>() ) --> integral_constant<unsigned short,8>()
 * */
template <typename To, typename I, I X>
std::integral_constant<To,static_cast<To>(X)> 
integral_constant_cast (std::integral_constant<I,X> const&) {
    return std::integral_constant<To,static_cast<To>(X)>();
}

} // ic_types
} } }



#endif  // guard

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

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
30
31
32
33
34
35
36

37
38
39
40
41
42
43
..
62
63
64
65
66
67
68
69


70
71
72
73
74
75
76
 * @file 
 *  
**/

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

#define CXXOMFORT_IMPLEMENTS_n3334 CXXO_IMPLSTATUS_LIBRARY()
#define CXXOMFORT_IMPLEMENTS_array_ref CXXOMFORT_IMPLEMENTS_n3334

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

/**
 * @brief An object representing a reference or @e slice of a 
 * contiguous area of memory of type @e T .
 * @anchor libarrayref
 * @tparam T Type of the kind of value contained in the view.
 * @ingroup cxxo-sup 

 * 
 * A @c array_ref is a non-owning view of a sequence of 
 * *contiguous* elements via a simple {pointer+length} package. 
 * In many ways it could be considered an analogue to 
 * <code>std::array</code> except it doesn't actually hold the data 
 * (hence the name, @c array_ref ).
 * 
................................................................................
 * * Adds member functions @c front , @c back .
 * * Adds member functions @c leftmost , @c rightmost .
 * * Ally functions @c arrayref() and @c carrayref() provided as support.
 * 
 * 
 * 
 * @c array_ref is based in the original publication "n3334" by 
 * Jeffrey Yasskin; @see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3334.html 


 * 
 */
template <typename T>
class array_ref {
    public:
    //! type of the data contained in the view.
    typedef T       value_type;







|
|







 







>







 







|
>
>







4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
..
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
 * @file 
 *  
**/

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

#define CXXOMFORT_IMPLEMENTS_n3334 CXXO_IMPLSTATUS_LIBRARY()
#define CXXOMFORT_IMPLEMENTS_array_ref CXXOMFORT_IMPLEMENTS_n3334

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

/**
 * @brief An object representing a reference or @e slice of a 
 * contiguous area of memory of type @e T .
 * @anchor libarrayref
 * @tparam T Type of the kind of value contained in the view.
 * @ingroup cxxo-sup 
 * @xrefitem cxxo-sup "Supplements" "Container Supplements"
 * 
 * A @c array_ref is a non-owning view of a sequence of 
 * *contiguous* elements via a simple {pointer+length} package. 
 * In many ways it could be considered an analogue to 
 * <code>std::array</code> except it doesn't actually hold the data 
 * (hence the name, @c array_ref ).
 * 
................................................................................
 * * Adds member functions @c front , @c back .
 * * Adds member functions @c leftmost , @c rightmost .
 * * Ally functions @c arrayref() and @c carrayref() provided as support.
 * 
 * 
 * 
 * @c array_ref is based in the original publication "n3334" by 
 * Jeffrey Yasskin
 * 
 * @see @wg21{n3334} @cppref{container/span}
 * 
 */
template <typename T>
class array_ref {
    public:
    //! type of the data contained in the view.
    typedef T       value_type;

Changes to cxxomfort/cxxomfort/impl/n3668-exchange.hpp.

20
21
22
23
24
25
26
27
28


29
30
31
32
33
34
35
#if (CXXOMFORT_CXX_STD < 2014)

namespace cxxomfort {
namespace cxxostd {

/**
 * @brief Replaces a variable's value, returns the old value.
 * @sa N3668
 * @ingroup cxx14-backports


 */
template <typename T, typename U>
T exchange (T& obj, CXXO_RV_REF(U) nval) {
    T oval = std::move(obj);
    obj= std::forward<U>(nval);
    return oval;
}







<

>
>







20
21
22
23
24
25
26

27
28
29
30
31
32
33
34
35
36
#if (CXXOMFORT_CXX_STD < 2014)

namespace cxxomfort {
namespace cxxostd {

/**
 * @brief Replaces a variable's value, returns the old value.

 * @ingroup cxx14-backports
 * @xrefitem std0utility "" ""
 * @sa @wg21{n3668}
 */
template <typename T, typename U>
T exchange (T& obj, CXXO_RV_REF(U) nval) {
    T oval = std::move(obj);
    obj= std::forward<U>(nval);
    return oval;
}

Added cxxomfort/cxxomfort/impl/n4022-not_fn.hpp.

















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifndef CXXOMFORT_IMPL_n4022_HPP
#define CXXOMFORT_IMPL_n4022_HPP
/**
 * @file 
 *  
**/

#include <cxxomfort/base.hpp>
#include <cxxomfort/functional.hpp>
//#include "11-decay.hpp"


#define CXXOMFORT_IMPLEMENTS_n3699 CXXO_IMPLSTATUS_EMULATION()
#define CXXOMFORT_IMPLEMENTS_not_fn CXXOMFORT_IMPLEMENTS_n3699
#define CXXOMFORT_IMPLEMENTS_n4022 CXXOMFORT_IMPLEMENTS_n3699


#if (defined(CXXOMFORT_NOTICES) && CXXOMFORT_NOTICES>1)
    #pragma message CXXO_NOTICE("enabled functional: not_fn<F> implementation")
#endif

namespace cxxomfort { namespace cxxostd { 
namespace n4022 {

template <typename Functor>
struct not_fn_t {
    typedef typename std::decay<Functor>::type DeFunctor; // fun name
    DeFunctor _d;


#if (CXXOMFORT_CXX_STD>=2011)    
explicit not_fn_t (Functor&& f)
    : _d(std::forward<Functor>(f))
    {} 
#else
    explicit not_fn_t (Functor const& f)
    : _d(f)
    {}

#endif

#if (CXXOMFORT_CXX_STD >= 2011)
    template <typename... Args>
    auto operator()  (Args&&... args) 
    -> decltype (!invoke(_d, std::forward<Args>(args)...)) {
        return !invoke(_d, std::forward<Args>(args)...);
    }
    template <typename... Args>
    auto operator()  (Args&&... args) const 
    -> decltype (!invoke(_d, std::forward<Args>(args)...)) {
        return !invoke(_d, std::forward<Args>(args)...);
    }
#else
    bool operator() () const {
        return !_d();
    }
    template <typename T1>
    bool operator() (T1 t1) const {
        return !_d(t1);
    }
    template <typename T1, typename T2>
    bool operator() (T1 t1, T2 t2) const {
        return !_d(t1,t2);
    }
    template <typename T1, typename T2, typename T3>
    bool operator() (T1 t1, T2 t2, T3 t3) const {
        return !_d(t1,t2,t3);
    }
    template <typename T1, typename T2, typename T3, typename T4>
    bool operator() (T1 t1, T2 t2, T3 t3, T4 t4) const {
        return !_d(t1,t2,t3,t4);
    }
    template <typename T1, typename T2, typename T3, typename T4, typename T5>
    bool operator() (T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) const {
        return !_d(t1,t2,t3,t4,t5);
    }
#endif

};

#if (CXXOMFORT_CXX_STD >= 2011)
template <typename Fn>
not_fn_t<Fn> not_fn (Fn&& f) {
    return not_fn_t<Fn>( std::forward<Fn>(f) );
}
#else
template <typename Fn>
not_fn_t<Fn> not_fn (Fn const& f) {
    return not_fn_t<Fn>(f);
}
#endif

} // n4022::
} } // cxxomfort::cxxostd::

#if (CXXOMFORT_CXX_STD<2017)
namespace std {
    using cxxomfort::cxxostd::n4022::not_fn;
}

#endif


#endif

Changes to cxxomfort/cxxomfort/impl/n4031_make_array.hpp.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#define CXXOMFORT_IMPL_n4031_HPP

#include "../config.hpp"
#include "../base.hpp" // move emulation
#include <utility>
#include <array>
#include <iostream>
#include "../using.hpp"

//
// make_array
// contructs an object of std::array<T,N> type with automatically calculated N.
// See proposal:  http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2014/n4031.html
//
// http://stackoverflow.com/questions/6114067/how-to-emulate-c-array-initialization-int-arr-e1-e2-e3-behaviou







<







2
3
4
5
6
7
8

9
10
11
12
13
14
15
#define CXXOMFORT_IMPL_n4031_HPP

#include "../config.hpp"
#include "../base.hpp" // move emulation
#include <utility>
#include <array>
#include <iostream>


//
// make_array
// contructs an object of std::array<T,N> type with automatically calculated N.
// See proposal:  http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2014/n4031.html
//
// http://stackoverflow.com/questions/6114067/how-to-emulate-c-array-initialization-int-arr-e1-e2-e3-behaviou

Added cxxomfort/cxxomfort/impl/p0792r0-function_ref.hpp.

































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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
#ifndef CXXOMFORT_IMPL_p0792_FUNCTIONVIEW_HPP
#define CXXOMFORT_IMPL_p0792_FUNCTIONVIEW_HPP

/**
 * @file
 * @brief Implements part of p0792r0, a proposal for a non-owning reference view on functors.
 * 
 * */

#include <functional> // std::reference_wrapper, etc
#include <utility> // forward, move, etc
#include <cxxomfort/util/type_traits.hpp>
#include <cxxomfort/impl/11-conditional.hpp>
#include <cxxomfort/library/type_name.hpp>

namespace cxxomfort { namespace impl {

template <typename Signature> class function_ref;


/**
 * @class function_ref
 * @brief A non-owning view of an object callable with a function signature.
 * @ingroup cxxo-sup-functional
 * 
 * A @c function_ref is a non-owning view to a callable object or function pointer 
 * for a given signature.
 * 
 * @code

// note here we don't require a template for the functor
template <typename List>
vector<int> metafunction (function_ref<int(float)> F, List& L) {
    vector<int> sideeffects;
    for (typename L::reference ll : L) {
        sideeffects.push_back ( F(ll) );
    }
    return sideeffects;
}

int foo (float x) { ... };
int bar (float r) { ... };


list<float> data = ...;
vector<int> allfoos = metafunction(foo, data);
vector<int> allbars = metafunction(bar, data);


 * @endcode
 * 
 * @notr @c function_ref is a @c _ref - hence it does not work with 
 * temporaries such as bind expressions. The following doesn't work:

@code

metafunction ( bind(mem_fn(&string::size), foo ) );

@endcode

 * @note In C++03 mode, @e function_ref can only construct 
 * from function pointers explicitly.
 * 
 * @see
 * * @wg21{0792r0,function_ref proposal}
 * * @cppref{functional/function}
 * 
 * */

#if (CXXOMFORT_CXX_STD >= 2011 || \
(CXXO_COMPILER_SUPPORT_variadic && CXXO_COMPILER_SUPPORT_rvref && CXXO_COMPILER_SUPPORT_trailing_returns) \
)

// 3/4tht taken from https://stackoverflow.com/questions/32918679/in-c-11-how-to-invoke-an-arbitrary-callable-object 
// 1/4th drawn from http://llvm.org/doxygen/STLExtras_8h_source.html
// We are taking extra from the LLVM because of Eric Niebler's "keep it simple" comment 
// https://twitter.com/ericniebler/status/880899867035394048

template<typename F, typename... Args>
auto invoke_(F f, Args&&... args)
    -> decltype(std::ref(f)(std::forward<Args>(args)...)) {
    return std::ref(f)(std::forward<Args>(args)...);
}



template<typename Ret, typename ...Args>
class function_ref<Ret(Args...)>  {
    enum { IsConst = true };
    typedef typename functiontype<Ret(void const*, Args...)>::type call_t;
    typedef typename std::conditional< IsConst, void const*, void*>::type voidptr;
    //typedef typename functiontype<Ret(void*,Args...)>::pointer call_t;
    call_t* callback = nullptr;
    voidptr callable = nullptr;
    std::type_info const* tinfo = nullptr;
 
    template<typename Callable>
    static Ret callback_fn (voidptr callable, Args ...as) {
     return (*reinterpret_cast<Callable const *>(callable))(
         std::forward<Args>(as)...);
    }
 
    public:
    function_ref() = delete;
    // function_ref(std::nullptr_t) {}

    template <typename Callable>
    CXXO_CONSTEXPR14 
    function_ref(Callable&& callable,
        typename std::enable_if<
            !std::is_same<typename std::remove_reference<Callable>::type,
            function_ref>::value
        >::type * = nullptr) noexcept
    :  callback(callback_fn<typename std::remove_reference<Callable>::type>)
    ,  callable(reinterpret_cast<voidptr>(&callable)) 
    ,  tinfo(&typeid(callable))
    {}

    
    Ret operator() (Args ...as) const {
        return callback(callable, std::forward<Args>(as)...);
    }
 
    CXXO_CONSTEXPR14 
    operator bool() const noexcept { return callback; }
    
    std::type_info const& info () const noexcept {
        return *tinfo;
    }

};


template<typename Ret, typename ...Args>
class function_ref<Ret(Args...) const>  {
    enum { IsConst = true };
    typedef typename functiontype<Ret(void const *, Args...)>::pointer call_t;
    call_t callback = nullptr;
    void const * callable = nullptr;
    std::type_info const* tinfo = nullptr;
 
    template<typename Callable>
    static Ret callback_fn (void const * callable, Args ...as) {
     return (*reinterpret_cast<Callable const *>(callable))(
         std::forward<Args>(as)...);
    }
 
    public:
    function_ref() = delete;
    // function_ref(std::nullptr_t) {}

    template <typename Callable>
    function_ref(Callable &&callable,
        typename std::enable_if<
            !std::is_same<typename std::remove_reference<Callable>::type,
            function_ref>::value
        >::type * = nullptr) noexcept
    :  callback(callback_fn<typename std::remove_reference<Callable>::type>)
    ,  callable(reinterpret_cast<void const *>(&callable)) 
    ,  tinfo(&typeid(callable))
    {}

    
    Ret operator() (Args ...as) const {
        return callback(callable, std::forward<Args>(as)...);
    }
 
    operator bool() const noexcept { return callback; }
    
    std::type_info const& info () const noexcept {
        return *tinfo;
    }

};


#else // c++03

// implementation for C++03
// we don't have to worry about eg.: noexcept or forwards.

template <typename Sig> struct fn_aligned_union ;

template <typename Ret> struct fn_aligned_union<Ret()> {
    union type {
        void* m1;
        typename functiontype<Ret()>::pointer m2;
        long double m [2];
    };
};

template <typename Sig, bool IsConst> struct fnimpl;

template <typename Ret, bool IsConst>
struct fnimpl <Ret(), IsConst>  {
    typedef typename std::conditional< IsConst, void const, void>::type voidtype;
    typedef typename functiontype<Ret(voidtype* const)>::pointer call_t;
    call_t fn_;
    voidtype* ptr_;
    std::type_info const* tinfo;
    
    template<typename Callable>
    static Ret callback_fn(voidtype* const callable
    , typename std::enable_if< IsConst, bool >::type * = nullptr) {
        return (*reinterpret_cast<Callable const* const>(callable))( );
    }

    template<typename Callable>
    static Ret callback_fn(voidtype* const callable
    , typename std::enable_if< !IsConst, bool >::type * = nullptr) {
        return (*reinterpret_cast<Callable* const>(callable))( );
    }

};

template <typename Ret>
class function_ref <Ret()>  {
    enum { IsConst = false };
    typedef typename functiontype<Ret()>::type function_type;
    typedef typename functiontype<Ret(void*)>::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* const callable) {
        //typedef typename std::conditional<IsConst, Callable const, Callable>::type Callabletype;
        return (*reinterpret_cast<Callable* const>(callable))( );
    }

    private:
    function_ref ();

    public:

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

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

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

    template <typename U>
    function_ref& operator= (U(* callable)())     {
        typename functiontype<U()>::type& f= *callable;
        return *this= function_ref(f);
    }

#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)> {
    union type {
        void* m1;
        typename functiontype<Ret(A1)>::pointer m2;
        long double m [2];
    };
};


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:

    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) 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;
        long double m [2];
    };
};

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

    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) const {
        return fn_( ptr_ , std::forward<A1>(a1), std::forward<A2>(a2) );
    }
    
};



#endif

}}


#endif

Changes to cxxomfort/cxxomfort/impl/p1227r0-ssize.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
#ifndef CXXOMFORT_IMPL_p1227_HPP
#define CXXOMFORT_IMPL_p1227_HPP

/**
 * @file
 * @brief Implements proposal for a general (non-member) unsigned size function
 * */

#include <cxxomfort/cstddef.hpp>
#include <cxxomfort/iterator.hpp>

#define CXXO_IMPLEMENTS_p1227r0 CXXO_IMPLSTATUS_EMULATION()
#define CXXO_IMPLEMENTS_ssize CXXO_IMPLEMENTS_p1227r0

// see: https://wg21.link/p1048r0

namespace cxxomfort { namespace impl {















template <typename Container>
inline typename Container::difference_type 
ssize (Container const& c) {
    return static_cast<typename Container::difference_type>(c.size());
}




template <typename T, size_t N>
inline ptrdiff_t
ssize (T const(&arr)[N]) {
    return N;
}




}
}

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

/**
 * @file
 * @brief Implements part of p1227r0, a proposal for a general (non-member) unsigned size function
 * */

#include <cxxomfort/cstddef.hpp>
#include <cxxomfort/iterator.hpp>

#define CXXO_IMPLEMENTS_p1227r0 CXXO_IMPLSTATUS_EMULATION()
#define CXXO_IMPLEMENTS_ssize CXXO_IMPLEMENTS_p1227r0

// see: https://wg21.link/p1227r0

namespace cxxomfort { namespace impl {

/**
 * Returns the @e size of a sequence-like object, as 
 * calculated by a call to <code>.size()</code>, 
 * converted to a @c difference_type .
 * 
 * @ingroup cxxo-sup-iterator
 * @xrefitem cxxo-sup-iterator "" ""
 * 
 * @see 
 * * @wg21{p1227r0} by Jorg Brown
 * * not to be confused with @c absdistance() .
 * 
 * 
 * */
template <typename Container>
inline typename Container::difference_type 
ssize (Container const& c) {
    return static_cast<typename Container::difference_type>(c.size());
}

/**
 * @overload ssize
 **/
template <typename T, size_t N>
inline ptrdiff_t
ssize (T const(&)[N]) {
    return N;
}




}
}

#endif

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

// automatic generation of relational operators

#define CXXO_GENERATE_RELATIONALS(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); } \




#define CXXO_GENERATE_RELATIONALS0(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_RELATIONALS0_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







|





>
>
>
|





>
>
>
>
>

|











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
/**
 * @file
 * @brief Macros for generating relational operators.
 */

// automatic generation of relational operators

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

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

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


//#include "../extras/optional.hpp"

namespace cxxomfort { namespace impl {
namespace string {

namespace detail_string {

const struct no_t {
    template <typename Ch, typename Tr, typename Alloc>
................................................................................
    (t0,t1);
}

//
// to_string
//

/*
using namespace cxxomfort::extras::optional;

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 (
optional<T0 const&> const& t0
, optional<T1> const& t1, optional<T2> const& t2= nullopt, optional<T3> const& t3= nullopt, optional<T4> const& t4= nullopt, optional<T5> const& t5= nullopt, optional<T6> const& t6= nullopt, optional<T7> const& t7= nullopt, optional<T8> const& t8= nullopt, optional<T9> const& t9= nullopt) {
    typedef std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> > stream_t;
    stream_t stream;
    //detail_string::streamizer<stream_t> s(stream);
    if (t0) stream<< t0;
    if (t1) stream<< t1;
    if (t2) stream<< t2;
    if (t3) stream<< t3;
    if (t4) stream<< t4;
    if (t5) stream<< t5;
    if (t6) stream<< t6;
    if (t7) stream<< t7;
    if (t8) stream<< t8;
    if (t9) stream<< t9;
    
    return stream.str();

    //return to_basic_string_defaults<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, 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_defaults<char>(t0,t1,t2,t3,t4,t5,t6,t7,t8,t9);
}



<
<
<







 







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







1
2
3



4
5
6
7
8
9
10
...
242
243
244
245
246
247
248






























249
250
251
252
253
254
255
#ifndef CXXOMFORT_IMPL_TO_BASIC_STRING_03_HPP
#define CXXOMFORT_IMPL_TO_BASIC_STRING_03_HPP




namespace cxxomfort { namespace impl {
namespace string {

namespace detail_string {

const struct no_t {
    template <typename Ch, typename Tr, typename Alloc>
................................................................................
    (t0,t1);
}

//
// to_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_defaults<char>(t0,t1,t2,t3,t4,t5,t6,t7,t8,t9);
}

Changes to cxxomfort/cxxomfort/impl/to_basic_string_variadic.hpp.

3
4
5
6
7
8
9
10


11
12
13
14
15
16
17
..
25
26
27
28
29
30
31



32
33
34
35
36
37
38
/**
 * @file
 * @brief Implements the variadic "to_basic_string" proposal in http://open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0117r0.html .
 *
 * 
 * Interfaces defined in this file:
 * 
 * In namespace cxxomfort::string:


 * 
 */

#include <cxxomfort/base.hpp>
#include <string>
#include <cstring>
#include <sstream>
................................................................................
 * template arguments (Ch, char_traits<Ch> and allocator<Ch>) 
 * because c++03 does not support default template arguments.
 * * to palliate the above, the function to_basic_string_defaults<...> 
 * is provided that only requires argument Ch, and deduces 
 * char_traits<Ch> and allocator<Ch> from that.
 * * in c++11 onwards, both functions are equivalent
 * 



 */

#if (CXXOMFORT_CXX_STD >= 2011)

namespace cxxomfort { namespace impl {
namespace string {








|
>
>







 







>
>
>







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
 * @file
 * @brief Implements the variadic "to_basic_string" proposal in http://open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0117r0.html .
 *
 * 
 * Interfaces defined in this file:
 * 
 * In namespace cxxomfort::library::string:
 * 
 * * @c cxxomfort::impl::string::to_string()
 * 
 */

#include <cxxomfort/base.hpp>
#include <string>
#include <cstring>
#include <sstream>
................................................................................
 * template arguments (Ch, char_traits<Ch> and allocator<Ch>) 
 * because c++03 does not support default template arguments.
 * * to palliate the above, the function to_basic_string_defaults<...> 
 * is provided that only requires argument Ch, and deduces 
 * char_traits<Ch> and allocator<Ch> from that.
 * * in c++11 onwards, both functions are equivalent
 * 
 * Based on work by Robert Kawulak.
 * 
 * @sa @wg21{p0117r0} .
 */

#if (CXXOMFORT_CXX_STD >= 2011)

namespace cxxomfort { namespace impl {
namespace string {

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

4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
 @file
 @author Luis Machuca Bezzaza
 @see http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Type_Safe_Enum
 @see http://stackoverflow.com/questions/217549/which-typesafe-enum-in-c-are-you-using/11856721#11856721
**/
#include <cxxomfort/base.hpp>
#include <cxxomfort/util/type_traits.hpp>

#include <cxxomfort/impl/11-underlying_type.hpp>
#include <cxxomfort/using.hpp>

/*
 * Usage is as follows:
 */
#if 0 

// example







>

|







4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 @file
 @author Luis Machuca Bezzaza
 @see http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Type_Safe_Enum
 @see http://stackoverflow.com/questions/217549/which-typesafe-enum-in-c-are-you-using/11856721#11856721
**/
#include <cxxomfort/base.hpp>
#include <cxxomfort/util/type_traits.hpp>
#include <cxxomfort/impl/using_tr1_type_traits.hpp>
#include <cxxomfort/impl/11-underlying_type.hpp>
//#include <cxxomfort/using.hpp>

/*
 * Usage is as follows:
 */
#if 0 

// example

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

#include <type_traits>

// for tr1 we bring at least the basic type traits
#if (CXXO_COMPILER_SUPPORT_tr1_type_traits)
namespace std {
    using tr1::integral_constant;
    using tr1::false_type;
    using tr1::true_type;
    using tr1::is_same;
    using tr1::is_integral;
    using tr1::is_floating_point;
    using tr1::is_arithmetic;
    using tr1::is_signed;
    using tr1::is_unsigned;
    using tr1::is_void;
    using tr1::is_fundamental;
    using tr1::is_compound;
    using tr1::is_const;
    using tr1::add_const;
    using tr1::remove_const;
    using tr1::is_volatile;
    using tr1::add_volatile;
    using tr1::remove_volatile;
    using tr1::remove_cv;
    using tr1::is_reference;
    using tr1::add_reference;
    using tr1::remove_reference;
    using tr1::is_pointer;
    using tr1::add_pointer;
    using tr1::remove_pointer;
    using tr1::is_function;
    using tr1::is_enum;
    using tr1::is_member_function_pointer;
    using tr1::is_member_object_pointer;
    using tr1::is_member_pointer;
    using tr1::is_array;
    using tr1::rank;
    using tr1::extent;
    using tr1::remove_extent;
    using tr1::is_class;
    using tr1::is_union;
    using tr1::is_scalar;
    using tr1::is_object;
    using tr1::is_empty;
    using tr1::is_pod;
    using tr1::is_abstract;
    using tr1::is_polymorphic;
    using tr1::is_base_of;
    
    
}

#endif

#endif

Added cxxomfort/cxxomfort/impl/valcomp.hpp.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef CXXOMFORT_IMPL_VALCOMP_HPP
#define CXXOMFORT_IMPL_VALCOMP_HPP

/**
 * @file
 * @brief Implements a generic strcmp-like (three-way) comparator.
 * 
 * */
namespace cxxomfort { namespace impl {

template <typename T, typename Comp>
int valcmp (T const& v1, T const& v2, Comp comp) CXXO_NOEXCEPTNOTHROW {
    return comp(v1,v2);
}

template <typename T>
int valcmp (T const& v1, T const& v2) CXXO_NOEXCEPTNOTHROW {
    return v1==v2 ? 0 : (v1<v2 ? -1 : +1);
}

}}

#endif

Changes to cxxomfort/cxxomfort/iterator.hpp.

35
36
37
38
39
40
41
42

43
44



45
 * * @c begin() , @c end() accessors.
 * * @c rbegin() , @c rend() accessors (C++14).
 * * @c cbegin() , @c cend() accessors (C++14).
 * * @c size() accessor (C++17).
 * * @c data() accessor (C++17).
 * * @c empty() accessor (C++17).
 * 
 * See also: @ref algorithm.hpp , @ref cxxo-sup-iterator (supplemental), 

 * <a href="https://en.cppreference.com/w/cpp/header/iterator">\<iterator\> @ cppreference</a>
 * 



 * */







<
>
|

>
>
>

35
36
37
38
39
40
41

42
43
44
45
46
47
48
 * * @c begin() , @c end() accessors.
 * * @c rbegin() , @c rend() accessors (C++14).
 * * @c cbegin() , @c cend() accessors (C++14).
 * * @c size() accessor (C++17).
 * * @c data() accessor (C++17).
 * * @c empty() accessor (C++17).
 * 

 * 
 * @section also See Also
 * 
 * * @see @cppref{header/iterator} 
 * * @see @ref cxxo-sup-algorithm 
 * 
 * */

Changes to cxxomfort/cxxomfort/library.hpp.

64
65
66
67
68
69
70
71
72

73
74
75
76
77
78
79
80
81
82
83
 * * @subpage cxxo-sup-type_traits "Supplements for <type_traits>"
 * * @subpage cxxo-sup-utility "Supplements for <utility>"
 * 
 * * @subpage cxxo-FOREACH "FOREACH (foreach loop)"
 * * @subpage cxxo-i12n "I12N (Container Initialization)"
 * * @subpage cxxo-fundamental "Fundamental"
 * * @subpage cxxo-sequences "Sequence Utilities"
 *   * @ref @c libarrayref "array_ref"
 *   * @ref @c libfixedvector "fixed_vector"

 * * @subpage cxxo-typesafe_enum "Typesafe @c enum "
 * 
 * * @ref cxxo-pair03 "Pair"
 * * @ref cxxo-clstring "clString"
 * * @ref cxxo-type_name "type_name"
 * 
 */



#endif







|
|
>











64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
 * * @subpage cxxo-sup-type_traits "Supplements for <type_traits>"
 * * @subpage cxxo-sup-utility "Supplements for <utility>"
 * 
 * * @subpage cxxo-FOREACH "FOREACH (foreach loop)"
 * * @subpage cxxo-i12n "I12N (Container Initialization)"
 * * @subpage cxxo-fundamental "Fundamental"
 * * @subpage cxxo-sequences "Sequence Utilities"
 *   * @ref libarrayref @c "array_ref"
 *   * @ref libfixedvector @c "fixed_vector"
 *   * @ref libmstack @c "mstack"
 * * @subpage cxxo-typesafe_enum "Typesafe @c enum "
 * 
 * * @ref cxxo-pair03 "Pair"
 * * @ref cxxo-clstring "clString"
 * * @ref cxxo-type_name "type_name"
 * 
 */



#endif

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

7
8
9
10
11
12
13


14
15
16
17
18
19
20
...
252
253
254
255
256
257
258

















259
260

261
262
263
264
265
266
267
...
275
276
277
278
279
280
281

282
283
284
285
286
287
288
289

290
291
292
293
294
295
296

/**
 * @file cxxomfort/library/algorithm.hpp
 * @brief cxxomfort Supplementals for <algorithm>
 * @xrefitem cxxo-sup-algorithm
 * 
 */



namespace cxxomfort { namespace library { namespace algorithm {

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


/**
 * @}
 */


















} // .algorithm::
} }


#endif

/**
 * @page cxxo-sup-algorithm
 * @brief cxxomfort Supplementals for <algorithm>
 * 
................................................................................
 * This section provides supplementary features for the set of 
 * algorithms present in <code><algorithm></code> that are 
 * specific to cxxomfort, as well as functions that complete the 
 * family of <code>_n</code> functions such as <code>transform_n</code>.
 * 
 * Interfaces defined here:
 * 

 * * @c copy_leftmost_n() , @c copy_rightmost_n () - copies from either end of a sequence.
 * * @c count_while() - counts elements in a sequence.
 * * @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.
 * * @c relative_search() - finds element ranges matching a differential.

 * 
 * 
 * All interfaces are defined in the namespace <code>cxxomfort::library::algorithm::</code>.
 * 
 * See also: @ref std0algorithm  .
 * 
 * */







>
>







 







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







 







>








>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
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
...
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317

/**
 * @file cxxomfort/library/algorithm.hpp
 * @brief cxxomfort Supplementals for <algorithm>
 * @xrefitem cxxo-sup-algorithm
 * 
 */

#include <cxxomfort/impl/valcomp.hpp>

namespace cxxomfort { namespace library { namespace algorithm {

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


/**
 * @}
 */


namespace lfv2 { // library fundamentals v2

template <typename Container>
void erase (Container& C, typename Container::value_type const& u) {
    using namespace std;
    C.erase( std::remove (begin(C), end(C), u) , end(C) );
}

template <typename Container, typename Pred>
void erase (Container& C, Pred if_) {
    using namespace std;
    C.erase( std::remove_if (begin(C), end(C), if_) , end(C) );
}

} // lfv2::

} // algorithm::

} } // cxxomfort::library::

#endif

/**
 * @page cxxo-sup-algorithm
 * @brief cxxomfort Supplementals for <algorithm>
 * 
................................................................................
 * This section provides supplementary features for the set of 
 * algorithms present in <code><algorithm></code> that are 
 * specific to cxxomfort, as well as functions that complete the 
 * family of <code>_n</code> functions such as <code>transform_n</code>.
 * 
 * Interfaces defined here:
 * 
 * * @c valcmp() - compares two values in the way strcmp, memcmp do.
 * * @c copy_leftmost_n() , @c copy_rightmost_n () - copies from either end of a sequence.
 * * @c count_while() - counts elements in a sequence.
 * * @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.
 * * @c relative_search() - finds element ranges matching a differential.
 * * @c lfv2::erase(), lfv2::erase_if() from Fundamentals V2 - simplified erase-remove idiom for sequence containers.
 * 
 * 
 * All interfaces are defined in the namespace <code>cxxomfort::library::algorithm::</code>.
 * 
 * See also: @ref std0algorithm  .
 * 
 * */

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

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

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


namespace cxxomfort { namespace library { 

    using array_ref::array_ref;
    using array_ref::make_array_ref;
    using array_ref::arrayref;
    using array_ref::carrayref;

} }

#endif
|
|






|
|
|
|




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#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::make_array_ref;
    using ::cxxomfort::impl::array_ref::arrayref;
    using ::cxxomfort::impl::array_ref::carrayref;

} }

#endif

Changes to cxxomfort/cxxomfort/library/fixed_vector.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
...
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

namespace cxxomfort{
namespace library{

template <typename T, typename Alloc> class fixed_vector;


/**
 * @page library:fixed_vector
 * @brief Fixed vector (vector with size fixed at construction) container for C++.
 * @ingroup independent-features
 */


/**

 *
 * A @c fixed_vector is a container for continuous and fixed-size storage of elements fo type @a T .


 * 
 * It behaves much like a <code>vector<T><T></code> except there is no resize or
 * reserve support, as the size of the container is fixed at construction time; 
 * consequently, the semantics of insert and erase also change.

 *
 * Part of the spirit of this kind of "missing" container is what originated
 * n2648's "dynarray". However that proposal goes far beyond the mere
 * concept of a "fixed vector".
 *
 * An instance of fixed_vector<T> stores elements of type T.
 * The elements of a fixed_vector are stored contiguously, meaning that if @a a 
................................................................................
 * is an fixed_vector<T> then it obeys the identity
 * <code>&a[n] == &a[0] + n</code> for all 0 <= n < N."
 *
 * A @c fixed_vector  presents the some of the same interface convenients as
 * other standard containers, changing only some details:
 *
 * * copy constructor and iterator constructor.

 * * @c move  capability (including in C++03).
 * * indexed accesors (@c at() and @c operator[] ) with usual semantics.
 * * iteration member accesors and types.
 * * equality comparison operators.
 * * except where specified, no members throw.
 * * only one version of @c insert exists, which behaves similarly to @c at .
 * * only one version of @c erase exists, which behaves similarly to @c at .
 * 
 * The following features are missing at present:
 * 
 * * Allocator support.
 * * emplace inserts.
 * 
 * 
 * See also:
 * 
 * * cppreference:std::vector
 * * #array_ref
 * 
 *
 */
template <typename T, typename Alloc=std::allocator<T> > class fixed_vector {
    typedef fixed_vector<T>  this_type;
    private:
    typedef Alloc        alloc_t;
................................................................................
        this->swap(rhs);
        return *this;
    }

    // Information
    ////////
    

    size_type       max_size () const CXXO_NOEXCEPT { return m_sz; }
    size_type       size () const CXXO_NOEXCEPT { return m_sz; } ///< size of container
    bool            empty () const CXXO_NOEXCEPT { return m_p == nullptr && m_sz == 0; } // nothrow

    //! access to storage buffer
    const T*        data () const CXXO_NOEXCEPT { return m_p; } // nothrow
    T*              data () CXXO_NOEXCEPT { return m_p; } // nothrow

    //! checked access to elements
    const_reference at (size_t idx) const {
        if (m_sz <= idx) throw std::out_of_range("fixed_vector at(size_t) const");
        return m_p[idx];
    }
    //! @overload at
    reference at (size_t idx) {
        if (m_sz <= idx) throw std::out_of_range("fixed_vector at(size_t)");
        return m_p[idx];
    }
    //! checked access to elements
    const_reference at (size_t idx, std::error_code& ec) const {
        if (m_sz <= idx) ec.assign(EINVAL, std::generic_category());
        return m_p[idx];
    }
    

    //! direct access to elements
    const_reference operator[] (size_t idx) const CXXO_NOEXCEPT { // nothrow
        return m_p[idx];
    }
    //! @overload operator[]
    reference operator[] (size_t idx) CXXO_NOEXCEPT { // nothrow
        return m_p[idx];
    }







<
<
<
<
<

<

>
|
<
>
>




>







 







>











|


|
|
|
<







 







>
|



<
|
|

|









|






|







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
...
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

namespace cxxomfort{
namespace library{

template <typename T, typename Alloc> class fixed_vector;









/**
 * @brief A @anchor libfixedvector @c fixed_vector is a container for continuous and fixed-size storage of elements of type @a T .
 * 

 * @ingroup cxxo-sup
 * @xrefitem cxxo-sup "Supplements" "Container Supplements"
 * 
 * It behaves much like a <code>vector<T><T></code> except there is no resize or
 * reserve support, as the size of the container is fixed at construction time; 
 * consequently, the semantics of insert and erase also change.
 * 
 *
 * Part of the spirit of this kind of "missing" container is what originated
 * n2648's "dynarray". However that proposal goes far beyond the mere
 * concept of a "fixed vector".
 *
 * An instance of fixed_vector<T> stores elements of type T.
 * The elements of a fixed_vector are stored contiguously, meaning that if @a a 
................................................................................
 * is an fixed_vector<T> then it obeys the identity
 * <code>&a[n] == &a[0] + n</code> for all 0 <= n < N."
 *
 * A @c fixed_vector  presents the some of the same interface convenients as
 * other standard containers, changing only some details:
 *
 * * copy constructor and iterator constructor.
 * * assignment is copy, removing the old contents.
 * * @c move  capability (including in C++03).
 * * indexed accesors (@c at() and @c operator[] ) with usual semantics.
 * * iteration member accesors and types.
 * * equality comparison operators.
 * * except where specified, no members throw.
 * * only one version of @c insert exists, which behaves similarly to @c at .
 * * only one version of @c erase exists, which behaves similarly to @c at .
 * 
 * The following features are missing at present:
 * 
 * * Allocator support.
 * * emplace inserts.
 * 
 * 
 * @see 
 * * @cppref{container/vector}
 * * @ref libarrayref array_ref

 * 
 *
 */
template <typename T, typename Alloc=std::allocator<T> > class fixed_vector {
    typedef fixed_vector<T>  this_type;
    private:
    typedef Alloc        alloc_t;
................................................................................
        this->swap(rhs);
        return *this;
    }

    // Information
    ////////
    

    size_type       max_size () const CXXO_NOEXCEPT { return m_sz; } ///< maximum allowed size (as per allocator)
    size_type       size () const CXXO_NOEXCEPT { return m_sz; } ///< size of container
    bool            empty () const CXXO_NOEXCEPT { return m_p == nullptr && m_sz == 0; } // nothrow


    const T*        data () const CXXO_NOEXCEPT { return m_p; } ///< nothrow access to buffer
    T*              data () CXXO_NOEXCEPT { return m_p; } ///< nothrow access to buffer

    //! checked (throwing) access to elements
    const_reference at (size_t idx) const {
        if (m_sz <= idx) throw std::out_of_range("fixed_vector at(size_t) const");
        return m_p[idx];
    }
    //! @overload at
    reference at (size_t idx) {
        if (m_sz <= idx) throw std::out_of_range("fixed_vector at(size_t)");
        return m_p[idx];
    }
    //! checked (non-throwing) access to elements
    const_reference at (size_t idx, std::error_code& ec) const {
        if (m_sz <= idx) ec.assign(EINVAL, std::generic_category());
        return m_p[idx];
    }
    

    //! unchecked, direct access to elements
    const_reference operator[] (size_t idx) const CXXO_NOEXCEPT { // nothrow
        return m_p[idx];
    }
    //! @overload operator[]
    reference operator[] (size_t idx) CXXO_NOEXCEPT { // nothrow
        return m_p[idx];
    }

Changes to cxxomfort/cxxomfort/library/foreach.hpp.

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

/**
 * @file
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 *
 */

#include <cxxomfort/config.hpp> // c++11

#if (CXXO_COMPILER_SUPPORT_foreach > 0)
    // C++11 onwards, plus some compilers with c++0x support
    #define CXXOMFORT_IMPLEMENTS_n2930 CXXO_IMPLSTATUS_NATIVE()
    #define CXXOMFORT_IMPLEMENTS_foreach CXXOMFORT_IMPLEMENTS_n2930

    #define CXXO_FOREACH(VDecl,CDecl) for (VDecl : CDecl)







|







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

/**
 * @file
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 *
 */

#include <cxxomfort/base.hpp> 

#if (CXXO_COMPILER_SUPPORT_foreach > 0)
    // C++11 onwards, plus some compilers with c++0x support
    #define CXXOMFORT_IMPLEMENTS_n2930 CXXO_IMPLSTATUS_NATIVE()
    #define CXXOMFORT_IMPLEMENTS_foreach CXXOMFORT_IMPLEMENTS_n2930

    #define CXXO_FOREACH(VDecl,CDecl) for (VDecl : CDecl)

Changes to cxxomfort/cxxomfort/library/functional.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
..
58
59
60
61
62
63
64


65
66
67
68
69
70
71

72



73
























74


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

/**
 * @file cxxomfort/library/functional.hpp
 * 
 * This section offers a number of alternatives and supplements to features found in 
 * <code><functional></code> such as function objects to complete various tasks, 
 * a function-like reference wrapper, and 
 * function objects that complement the <code>plus</code> family.
 * 
 * * @c noop - an object that does nothing with its arguments
 * * Supplements to named operators: 
 *   * <code>@ref preincrement</code> , @c predecrement .
 *   * Operator+assignment operators @c plus_it , @c minus_it , @c multiplies_it , @c divides_it , @c modulus_it .
 * 
 * 
 * Given a Standard C++ operator wrapper like <code>std::plus</code>, which wraps <code>operator+()</code>, 
 * cxxomfort also provides an analogue <code>@ref plus_it</code> which wraps <code>operator+=()</code>.
 * That is, they operate in the following way:


 * 
 * @code
plus<float> p;
plus_it<float,float> pa; // plus_assign
float r = p(3, M_PI); // same as r = 3 + M_PI;
pa(r, -4.12); // same as r+= -4.12;

 * @endcode
 * 
 */



namespace cxxomfort { namespace library {
namespace functional {
























CXXO_CONSTEXPR14 const struct noop_t {
    CXXO_CONSTEXPR14 void operator() (...) const CXXO_NOEXCEPTNOTHROW {}











} noop;




























template <typename T> struct is_std_function : std::false_type {};
template <typename Sig> struct is_std_function< std::function<Sig> > : std::true_type {};









template <typename T>
struct constant_function {
    T const value;
    CXXO_CONSTEXPR14 constant_function (T const& t) : value(t) {}
    
    T const& operator() (...) const CXXO_NOEXCEPT { return value; }
    
................................................................................
CXXO_CONSTEXPR14 const constant_function<bool> false_f (false);



} // .functional:
}}



#include "../impl/functionmeta.hpp"

namespace cxxomfort { namespace library { namespace functional {
    using ::cxxomfort::impl::functiontype;
} } }

#include "operatorit.hpp" // supplement operator functors






























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

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#ifndef CXXOMFORT_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>
/**

 * @file 
 * @ingroup cxxo-sup-functional



 * 




 * */




// information about function types:
// their arguments, arity, return types, etc.










#include "../impl/functionmeta.hpp"


namespace cxxomfort { namespace library {
namespace functional {

using ::cxxomfort::impl::functiontype;
using ::cxxomfort::impl::function_caller;

// pointer-to-nullar-function

template <typename R>
struct nullary_function_ptrt {
    typedef cxxomfort::impl::functiontype<R()> FT;
    typename FT::pointer ptr;
    nullary_function_ptrt (typename FT::pointer const p) : ptr(p) {}
    R operator() () const { return ptr(); }
    
};

/**
 * "Overload" for @c std::ptr_fun that wrapps nullary functions.
 * */
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_CONSTEXPR14 void operator() (...) const CXXO_NOEXCEPTNOTHROW {  }

};

#if (CXXOMFORT_CXX_STD>=2014)
constexpr const noop_t noop = {};
#else
const noop_t noop = {};
#endif

//! generic no-op functor with return type T.
template <typename T> 
struct noopT_t {
    CXXO_CONSTEXPR14 T operator() (...) const CXXO_NOEXCEPTNOTHROW { return T(); }
};



template <typename R, typename S, S*> struct function_facet;

template <typename R, typename U, U(* const fn)()>
struct function_facet<R(), U(), fn> {
    R operator() () const {
        return static_cast<R>(fn());
    }
};

template <typename R, typename R1, typename U, typename U1, U(* const fn)(U1)>
struct function_facet<R(R1), U(U1), fn> {
    R operator() (R1 r1) const {
        return static_cast<R>(fn(r1));
    }
};



/**
 * Trait that identifies <code>std::function<(...)></code> specializations.
 * @ingroup cxxo-sup-funcitonal 
 * @xrefitem cxxo-sup-functional "" ""
 * */
template <typename T> struct is_std_function : std::false_type {};
template <typename Sig> struct is_std_function< std::function<Sig> > : std::true_type {};


/**
 * Wrapper that converts a constant value of type @a T 
 * into a function of signature <code>T(void)</code>.
 * 
 * @ingroup cxxo-sup-functional 
 * 
 * */
template <typename T>
struct constant_function {
    T const value;
    CXXO_CONSTEXPR14 constant_function (T const& t) : value(t) {}
    
    T const& operator() (...) const CXXO_NOEXCEPT { return value; }
    
................................................................................
CXXO_CONSTEXPR14 const constant_function<bool> false_f (false);



} // .functional:
}}

#include "operatorit.hpp" // supplement operator functors

#include "../impl/p0792r0-function_ref.hpp"

namespace cxxomfort { namespace library { namespace functional {
    using ::cxxomfort::impl::function_ref;
} } }


#endif

/**
 * @page cxxo-sup-functional
 * @brief Supplements to <functional>.
 * 
 * This section offers a number of alternatives and supplements to features found in 
 * <code><functional></code> such as function objects to complete various tasks, 
 * a function-like reference wrapper, and 
 * function objects that complement the <code>plus</code> family.
 * 
 * * @c noop - an object that does nothing with its arguments
 * * Supplements to named operators: 
 *   * <code>@ref preincrement</code> , @c predecrement .
 *   * Operator+assignment operators @c plus_it , @c minus_it , @c multiplies_it , @c divides_it , @c modulus_it .
 * * @c functiontype - meta information on function signatures.
 * * @c function_caller - zero-cost function object calling a named C function.
 * * @c function_ref - non-owning reference to a function-like callable.
 * 
 * 
 * Given a Standard C++ operator wrapper like <code>std::plus</code>, which wraps <code>operator+()</code>, 
 * cxxomfort also provides an analogue <code>@ref plus_it</code> which wraps <code>operator+=()</code>.
 * That is, they operate in the following way:
 * 
 * @code
plus<float> p;
plus_it<float,float> pa; // plus_assign
float r = p(3, M_PI); // same as r = 3 + M_PI;
pa(r, -4.12); // same as r+= -4.12;

 * @endcode
 * 
 */

Changes to cxxomfort/cxxomfort/library/i12n.hpp.

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
..
43
44
45
46
47
48
49



50
51
52
53
54
55
56
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 * @brief Implements <code>= {...}</code>-like initialization semantics for containers.
 */


/**
 * @page cxxo-i12n "I12N (initialization)"



 * 
 * Defines the dual macros @c CXXO_I12N_BEG and @c CXXO_I12N_END 
 * that provide initialization semantics for containers similar to the 
 * initializer_list constructors in C++11.
 * 



 * Interfaces defined:
 * 
 * * @ref CXXO_I12N_BEG
 * * @ref CXXO_I12N_END
 * * @ref CXXO_I12N_SEQ
 * 
 * Sample usage:

 * @code


CXXO_I12N_BEG( vector<int> , vn );
{1, 2, 3, 4, 5, 6, 7}
CXXO_I12N_END( vector<int> , vn );


CXXO_I12N_SEQ( vector<int> , vs , 
 {1, 2, 3, 4, 5, 6, 7}
 );


 * @endcode
 * 
 * @b Requirements:
................................................................................
 * * Containers using this utility must support iterator-range constructors.
 * * In C++03 mode, data types using this utility must be copyable.
 * 
 * Because of these requirements and other reasons intrinsic to its structure 
 * as a pseudo-container different from the C++ template sequences, 
 * i12n can not work with <code>std::array<...></code>.
 * 



**/

#if (CXXOMFORT_CXX_STD < 2011)

    #if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1)
    #pragma message CXXO_NOTICE ("enabled container initialization helper")
    #endif







>
>
>





>
>
>


|
|
|


>


>




>
|







 







>
>
>







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
..
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 * @brief Implements <code>= {...}</code>-like initialization semantics for containers.
 */


/**
 * @page cxxo-i12n "I12N (initialization)"
 * @ingroup cxxo-sup
 * 
 * Utilities for the initialization of sequence-liek objects / containers.
 * 
 * Defines the dual macros @c CXXO_I12N_BEG and @c CXXO_I12N_END 
 * that provide initialization semantics for containers similar to the 
 * initializer_list constructors in C++11.
 * 
 * It's called "i12n" from "initialization", the same way 
 * "i18n" is used for "internationalization".
 * 
 * Interfaces defined:
 * 
 * * @ref CXXO_I12N_BEG - prolog macro for initialization
 * * @ref CXXO_I12N_END - epilog macro for initialization
 * * @ref CXXO_I12N_SEQ - variadic macro for initialization
 * 
 * Sample usage:
 * 
 * @code

// Create a vector<int> with a given sequence of values.
CXXO_I12N_BEG( vector<int> , vn );
{1, 2, 3, 4, 5, 6, 7}
CXXO_I12N_END( vector<int> , vn );

// Create a deque<int> with a given sequence of values.
CXXO_I12N_SEQ( deque<int> , dn , 
 {1, 2, 3, 4, 5, 6, 7}
 );


 * @endcode
 * 
 * @b Requirements:
................................................................................
 * * Containers using this utility must support iterator-range constructors.
 * * In C++03 mode, data types using this utility must be copyable.
 * 
 * Because of these requirements and other reasons intrinsic to its structure 
 * as a pseudo-container different from the C++ template sequences, 
 * i12n can not work with <code>std::array<...></code>.
 * 
 * @see
 * * @ref seq_() - generation of sequences.
 * 
**/

#if (CXXOMFORT_CXX_STD < 2011)

    #if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1)
    #pragma message CXXO_NOTICE ("enabled container initialization helper")
    #endif

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

7
8
9
10
11
12
13

14
15
16
17
18
19
20
...
115
116
117
118
119
120
121

122
123










124
125
126
//#include <type_traits>


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

/**
 * @file

 */

namespace cxxomfort { namespace library { 
namespace iterator {

using ::cxxomfort::impl::ssize;

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

// cxxomfort::library::iterator
}}}

/**
 * @page cxxo-sup-iterator

 * 
 * Supplements to the utilities found in <code><iterator></code>.










 */

#endif







>







 







>


>
>
>
>
>
>
>
>
>
>



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
//#include <type_traits>


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

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

namespace cxxomfort { namespace library { 
namespace iterator {

using ::cxxomfort::impl::ssize;

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

// cxxomfort::library::iterator
}}}

/**
 * @page cxxo-sup-iterator
 * @ingroup cxxo-sup
 * 
 * Supplements to the utilities found in <code><iterator></code>.
 * 
 * Interfaces defined here:
 * 
 * * @c absdistance() .
 * * @c ssize() from p1227r0.
 * * @c function_iterator and @c make_function_iterator() .
 * 
 * @see
 * * @ref std0iterator
 * 
 */

#endif

Added cxxomfort/cxxomfort/library/random.hpp.



















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#ifndef CXXOMFORT_CXXO_RANDOM_SUPP_HPP
#define CXXOMFORT_CXXO_RANDOM_SUPP_HPP
/**
 * @file
 */

#include <cxxomfort/random.hpp>
#include <cxxomfort/functional.hpp>
#include <cxxomfort/cstdint.hpp>
#include <cxxomfort/limits.hpp>
#include <ctime>

namespace cxxomfort { namespace library {
namespace random {

std::default_random_engine& random_global_engine () {
    static std::default_random_engine Engine ( time(0 ));
    return Engine;
};

//
// reseed, from experimentlas / Fundamentals V2
//

void reseed (std::default_random_engine::result_type value) {
    random_global_engine().seed(value);
}


//
// randint, from experimentals / Fundamentals V2
//
template <typename IntType>
IntType randint (IntType a, IntType b) CXXO_NOEXCEPTNOTHROW {
    static std::uniform_int_distribution<IntType> Dis(a,b);
    if (b < a) return 0;
    return Dis(random_global_engine());
}



/*
 * Usage:
 * @code

 * @endcode
 * */
template <typename TD, typename TG>
struct random_wrapper {
    random_wrapper (TD& d, TG& g)
    : tg(g), td(d) {}

    typename TD::result_type operator() () {
        return td((TG&)tg);
    }

    std::reference_wrapper<TG> tg;
    TD td;
};

template <typename TD, typename TG>
random_wrapper<TD,TG> make_random_wrap (TD& d, TG& g) {
    return random_wrapper<TD,TG>(d,g);
}

//! PRNG in Numerical Recipes, as per Wikipedia's LCG article.
typedef std::linear_congruential_engine<uint32_t, 1664525, 1013904223, 0> 
lcg_numerical_recipes_rand;

//! MMIX: RNG recommended Donald Knuth, as per Wikipedia's LCG article.
typedef std::linear_congruential_engine<uint64_t, 6364136223846793005ULL, 1442695040888963407ULL, 0> 
MMIX_rand;

//! PRNG as per xkcd #221 "Random Number"
typedef 
std::linear_congruential_engine<unsigned int, 0, 4, 0>
xkcd221_r;

// 
// splitmix54 from http://xoshiro.di.unimi.it/splitmix64.c 
// recommended by  https://arvid.io/2018/07/02/better-cxx-prng/#fnref2
// 


class splitmix64 {
    // we'll mirror the interface of eg.: minstd_rand somewhat
    private:
    uint64_t _state;
    public:
    typedef uint64_t result_type;
    
    static const result_type min = 0;
    static const result_type max = integral_limits<uint64_t>::const_max;
    
    splitmix64 (uint64_t seed)
    : _state(seed)  {}
    
    void seed (uint64_t s) CXXO_NOEXCEPTNOTHROW {
        _state= s;
    }
    
    result_type operator() () CXXO_NOEXCEPTNOTHROW {
        uint64_t z = (_state += 0x9e3779b97f4a7c15ULL);
        z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9ULL;
        z = (z ^ (z >> 27)) * 0x94d049bb133111ebULL;
        return z ^ (z >> 31);
    }
    
    void discard (unsigned long long z) CXXO_NOEXCEPTNOTHROW {
        while (z --> 0) { this->operator()(); }
    }
    
};

#if 0 // original source code

/*  Written in 2015 by Sebastiano Vigna (vigna@acm.org)

To the extent possible under law, the author has dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.

See <http://creativecommons.org/publicdomain/zero/1.0/>. */

#include <stdint.h>

/* This is a fixed-increment version of Java 8's SplittableRandom generator
   See http://dx.doi.org/10.1145/2714064.2660195 and 
   http://docs.oracle.com/javase/8/docs/api/java/util/SplittableRandom.html

   It is a very fast generator passing BigCrush, and it can be useful if
   for some reason you absolutely want 64 bits of state; otherwise, we
   rather suggest to use a xoroshiro128+ (for moderately parallel
   computations) or xorshift1024* (for massively parallel computations)
   generator. */

static uint64_t x; /* The state can be seeded with any value. */

uint64_t next() {
	uint64_t z = (x += 0x9e3779b97f4a7c15);
	z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9;
	z = (z ^ (z >> 27)) * 0x94d049bb133111eb;
	return z ^ (z >> 31);
}
#endif



} // cxxomfort::library::random
}}

/**
 * @page cxxo-sup-random
 *
 * This file provides supplementary features to the ones
 * present in <code><random></code> that are
 * specific to cxxomfort.
 *
 * * @c xkcd221_g - xkcd's pseudorandom number generator.
 *
 *
 * All interfaces are defined in the namespace <code>cxxomfort::algorithm::</code>.
 * 
 * Also see @link std0random <random> @endlink .
 *
 */


#endif

Deleted cxxomfort/cxxomfort/library/randomfn.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
#ifndef CXXOMFORT_CXXO_RANDOM_SUPP_HPP
#define CXXOMFORT_CXXO_RANDOM_SUPP_HPP
/**
 * @file
 */

#include <cxxomfort/random.hpp>
//#include CXXO_INCLUDE_SYS(random)

namespace cxxomfort { namespace library {

/*
 * Usage:
 * @code

 * @endcode
 * */
template <typename TD, typename TG>
struct random_wrapper {
    random_wrapper (TD& d, TG& g)
    : tg(g), td(d) {}

    typename TD::result_type operator() () {
        return td((TG&)tg);
    }

    std::reference_wrapper<TG> tg;
    TD td;
};

template <typename TD, typename TG>
random_wrapper<TD,TG> make_random_wrap (TD& d, TG& g) {
    return random_wrapper<TD,TG>(d,g);
}

//! PRNG acorde a xkcd #221 "Random Number"
typedef 
std::linear_congruential_engine<uint16_t, 0, 4, 0>
xkcd221_g;




}}

/**
 * @page cxxo-sup-random
 *
 * This file provides supplementary features to the ones
 * present in <code><random></code> that are
 * specific to cxxomfort.
 *
 * * @c xkcd221_g - xkcd's pseudorandom number generator.
 *
 *
 * All interfaces are defined in the namespace <code>cxxomfort::algorithm::</code>.
 * 
 * Also see @link std0random <random> @endlink .
 *
 */


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






























































































































Changes to cxxomfort/cxxomfort/library/sequences.hpp.

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

/**
 * @file
 * 
 */

#include "../config.hpp"
#include <array>
#include <vector>
#include <type_traits>
#include "../util/type_traits.hpp"
#include "../library/i12n.hpp"
#include "../impl/17-bool_constant.hpp"
#include "../using.hpp"

/**
 * @page cxxo-sequences Sequence Helpers
 * @ingroup cxxo-sup
 * 
 * Interfaces defined in this file:
 * 







|
|
|



<







3
4
5
6
7
8
9
10
11
12
13
14
15

16
17
18
19
20
21
22

/**
 * @file
 * 
 */

#include "../config.hpp"
#include <cxxomfort/array.hpp>
#include <cxxomfort/type_traits.hpp>
#include <vector>
#include "../util/type_traits.hpp"
#include "../library/i12n.hpp"
#include "../impl/17-bool_constant.hpp"


/**
 * @page cxxo-sequences Sequence Helpers
 * @ingroup cxxo-sup
 * 
 * Interfaces defined in this file:
 * 

Changes to cxxomfort/cxxomfort/library/string.hpp.

3
4
5
6
7
8
9

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
...
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
/**
 * @file cxxomfort/library/string.hpp
 * @xrefitem cxxo-sup-string "<string>" "Header"
 *
 */

#include <cxxomfort/base.hpp>

#include <cxxomfort/string.hpp>
#include <cstring>
#include <string>
#include <sstream>
#include <cxxomfort/algorithm.hpp>

#include "../impl/character.hpp"
#include "../impl/to_basic_string_variadic.hpp"


namespace cxxomfort { namespace library {
/**
 * @ingroup cxxo-sup-string
 * @{
 */
namespace string {
................................................................................
template <typename String>
void l_trim (String& s, char c) {
    using namespace std;
    // we find L = first position in s where p(L) is false
    // we use string's erase function (or just a copy constructor)
    function<bool(char)> p = bind(
        equal_to<char>()
        , c, placeholders::_1
    );
    l_trim(s,p);
}

/**
 * @brief Trims a string removing a selected character class from the right.
 * @param s The string object to be modified.
................................................................................
template <typename String>
void r_trim (String& s, char c) {
    using namespace std;
    // we find L = first position in s where p(L) is false
    // we use string's erase function (or just a copy constructor)
    function<bool(char)> p = bind(
        equal_to<char>()
        , c, placeholders::_1
    );
    r_trim(s,p);
}

/** Trims a string removing characters from the left and right. **/
template <typename String, typename Pred>
void trim (String& s, Pred p) {







>





<


<







 







|







 







|







3
4
5
6
7
8
9
10
11
12
13
14
15

16
17

18
19
20
21
22
23
24
...
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
...
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/**
 * @file cxxomfort/library/string.hpp
 * @xrefitem cxxo-sup-string "<string>" "Header"
 *
 */

#include <cxxomfort/base.hpp>
#include <cxxomfort/functional.hpp> // functors, binders, placeholders
#include <cxxomfort/string.hpp>
#include <cstring>
#include <string>
#include <sstream>
#include <cxxomfort/algorithm.hpp>

#include "../impl/character.hpp"
#include "../impl/to_basic_string_variadic.hpp"


namespace cxxomfort { namespace library {
/**
 * @ingroup cxxo-sup-string
 * @{
 */
namespace string {
................................................................................
template <typename String>
void l_trim (String& s, char c) {
    using namespace std;
    // we find L = first position in s where p(L) is false
    // we use string's erase function (or just a copy constructor)
    function<bool(char)> p = bind(
        equal_to<char>()
        , c, std::placeholders::_1
    );
    l_trim(s,p);
}

/**
 * @brief Trims a string removing a selected character class from the right.
 * @param s The string object to be modified.
................................................................................
template <typename String>
void r_trim (String& s, char c) {
    using namespace std;
    // we find L = first position in s where p(L) is false
    // we use string's erase function (or just a copy constructor)
    function<bool(char)> p = bind(
        equal_to<char>()
        , c, std::placeholders::_1
    );
    r_trim(s,p);
}

/** Trims a string removing characters from the left and right. **/
template <typename String, typename Pred>
void trim (String& s, Pred p) {

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

375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
...
442
443
444
445
446
447
448
449
450
451
452
453

454
455
456
457
458
459
460
461
462
463
...
494
495
496
497
498
499
500

501
502
503
504
505
 * 
 */
template <typename Tuple<A0, A1, ..., An, Am> >
tuple<A0, ..., An> tuple_pop(tuple<A0, A1, ..., An, Am> const& tu);

#endif

#if (0 && CXXOMFORT_CXX_STD >= 2011)

//! Pops (discards) the rightmost type in a tuple.
//! @ingroup independent-utilities
template <typename AF, typename Args..., typename Indices...>
std::tuple<Args...> tuple_pop (std::tuple<Args...,AF> && _tuple) {
    using namespace std;
    return make_tuple( forward<Args...>(get<Indices...>(_tuple));
}
#else
template <typename A0, typename A1>
std::tuple<A0> tuple_pop (std::tuple<A0,A1> const& t) {
    using std::get;
    return std::make_tuple( get<0>(t) );
}
................................................................................
 * 
 */
template <typename Tuple<A0, A1, ..., An> >
tuple<A1, ..., An> tuple_shift(tuple<A0, A1, ..., An> const& tu);

#endif

#if (0 && CXXOMFORT_CXX_STD >= 2011)

//! Shifts a tuple one type to the left, discarding the leftmost type.
//! @ingroup independent-utilities
template <typename A1, typename... Args, typename... Indices>

std::tuple<Args...> tuple_shift (std::tuple<A1,Args...> && _tuple) {
    using namespace std;
    return make_tuple( forward<Args...>(get<Indices...>(_tuple));
}
#else
// c++03 impl

template <typename A0>
std::tuple<> tuple_shift (std::tuple<A0> const&) {
    using std::get;
................................................................................
}
}} // cxxomfort


//
// tuple_call (f, Tuple)
// calls f for each member of Tuple

//
#include "../impl/tuple_call.hpp"


#endif







|



|


|







 







|




>
|

|







 







>





375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
...
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
...
495
496
497
498
499
500
501
502
503
504
505
506
507
 * 
 */
template <typename Tuple<A0, A1, ..., An, Am> >
tuple<A0, ..., An> tuple_pop(tuple<A0, A1, ..., An, Am> const& tu);

#endif

#if (0&&CXXOMFORT_CXX_STD >= 2011)

//! Pops (discards) the rightmost type in a tuple.
//! @ingroup independent-utilities
template <typename AF, typename... Args, typename... Indices>
std::tuple<Args...> tuple_pop (std::tuple<Args...,AF> && _tuple) {
    using namespace std;
    return make_tuple( forward<Args>(get<Indices>(_tuple)...);
}
#else
template <typename A0, typename A1>
std::tuple<A0> tuple_pop (std::tuple<A0,A1> const& t) {
    using std::get;
    return std::make_tuple( get<0>(t) );
}
................................................................................
 * 
 */
template <typename Tuple<A0, A1, ..., An> >
tuple<A1, ..., An> tuple_shift(tuple<A0, A1, ..., An> const& tu);

#endif

#if (CXXOMFORT_CXX_STD >= 2011)

//! Shifts a tuple one type to the left, discarding the leftmost type.
//! @ingroup independent-utilities
template <typename A1, typename... Args, typename... Indices>
std::tuple<Args...> tuple_shift 
(std::tuple<A1,Args...> && _tuple) {
    using namespace std;
    return make_tuple( forward<Args...>(get<Indices>(_tuple)...) );
}
#else
// c++03 impl

template <typename A0>
std::tuple<> tuple_shift (std::tuple<A0> const&) {
    using std::get;
................................................................................
}
}} // cxxomfort


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


#endif

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

8
9
10
11
12
13
14
15
16
17
18
19
20

21
22
23
24
25
26
27
..
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

#include <cxxomfort/base.hpp>
#include <cxxomfort/config.hpp>
#include <typeinfo>
#include <type_traits> // remove_reference, etc
#include "../util/type_traits.hpp"
#include "../type_traits.hpp"
#include "../using.hpp"
#include <string>
#include "../string_view.hpp"
#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG)
    #include <cxxabi.h>
#endif


namespace cxxomfort {
namespace library {
namespace detail_demangle {

// Thanks much to ′灵魂L.眼神 for making me notice this had to be made static!
static std::string job (const char* name) {
................................................................................
 */

template <typename T>
std::string_view type_name () CXXO_NOEXCEPTNOTHROW {
    using namespace std;
#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)
    string_view S (__FUNCSIG__);


    char const* pend= find(S.begin()+119, S.end(), '>');
    size_t nend= static_cast<size_t>(pend - S.begin() - 119);
    S= S.substr(119, nend);

#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC)
    string_view S (__PRETTY_FUNCTION__);
    //std::cerr<< "["<< S<< "]"<< std::endl;

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

#else
    string_view S (typeid(T).name());
#endif
    return S;
}



template <typename T>
std::string type_name_old () CXXO_NOEXCEPTNOTHROW {
    using namespace std;
    typedef typename remove_reference<T>::type TnR;
    std::string r( typeid_demangle(typeid(T)) );







<





>







 







<
>
|
<
|



|
>

|







<







8
9
10
11
12
13
14

15
16
17
18
19
20
21
22
23
24
25
26
27
..
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

#include <cxxomfort/base.hpp>
#include <cxxomfort/config.hpp>
#include <typeinfo>
#include <type_traits> // remove_reference, etc
#include "../util/type_traits.hpp"
#include "../type_traits.hpp"

#include <string>
#include "../string_view.hpp"
#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG)
    #include <cxxabi.h>
#endif
//#include <iostream> // debug only

namespace cxxomfort {
namespace library {
namespace detail_demangle {

// Thanks much to ′灵魂L.眼神 for making me notice this had to be made static!
static std::string job (const char* name) {
................................................................................
 */

template <typename T>
std::string_view type_name () CXXO_NOEXCEPTNOTHROW {
    using namespace std;
#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)
    string_view S (__FUNCSIG__);

    // from "...type_name<TYPE_WE_WANT>(void) throw"
    size_t nend= S.rfind(">(void)");

    S= S.substr(119, nend-119);

#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC)
    string_view S (__PRETTY_FUNCTION__);
    //std::cout<< "["<< S<< "]"<< std::endl;
    size_t rend = (CXXOMFORT_CXX_STD >= 2017 ? 50UL : (CXXOMFORT_COMPILER_VERSION > 404 ? 80UL : 1UL));
    size_t lpos = static_cast<size_t>(S.find("with T = ")+9UL);
    size_t rpos = static_cast<size_t>((S.end() - rend) - S.begin());
    S= S.substr(lpos, rpos-lpos);

#else
    string_view S (typeid(T).name());
#endif
    return S;
}



template <typename T>
std::string type_name_old () CXXO_NOEXCEPTNOTHROW {
    using namespace std;
    typedef typename remove_reference<T>::type TnR;
    std::string r( typeid_demangle(typeid(T)) );

Changes to cxxomfort/cxxomfort/library/type_traits.hpp.

23
24
25
26
27
28
29

















30
31
32
33
34
35
36
#include "sequences.hpp" 

#include "../impl/character.hpp"


namespace cxxomfort{ namespace library{ 
namespace type_traits{


















/**
 * @brief type_trait that identifies @c std::byte .
 */
template <typename T> struct is_std_byte: std::false_type {};
template <> struct is_std_byte< std::byte >: std::true_type {};








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







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
#include "sequences.hpp" 

#include "../impl/character.hpp"


namespace cxxomfort{ namespace library{ 
namespace type_traits{

using cxxomfort::impl::type_traits::is_character_type;

//
// is_noexcept, add_noexcept
//
#if (0 && CXXOMFORT_CXX_STD >= 2017)
template <typename T> struct is_noexcept : std::integral_constant< bool, noexcept(T)> {};
template <typename T> struct add_noexcept : std::conditional <
    is_noexcept<T>::value , T, T noexcept>::type
>::type {};

#else
template <typename T> struct is_noexcept : std::false_type {};
template <typename T> struct add_noexcept { enum { intentionally_empty }; }; // intentionally empty
#endif


/**
 * @brief type_trait that identifies @c std::byte .
 */
template <typename T> struct is_std_byte: std::false_type {};
template <> struct is_std_byte< std::byte >: std::true_type {};

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

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 @author Luis Machuca Bezzaza
 @see http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Type_Safe_Enum
 @see http://stackoverflow.com/questions/217549/which-typesafe-enum-in-c-are-you-using/11856721#11856721
**/
#include <cxxomfort/base.hpp>
#include <cxxomfort/util/type_traits.hpp>
#include <cxxomfort/impl/typesafe_enum-core.hpp>
#include <cxxomfort/using.hpp>

/*
 * Usage is as follows:
 */
#if 0 

// example







|







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 @author Luis Machuca Bezzaza
 @see http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Type_Safe_Enum
 @see http://stackoverflow.com/questions/217549/which-typesafe-enum-in-c-are-you-using/11856721#11856721
**/
#include <cxxomfort/base.hpp>
#include <cxxomfort/util/type_traits.hpp>
#include <cxxomfort/impl/typesafe_enum-core.hpp>
//#include <cxxomfort/using.hpp>

/*
 * Usage is as follows:
 */
#if 0 

// example

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

60
61
62
63
64
65
66




















67
68
69
70
71
72
73


//
// typed null
//























}
}}

#endif

/**







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







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


//
// typed null
//


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

struct strong_equality {
    static const strong_equality equal;
    static const strong_equality nonequal;
};


struct operator_LEG_t {
    template <typename T>
    int operator() (T const& l, T const& r) const {
        return l==r ? 0 : ( l < r ? -1 : +1 );
    }
    
};

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

}
}}

#endif

/**

Changes to cxxomfort/cxxomfort/memory.hpp.

179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194


195
/**
 * @page std0memory
 * @brief Backports from <memory>
 * 
 * Interfaces defined here:
 *
 * * @c alignof() (C++11) (See @e base_features ).
 * * @c addressof() (C++11)
 * * Pointer traits and Allocator traits
 * * <code>@link aligned_storage @endlink </code> (C++11)
 * * <code>@link unique_ptr @endlink </code> (C++11)
 * * @c make_unique() (C++14)
 *
 * See also:
 * <a href="https://en.cppreference.com/w/cpp/header/memory">\<memory\> \@cppreference</a>.
 *


 * */







|
|
|
|
|

|
<
|
>
>

179
180
181
182
183
184
185
186
187
188
189
190
191
192

193
194
195
196
/**
 * @page std0memory
 * @brief Backports from <memory>
 * 
 * Interfaces defined here:
 *
 * * @c alignof() (C++11) (See @e base_features ).
 * * @c addressof() (C++11) - get the memory address of an object.
 * * Pointer traits and Allocator traits (C++11) - tools for assisting in the design of containers.
 * * @link cxxomfort::cxxostd::aligned_storage @c aligned_storage @endlink </code> (C++11) - create an unitialized buffer for storing an object of a given type.
 * * @link cxxomfort::cxxostd::unique_ptr @c unique_ptr @endlink (C++11) - smart pointer that owns and holds a resource.
 * * @c make_unique() (C++14) - assist for creating @c unique_ptr .
 *
 * @section also See Also

 * 
 * * @see @cppref{header/memory} 
 *
 * */

Changes to cxxomfort/cxxomfort/numeric.hpp.

86
87
88
89
90
91
92
93
94
95
96
97
98


99
100

/**
 * @page std0numeric
 * @brief Backports from <numeric>
 * 
 * Interfaces defined in this section:
 * 
 * * @c iota() (C++11)
 * * @c gcd() , @c lcm() (C++17)
 * 
 * See also: @link algorithm.hpp "<algorithm>" @endlink ,  
 * <a href="https://en.cppreference.com/w/cpp/header/numeric">\<numeric\> \@cppreference</a>.
 * 


 * See also @ref cxxo-sup-numeric (supplemental).
 */







|
|

|
<

>
>
|

86
87
88
89
90
91
92
93
94
95
96

97
98
99
100
101

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

 * 
 * * @see @cppref{header/numeric} 
 * * @see @ref std0algorithm
 * * @ref cxxo-sup-numeric (supplemental).
 */

Changes to cxxomfort/cxxomfort/random.hpp.

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

#include "config.hpp"
#include "base.hpp"
#include <limits>
#include <random>
#include <array>
#include <ctime>
#include <cxxomfort/using.hpp> // std::array

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

// Fixes for the C++03 names of utilities in <random>
#include "impl/03-random_renames.hpp"

























// TBA: Backport discrete_distribution to c++03

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

namespace cxxomfort {
................................................................................
 * @c knuth_b as per C++11.
 * @ingroup cxx11-backports
 * @xrefitem std0random "" ""
 * @anchor knuth_b
 */
typedef shuffle_order_engine<std::minstd_rand0, 256> knuth_b;




}
} // cxxomfort
















#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#else
    #if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011)
    namespace std {
        using ::cxxomfort::cxxostd::shuffle_order_engine;
        using ::cxxomfort::cxxostd::knuth_b;

    }
    #endif
#endif



#endif

/**
 * @page std0random
 * @brief Backports from <random>
 * 
 * Interfaces defined in this section:
 * 
 * * @c linear_congruent_engine , @c minstd , @c minstd0 (C++11).
 * * @c shuffle_order_engine  , @c knuth_b  (C++11).

 * 
 * Pending:
 * 
 * * @c uniform_int_distribution (C++11).
 * * @c discrete_distribution (C++11).
 *
 * See also: @ref cxxo-sup-random (supplemental), 
 * <a href="https://en.cppreference.com/w/cpp/header/random">\<random\> \@cppreference</a>.
 * 
 * */







|
|
|








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







 







>
>
>



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






>



>












>










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

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

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

// Fixes for the C++03 names of utilities in <random>
#include "impl/03-random_renames.hpp"

#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC,>0) && CXXOMFORT_CXX_EMULATION < 2011)
namespace std {
    using tr1::linear_congruential_engine;
    using tr1::minstd_rand;
    using tr1::minstd_rand0;
    
    using tr1::mersenne_twister;
    using tr1::mt19937;
    
    using tr1::subtract_with_carry_engine;
    using tr1::ranlux24_base;

    //using tr1::generate_canonical;
    
    using tr1::uniform_int_distribution;
    using tr1::uniform_real_distribution;

    
    using tr1::random_device;
}

#endif


// TBA: Backport discrete_distribution to c++03

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

namespace cxxomfort {
................................................................................
 * @c knuth_b as per C++11.
 * @ingroup cxx11-backports
 * @xrefitem std0random "" ""
 * @anchor knuth_b
 */
typedef shuffle_order_engine<std::minstd_rand0, 256> knuth_b;


typedef std::ranlux24_base default_random_engine;

}
} // cxxomfort

/*
 * Visual C++ 2010 has a broken shuffle_order_engine that calls the 
 * nonmember min, max of the attached Engine, whereas the same 
 * engines that VC has only have member functions. Here we try to 
 * replace it with our own.
 * 
 * */
#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, >= 1600) && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC, < 1700))
namespace std { 
    using ::cxxomfort::cxxostd::shuffle_order_engine;
    using ::cxxomfort::cxxostd::knuth_b;
}

#endif

#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#else
    #if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011)
    namespace std {
        using ::cxxomfort::cxxostd::shuffle_order_engine;
        using ::cxxomfort::cxxostd::knuth_b;
        using ::cxxomfort::cxxostd::default_random_engine;
    }
    #endif
#endif



#endif

/**
 * @page std0random
 * @brief Backports from <random>
 * 
 * Interfaces defined in this section:
 * 
 * * @c linear_congruent_engine , @c minstd , @c minstd0 (C++11).
 * * @c shuffle_order_engine  , @c knuth_b  (C++11).
 * * @c default_random_engine - in cxxomfort defined as ranlux24_base for C++03.
 * 
 * Pending:
 * 
 * * @c uniform_int_distribution (C++11).
 * * @c discrete_distribution (C++11).
 *
 * See also: @ref cxxo-sup-random (supplemental), 
 * <a href="https://en.cppreference.com/w/cpp/header/random">\<random\> \@cppreference</a>.
 * 
 * */

Changes to cxxomfort/cxxomfort/string.hpp.

1
2
3
4
5
6
7
8
9
10
11
..
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...
103
104
105
106
107
108
109
110

111

112
113
114
115
116
117
118
119





120
#ifndef CXXOMFORT_STRING_HPP
#define CXXOMFORT_STRING_HPP
/**
 * @file cxxomfort/string.hpp
 * @brief Implementations and additions tied to <code><string></code>.
 * @xrefitem std0string "" ""
 */



#include "base.hpp"
................................................................................

namespace cxxomfort {
namespace cxxostd {
}
}

#include "impl/11-to_string.hpp"

#include "impl/11-basic_string_charn.hpp"
//#include "impl/14-string_literal.hpp"

#if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011)

// #include "impl/11-basic_string_hash.hpp"

................................................................................
/**
 * @page std0string
 * @brief Backports from <string>
 * 
 * 
 * Interfaces defined in this section:
 * 
 * * @c to_string() (@ref std_to_string )(C++11)

 * * @c strtoll() , @c strtoull() function family (C++11)

 * 
 * Future / potential interfaces:
 * 
 * * @c string user-defined literal
 * 
 * @see https://en.cppreference.com/w/cpp/header/string
 * Check also @link std0stringview <string_view> @endlink .
 *





 * */



|







 







<







 







|
>
|
>





|
<
|
>
>
>
>
>

1
2
3
4
5
6
7
8
9
10
11
..
19
20
21
22
23
24
25

26
27
28
29
30
31
32
...
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

119
120
121
122
123
124
125
#ifndef CXXOMFORT_STRING_HPP
#define CXXOMFORT_STRING_HPP
/**
 * @file 
 * @brief Implementations and additions tied to <code><string></code>.
 * @xrefitem std0string "" ""
 */



#include "base.hpp"
................................................................................

namespace cxxomfort {
namespace cxxostd {
}
}

#include "impl/11-to_string.hpp"

#include "impl/11-basic_string_charn.hpp"
//#include "impl/14-string_literal.hpp"

#if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011)

// #include "impl/11-basic_string_hash.hpp"

................................................................................
/**
 * @page std0string
 * @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
 * 
 *
 * */

Changes to cxxomfort/cxxomfort/string_view.hpp.

1
2
3
4


5
6
7
8
9
10
11
..
14
15
16
17
18
19
20
21
22
23

24









25
#ifndef CXXOMFORT_STRING_VIEW_HPP
#define CXXOMFORT_STRING_VIEW_HPP

#if (CXXOMFORT_CXX_STD < 2017)


#include "impl/17-string_view.hpp"

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

#endif
#endif

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

 * 









 * */



|
>
>







 







|


>

>
>
>
>
>
>
>
>
>

1
2
3
4
5
6
7
8
9
10
11
12
13
..
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef CXXOMFORT_STRING_VIEW_HPP
#define CXXOMFORT_STRING_VIEW_HPP

#if (CXXOMFORT_CXX_STD >= 2017)
#include <string_view>
#else
#include "impl/17-string_view.hpp"

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

#endif
#endif

/**
 * @page std0string_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 .
 * 
 * @section 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.

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
...
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
...
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
template <typename T> struct is_error_code_enum 
: public std::false_type {};

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


//
// error_condition and helpers
//

class error_condition;

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

template<> struct is_error_condition_enum<errc> : public std::true_type {};
//See above note
template<> struct is_error_condition_enum<typename myerrc::type> : public std::true_type {};


//
// error_category and helpers
//

class error_category;
................................................................................
        return &vl < & vr;
    }

    private:

};

CXXO_GENERATE_RELATIONALS0(error_category);

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

    const char* name () const CXXO_NOEXCEPTNOTHROW {
        return "generic";
    }
................................................................................
    private:
    
    int v_error;
    error_category const* p_category;
    
};

CXXO_GENERATE_RELATIONALS0(error_condition);

//! Creates an @c error_condition of generic category.
static inline 
error_condition make_error_condition ( errc e ) CXXO_NOEXCEPTNOTHROW {
    return error_condition( explicit_cast<int>(e), generic_category() );
}








|













|







 







|







 







|







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
...
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
...
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
template <typename T> struct is_error_code_enum 
: public std::false_type {};

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


//
// error_condition and helpers
//

class error_condition;

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

template<> struct is_error_condition_enum<errc> : public std::true_type {};
//See above note
template<> struct is_error_condition_enum<myerrc::type> : public std::true_type {};


//
// error_category and helpers
//

class error_category;
................................................................................
        return &vl < & vr;
    }

    private:

};

CXXO_GENERATE_RELATIONALS(error_category);

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

    const char* name () const CXXO_NOEXCEPTNOTHROW {
        return "generic";
    }
................................................................................
    private:
    
    int v_error;
    error_category const* p_category;
    
};

CXXO_GENERATE_RELATIONALS(error_condition);

//! Creates an @c error_condition of generic category.
static inline 
error_condition make_error_condition ( errc e ) CXXO_NOEXCEPTNOTHROW {
    return error_condition( explicit_cast<int>(e), generic_category() );
}

Changes to cxxomfort/cxxomfort/tuple.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














#ifndef CXXOMFORT_TUPLE_HPP
#define CXXOMFORT_TUPLE_HPP
/**
 * @file
 * @brief Implementations and backports related to <code><tuple></code>.
 * 
 * * @c get<tuple>() ( @ref std_get_type_tuple ) (C++14)
 * * @c tupple_apply() (C++17)
 * * @c make_from_tuple() (C++17)
 * 
 * See also: @ref std0utility , @ref cxxo-sup-tuple ,
 * <a href="https://en.cppreference.com/w/cpp/header/tuple">\<tuple\> \@cppreference</a>.
 * 
 */


#include "base.hpp"
#include "utility.hpp" // index_sequence
#include <tuple> // d'uh
#include <array> // array <-> tuple conversions
//#include <cxxomfort/library/tuple.hpp> // is_tuple

#if (defined(CXXOMFORT_NOTICES) && CXXOMFORT_NOTICES > 1)
    #pragma message CXXO_NOTICE("enabled <tuple> support")
#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
} //

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






 * 
 */


#include "base.hpp"
#include "utility.hpp" // index_sequence
#include <tuple> // d'uh
#include <array> // 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
#if (CXXO_COMPILER_SUPPORT_tr1_tuple)
namespace std {
    using tr1::tuple;
    using tr1::tuple_size;
    using tr1::tuple_element;
    using tr1::get;
    using tr1::tie;
    using tr1::ignore;
    using tr1::make_tuple;
}
#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
} //

#endif

/**
 * @page std0tuple
 * @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>.
 * 
 * */

Changes to cxxomfort/cxxomfort/type_traits.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
..
31
32
33
34
35
36
37

38
39
40
41
42
43
44
..
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
...
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
...
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
...
401
402
403
404
405
406
407
408


409
410
411
412
413
414
415
...
437
438
439
440
441
442
443



















#ifndef CXXOMFORT_TYPE_TRAITS_HPP
#define CXXOMFORT_TYPE_TRAITS_HPP
/**
 * @file
 * @brief Implementations and backports related to <code><type_traits></code>.
 * 
 * Interfaces provided by this header include:
 * 
 * * @c is_rvalue_reference (for C++03 only)
 * * @c decay 
 * * @c underlying_type 
 * * @c is_null_pointer
 * * trivially family of traits
 * * nothrow family of traits
 * * @c @ref is_trivial , @c @ref is_literal_type (C++11)
 * * is_null_pointer (C++14)
 * * void_t , make_void (C++17)
 * * #bool_constant  (C++17)
 * 
 */

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

// we need to find a <type_traits> header. In GCC,
................................................................................
#include "util/type_traits.hpp"
#include "util/meta.hpp" // enable_if etc

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



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


................................................................................
#if defined(CXXO_LACKS_make_signed)
namespace std { namespace tr1 {
    using cxxomfort::traits::make_signed;
    using cxxomfort::traits::make_unsigned;
} }
#endif // bring missing make_signed, make_unsigned to tr1

#include "using.hpp" // bring TR1 in


//
// lvalue_reference traits mirrored in C++03 mode
//

#if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011)
................................................................................
#include "impl/20-endian.hpp"


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

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

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

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



#undef CONSTRUCTIBLE_IMPL_FORM_BEGIN
#undef CONSTRUCTIBLE_IMPL_FORM_END

}
} cxxomfort::

#endif // -- is_constructible


/*
 * is_null_pointer (was added in C++14)
 */
................................................................................
    : integral_constant<bool,
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)
        #if (CXXOMFORT_COMPILER_VERSION>=1600)
        __is_standard_layout(T)
        #else
        false
        #endif
    #elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG)


        __is_standard_layout(T)
    #else
        is_scalar<T>::value
    #endif

    > {
    };
................................................................................

    > {
    };
} // namespace
#endif

#endif // #include guard
























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







 







>







 







|







 







|







 







|







 







|
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7











8
9
10
11
12
13
14
..
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
..
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
...
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
...
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
...
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
...
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
#ifndef CXXOMFORT_TYPE_TRAITS_HPP
#define CXXOMFORT_TYPE_TRAITS_HPP
/**
 * @file
 * @brief Implementations and backports related to <code><type_traits></code>.
 * @ingroup cxx11-backports
 * @xrefitem std0type_traits "" ""











 * 
 */

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

// we need to find a <type_traits> header. In GCC,
................................................................................
#include "util/type_traits.hpp"
#include "util/meta.hpp" // enable_if etc

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

#include "impl/using_tr1_type_traits.hpp"

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


................................................................................
#if defined(CXXO_LACKS_make_signed)
namespace std { namespace tr1 {
    using cxxomfort::traits::make_signed;
    using cxxomfort::traits::make_unsigned;
} }
#endif // bring missing make_signed, make_unsigned to tr1

//#include "using.hpp" // bring TR1 in


//
// lvalue_reference traits mirrored in C++03 mode
//

#if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011)
................................................................................
#include "impl/20-endian.hpp"


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

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

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

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



#undef CONSTRUCTIBLE_IMPL_FORM_BEGIN
#undef CONSTRUCTIBLE_IMPL_FORM_END

}
} // cxxomfort::

#endif // -- is_constructible


/*
 * is_null_pointer (was added in C++14)
 */
................................................................................
    : integral_constant<bool,
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)
        #if (CXXOMFORT_COMPILER_VERSION>=1600)
        __is_standard_layout(T)
        #else
        false
        #endif
    #elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC, >=406))
        __is_standard_layout(T)
    #elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_CLANG, >= 300))
        __is_standard_layout(T)
    #else
        is_scalar<T>::value
    #endif

    > {
    };
................................................................................

    > {
    };
} // namespace
#endif

#endif // #include guard

/**
 * @page std0type_traits
 * @brief cxxomfort backports for <type_traits>
 * 
 * Interfaces provided by this header include:
 * 
 * * @c is_rvalue_reference (for C++03 only)
 * * @ref @c cxxomfort::cxxstd::decay "decay<T>"
 * * @ref @c cxxomfort::cxxostd::underlying_type "underlying_type<Enum>"
 * * @c is_null_pointer
 * * trivially family of traits
 * * nothrow family of traits
 * * @c @ref is_trivial , @c @ref is_literal_type (C++11)
 * * is_null_pointer (C++14)
 * * void_t , make_void (C++17)
 * * #bool_constant  (C++17)
 * 
 */

Changes to cxxomfort/cxxomfort/typeindex.hpp.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 */

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

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

#if (CXXOMFORT_CXX_STD >= 2011)
    #include <typeindex>
#else
namespace std {
    using ::cxxomfort::cxxostd::type_index;
}
#endif

#include <functional> // hash

#if (CXXOMFORT_CXX_STD < 2011)
namespace std {
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC)
    namespace tr1 {
    #endif
    
    template<>
    struct hash< type_index > {







|









|







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

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

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

#if (CXXOMFORT_CXX_STD >= 2011 || CXXO_COMPILER_SUPPORT_cstd_typeindex>0)
    #include <typeindex>
#else
namespace std {
    using ::cxxomfort::cxxostd::type_index;
}
#endif

#include <functional> // hash

#if (CXXOMFORT_CXX_STD < 2011 && CXXO_COMPILER_SUPPORT_cstd_typeindex==0)
namespace std {
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC)
    namespace tr1 {
    #endif
    
    template<>
    struct hash< type_index > {

Changes to cxxomfort/cxxomfort/using.hpp.

22
23
24
25
26
27
28



29
30





31
32
33
34
35
36
37
..
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

/**
 * @namespace std
 * @brief Namespace of the Standard C++ Features
 * 
 */
#if (CXXOMFORT_CXX_STD < 2011 /* && CXXOMFORT_CXX_EMULATION < 2011 */)



namespace std { namespace tr1 {} } // ensure that the tr1 name exists
namespace std { 





    using namespace tr1 ;   
    // the above uses the contents of namespace 
    // might be not safe, see http://lists.nongnu.org/archive/html/adonthell-general/2011-07/msg00008.html
    // but there's really no better choice when trying to write 
    // portable code because:
    // 1.- we can't know in advance what names are exposed to "using" them
    // eg.: incomplete TR1 implementations, features that change names 
................................................................................
    // see http://lists.gnu.org/archive/html/adonthell-devel/2011-07/msg00000.html
    // (and we can't ignore missing names because "using" an unknown name is a fatal error)
    // 2.- we can't make the object names appear without 
    // #include-ing the headers first and availability of a header 
    // can not be checked at compile time.
    //
    // tl;dr: read the information on the repo wiki about TR1.

}
    #if defined(CXXOMFORT_NOTICES)
        #if (CXXOMFORT_NOTICES>1)
        #pragma message CXXO_NOTICE("importing TR1")
        #endif
    #endif
#else // in C++11

//namespace std { namespace tr1 { using namespace std; } } //
#endif

//#endif







>
>
>


>
>
>
>
>







 







|












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

/**
 * @namespace std
 * @brief Namespace of the Standard C++ Features
 * 
 */
#if (CXXOMFORT_CXX_STD < 2011 /* && CXXOMFORT_CXX_EMULATION < 2011 */)

#include <array>

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


#else

    using namespace tr1 ;   
    // the above uses the contents of namespace 
    // might be not safe, see http://lists.nongnu.org/archive/html/adonthell-general/2011-07/msg00008.html
    // but there's really no better choice when trying to write 
    // portable code because:
    // 1.- we can't know in advance what names are exposed to "using" them
    // eg.: incomplete TR1 implementations, features that change names 
................................................................................
    // see http://lists.gnu.org/archive/html/adonthell-devel/2011-07/msg00000.html
    // (and we can't ignore missing names because "using" an unknown name is a fatal error)
    // 2.- we can't make the object names appear without 
    // #include-ing the headers first and availability of a header 
    // can not be checked at compile time.
    //
    // tl;dr: read the information on the repo wiki about TR1.
#endif
}
    #if defined(CXXOMFORT_NOTICES)
        #if (CXXOMFORT_NOTICES>1)
        #pragma message CXXO_NOTICE("importing TR1")
        #endif
    #endif
#else // in C++11

//namespace std { namespace tr1 { using namespace std; } } //
#endif

//#endif

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

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
...
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
 * is_trivially_copy_constructible
 * is_trivially_copy_assignable
 * 
 * partial source:
 * http://stackoverflow.com/questions/25123458/is-trivially-copyable-is-not-a-member-of-std
 * 
 */
    #if (CXXOMFORT_CXX_STD == 2011 && CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG && CXXOMFORT_COMPILER_VERSION<=304) \
    || (CXXOMFORT_CXX_EMULATION == 2011 && CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_COMPILER_VERSION<=409)
namespace std {
    template <typename T>
    struct is_trivially_default_constructible
    : std::integral_constant<bool, __has_trivial_constructor(T)> {};

    template <typename T>
    struct is_trivially_copy_constructible 
................................................................................
    : std::integral_constant<bool, is_trivially_default_constructible<T>::value || is_nothrow_default_constructible<T>::value>
    {};

} // std::

#endif

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

} // std::







|
|







 







|







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
...
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
 * is_trivially_copy_constructible
 * is_trivially_copy_assignable
 * 
 * partial source:
 * http://stackoverflow.com/questions/25123458/is-trivially-copyable-is-not-a-member-of-std
 * 
 */
    #if (CXXOMFORT_CXX_STD == 2011 && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_CLANG , <=304)) \
    || (CXXOMFORT_CXX_EMULATION == 2011 &&CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC , <=409))
namespace std {
    template <typename T>
    struct is_trivially_default_constructible
    : std::integral_constant<bool, __has_trivial_constructor(T)> {};

    template <typename T>
    struct is_trivially_copy_constructible 
................................................................................
    : std::integral_constant<bool, is_trivially_default_constructible<T>::value || is_nothrow_default_constructible<T>::value>
    {};

} // std::

#endif

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

} // std::

Changes to cxxomfort/cxxomfort/utility.hpp.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "base.hpp"   // move, forward
#include CXXO_INCLUDE_SYS(utility)

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

//#include "type_traits.hpp"
#include "using.hpp"

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


namespace cxxomfort {







|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "base.hpp"   // move, forward
#include CXXO_INCLUDE_SYS(utility)

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

Changes to cxxomfort/cxxomfort/various.hpp.

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 * @brief Query if an integral with the given size exists
 * 
 */

#include "util/type_traits.hpp"
#include "util/meta.hpp"      // enable_if, etc...
#include "utility.hpp"
#include "using.hpp"


/*
 * is_any_of
 */
namespace cxxomfort {








|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 * @brief Query if an integral with the given size exists
 * 
 */

#include "util/type_traits.hpp"
#include "util/meta.hpp"      // enable_if, etc...
#include "utility.hpp"
//#include "using.hpp"


/*
 * is_any_of
 */
namespace cxxomfort {

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

28
29
30
31
32
33
34

35
36
37
38
39
40
41
42
..
66
67
68
69
70
71
72
73

74
CXXO_LOCALFN||(Signature)(arguments...){...}|
CXXO_LOCALFN_NAME_DEF||(Name,Signature)|
CXXO_NOEXCEPT|expr?||
CXXO_NOEXCEPTNOTHROW|expr?||
CXXO_PSEUDOVARIADIC_MEMBER||(prefix,func_name,suffix)|
CXXO_TYPEOF|type?|(expression)|
#library general

make_array_ref|array_ref<T>|(T[N])|
seq_|"sequence type"|<T>(...sequence of T)|
typeid_demangle|std::string|(typeid construct)|
type_name|std::string|<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)|
................................................................................
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)|
#code generation
CXXO_AUTO|type?|(name , expression)|
CXXOMFORT_CXX11_CODE|code...|(cxx11onward_code,cxx03upto_code)|
CXXOMFORT_CXX14_CODE|code...|(cxx14onward_code,cxx11upto_code)|
CXXO_DEFAULT_DEFAULT_CONSTRUCTOR|default_ctor_expression|(T)|
CXXO_GENERATE_RELATIONALS|code...||

CXXO_COMPILERVERSION_COMPARE|BOOL|(compilerid_, > == < version_)|







>
|







 







|
>
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
..
67
68
69
70
71
72
73
74
75
76
CXXO_LOCALFN||(Signature)(arguments...){...}|
CXXO_LOCALFN_NAME_DEF||(Name,Signature)|
CXXO_NOEXCEPT|expr?||
CXXO_NOEXCEPTNOTHROW|expr?||
CXXO_PSEUDOVARIADIC_MEMBER||(prefix,func_name,suffix)|
CXXO_TYPEOF|type?|(expression)|
#library general
carrayref|array_ref<T const>|(T[N])|
arrayref|array_ref<T>|(T&[N])|
seq_|"sequence type"|<T>(...sequence of T)|
typeid_demangle|std::string|(typeid construct)|
type_name|std::string|<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)|
................................................................................
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)|
#code generation
CXXO_AUTO|type?|(name , expression)|
CXXOMFORT_CXX11_CODE|code...|(cxx11onward_code,cxx03upto_code)|
CXXOMFORT_CXX14_CODE|code...|(cxx14onward_code,cxx11upto_code)|
CXXO_DEFAULT_DEFAULT_CONSTRUCTOR|default_ctor_expression|(T)|
CXXO_GENERATE_RELATIONALS|code...|(Type)|
CXXO_GENERATE_RELATIONALS_T|code...|(Type with TPARAMS and TARGS)|
CXXO_COMPILERVERSION_COMPARE|BOOL|(compilerid_, ⋚ <==> version_)|