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

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:e1adbc8431b3c879854d4ad38c3d2bcc6a66a083a29d88fb87103d7c9a2a9336
User & Date: luismachuca 2018-12-23 20:01:36
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
2018-12-20
16:10
Commit 2018-12-18 - Minor fix.
  • library: Fix inclusion of ssize header.
check-in: e00700a4 user: luismachuca tags: trunk
Changes

Added cxxomfort/cxxomfort/CREDITS.txt.

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
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
...
259
260
261
262
263
264
265



























































#ifndef CXXOMFORT_ALGORITHM_HPP
#define CXXOMFORT_ALGORITHM_HPP
/**
 * @file cxxomfort/algorithm.hpp
 * @brief Implementations and Backports for Standard header <code>\<algorithm\></code>.
 * 
 * 
 * Interfaces defined in this file:
 * 
 * * @c all_of [all,any,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
 * 
 * 
 *
 * Algorithm demonstrations:
 * 
 * Copies and prints elements from a list via 
 * @c copy_if() and @c for_each_n() .
 * 
 * @code

struct  {
    template <typename Numeric> 
    bool operator() (Numeric n) const { 
        return n % 2 == 0; 
    }
}   even= {};

struct {
    template <typename T>
    SS& operator() (T const& t) const {
        return os<< t;
    }
  
    std::ostream& os;
}   print (std::cout);

list<int> s1;
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>.
 * 
 */

#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 "" ""
 * @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) {
................................................................................
}
    #endif // std using

#endif // using emulation


#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
...
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
#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) {
................................................................................
}
    #endif // std using

#endif // using emulation


#endif

/**
 * @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
 * 
 * 
 *
 * Algorithm demonstrations:
 * 
 * Copies and prints elements from a list via 
 * @c copy_if() and @c for_each_n() .
 * 
 * @code

struct  {
    template <typename Numeric> 
    bool operator() (Numeric n) const { 
        return n % 2 == 0; 
    }
}   even= {};

struct {
    template <typename T>
    SS& operator() (T const& t) const {
        return os<< t;
    }
  
    std::ostream& os;
}   print (std::cout);

list<int> s1;
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>.
 * 
 * */

Deleted cxxomfort/cxxomfort/algorithms.hpp.

1
2
3
4
5
6
#ifndef CXXOMFORT_ALGORITHMS_HPP
#define CXXOMFORT_ALGORITHMS_HPP
// deprecated header
#pragma message CXXO_WARNING("this header is deprecated. New header is <cxxomfort/algorithm.hpp>")
#include "algorithm.hpp"
#endif
<
<
<
<
<
<












Changes to cxxomfort/cxxomfort/cstddef.hpp.

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
..
41
42
43
44
45
46
47


















#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
#include "base/nullptr.hpp"  // nullptr_t
#include "base/static_assert.hpp"
#include "impl/17-byte.hpp" // c++17's "byte"
#include CXXO_INCLUDE_SYS(cstddef)

/**
 * @file
 * @brief Features related to Standard header <code><cstddef></code>.
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 * 
 * Including this file brings forth a number of backports and features 
 * declared in <cstddef>. Implementations in this section include:
 * 
 * * @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>.
 * 
 * 
 * **/

#if (CXXOMFORT_CXX_STD<2011 && CXXOMFORT_CXX_EMULATION<2011)
namespace std {
    /**
     * @class max_align_t 
     * @brief Alias for the native type with the largest alignment available.
     * @sa https://en.cppreference.com/w/cpp/types/max_align_t
................................................................................
     * @xrefitem std0cstddef "" "max_align_t"
     */
    typedef long double max_align_t;
}
#endif

#endif

























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







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
8
9
10
11
12
13
14


















15
16
17
18
19
20
21
..
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
#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
#include "base/nullptr.hpp"  // nullptr_t
#include "base/static_assert.hpp"
#include "impl/17-byte.hpp" // c++17's "byte"
#include CXXO_INCLUDE_SYS(cstddef)




















#if (CXXOMFORT_CXX_STD<2011 && CXXOMFORT_CXX_EMULATION<2011)
namespace std {
    /**
     * @class max_align_t 
     * @brief Alias for the native type with the largest alignment available.
     * @sa https://en.cppreference.com/w/cpp/types/max_align_t
................................................................................
     * @xrefitem std0cstddef "" "max_align_t"
     */
    typedef long double max_align_t;
}
#endif

#endif

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

Changes to cxxomfort/cxxomfort/cxxomfort.hpp.

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
..
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
 *  </td>
 * </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 cstddef.hpp "<cstddef>" - @subpage cstdint.hpp "<cstdint>" - <cstdio>
 <br/> @subpage cxxomfort/algorithm.hpp "<algorithm>" - @subpage cxxomfort/functional.hpp "<functional>" -  @subpage cxxomfort/iterator.hpp "<iterator>" - @subpage cxxomfort/numeric.hpp "<numeric>" - @subpage cxxomfort/string.hpp "<string>" 
 <br/> @subpage cxxomfort/memory.hpp "<memory>" - @subpage cxxomfort/tuple.hpp "<tuple>" - @subpage cxxomfort/utility.hpp "<utility>" 
 <br/> @subpage cxxomfort/type_traits.hpp "<type_traits>" 
 <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 "Extras"
 *  </td>
 * </tr><tr>
 * <td align="center"> @c #array_ref - @c #i12n - @c #fixed_vector - foreach emulation - typesafe enum
 * </td></tr>
 * </table>
 * 
 *
 * <table>
 * <tr><th colspan="9"> Installation and Usage </th></tr>
 * <tr><td> @subpage cxxomfort-installation "Installation" </td>
 *  <td> @subpage cxxomfort-behaviour "Configuration" </td>
 *  <td> @subpage cxxomfort-usage "Usage" </td>
 *  <th> @subpage cxxomfort-isr "Implementation Status" </th>
 * </tr>
 * </table>
 * 
 * 
 * <h2>Licensing Terms</h2>
................................................................................
#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 "strinv_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








|
|
|
|





|









|
|







 







|












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
..
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
 *  </td>
 * </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
 * </td></tr>
 * </table>
 * 
 *
 * <table>
 * <tr><th colspan="9"> Installation and Usage </th></tr>
 * <tr><td> <a href="http://ryan.gulix.cl/fossil.cgi/cxxomfort/wiki?name=Installation">Installation</a>  </td>
 *  <td> <a href="http://ryan.gulix.cl/fossil.cgi/cxxomfort/wiki?name=Configuration">Configuration</a> </td>
 *  <td> @subpage cxxomfort-usage "Usage" </td>
 *  <th> @subpage cxxomfort-isr "Implementation Status" </th>
 * </tr>
 * </table>
 * 
 * 
 * <h2>Licensing Terms</h2>
................................................................................
#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

Deleted cxxomfort/cxxomfort/docgen/install.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
/**
 * @file install.hpp
 * @page cxxomfort-installation "Installation"
 *
 * <h2>Installation</h2>
 * 
 * Quick and dirty install:
 * 
 * <ol>
 * <li>Get @b Fossil <br>:
 * * http://fossil-scm.org/
 * * Check your distribution's package manager.
 * </li>
 * <li>Clone the cxxomfort repo with <br><code>fossil clone http://ryan.gulix.cl/fossil.cgi/cxxomfort cxxomfort-release.fossil</code>
 * </li>
 * <li>Open the fossil repository with <br><code>fossil open cxxomfort-release.fossil</code>.
 * </li>
 * <li>Check dependencies and configurations for your compiler.
 * </li>
 * <li>Add <code>cxxomfort/cxxomfort</code> dir to compiler/project's search paths.
 * </li>
 * <li><code>\#include \<cxxomfort/cxxomfort.hpp\></code>.
 * </li>
 * </ol>
 * 
 * <h2>Compiler-Specific Setup</h2>
 * 
 * <h3>GCC 4.4-5.x</h3>
 * 
 * <strong>Note for C++03 mode only</strong>
 * 
 * @c cxxomfort relies on the #include paths for the @b "TR1" subset of 
 * facilities in C++03 being reachable as normal headers - that is, 
 * <code>\#include \<array\></code> rather than <code>\#include \<tr1/array\></code>.
 * However, due to how the TR1 headers are implemented in GCC it is not possible 
 * to simply add @c include/tr1 to the compiler/project's include path as this 
 * spews a number of errors related to implementation namespaces. 
 * 
 * Instead, you need to provide a set of forwarder headers of your own that 
 * explicitly invoke <code>#include <tr1/headername></code> but are invoked as 
 * <code>#include <headername></code> themselves. One such forwarder set is 
 * @c tr1_fwd , which you can just drop in your compiler search path 
 * (@strong before the cxxomfort Transparent Headers if you are using them).
 * 
 * @todo Provide a set of forwarder headers of our own.
 * 
 * <h3>Microsoft MSVC 2008 Express or similar</h3>
 * 
 * MSVC 2008 is missing out on some C and C++ headers, most notably 
 * @c stdint.h and @c inttypes.h . cxxomfort covers the absence of the 
 * former via @c pstdint.h , the "portable stdint", but for the latter you 
 * need to provide an implementation of your own, for example a copy of 
 * msinttypes' header.
 * 
 * (It is recommended to @strong not just drop the headers in your compiler's 
 * native headers path, as this will make your projects incompatible with 
 * other copies of MSVC 2008 that don't apply this path. Instead, add 
 * the header to your project's header paths.
 * 
 * 
 * <h3>MSVC 2010 Express, 2012 Express or similar</h3>
 * 
 * <h3>Clang 3.x</h3>
 * 
 * When compiling in C++03 mode, the same caveat as the one for C++03 
 * mentioned in the GCC section regarding @b TR1 applies.
 * 
 * 
 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































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

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
..
78
79
80
81
82
83
84
85
 * @brief Backports from C++11.
 * 
 * C++11 adds a large number of features such as variadic templates, @c constexpr , static asserts and much improved template support and metaprogramming.
 * 
 * A listing of some of the features backported:
 * 
 * * From core language: <code>#static_assert</code>, <code>#noexcept</code>, etc.
 * * From <code>\<cstddef\></code>: @c #nullptr , @c std::nullptr_t etc.
 * * From <code>\<cstdint\></code>: The header proper for C++03, and its utilities.
 * * From <code>\<algorithm\></code>: @c copy_if(), @c copy_n(), @c partition_copy(), @c minmax(), @c minmax_element(), @c is_all_of() , etc.
 * * 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 <code>\<iterator\></code>: Iterator accessors @c rbegin() , @c rend() .
 * * From <code>\<memory\></code>: @c addressof() , @c pointer_traits , @c allocator_traits , etc.
 * * From <code>\<numeric\></code>: @c iota() .
 * * From <code>\<random\></code>: @c shuffle_order_engine and @c knuth_b , <code>#uniform_int_distribution</code>, etc.
 * * From <code>\<string\></code>: @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 .
 */

................................................................................
 * @page cxx14-backports
 * @brief Backports from C++14.
 * 
 * C++14 adds a number of features regarding algorithms and function object support.
 * 
 * A listing of some of the features backported:
 * 
 * * From <code><algorithm></code>: @c equal() , @c mismatch() , etc.
 * * From <code><functional></code>: @link foo "Transparent Functors" @endlink .
 * * From <code><memory></code>: @c make_unique() .
 * * From <code><tuple></code>: Tuple @ref gettuple by type.
 * * From <code><utility></code>: @c exchange() , @ref integer_sequence , etc.
 * 
 * See also: @ref cxx11-backports @ref cxx17-backports .
 */

/**
................................................................................
 * A listing of some of the features backported:
 * 
 * * From <code>\<type_traits\></code>: @c endian .
 *
 * See also: @ref cxx17-backports .
 * 
 */








|

|


|
|
|
|
|







 







|

|







 







<
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
..
78
79
80
81
82
83
84

 * @brief Backports from C++11.
 * 
 * C++11 adds a large number of features such as variadic templates, @c constexpr , static asserts and much improved template support and metaprogramming.
 * 
 * A listing of some of the features backported:
 * 
 * * From core language: <code>#static_assert</code>, <code>#noexcept</code>, etc.
 * * From @link std0cstddef <code>\<cstddef\></code> @endlink : @c #nullptr , @c std::nullptr_t etc.
 * * From <code>\<cstdint\></code>: The header proper for C++03, and its utilities.
 * * From @link std0algorithm <code>\<algorithm\></code> @endlink : @c copy_if(), @c copy_n(), @c partition_copy(), @c minmax(), @c minmax_element(), @c is_all_of() , etc.
 * * 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 .
 */

................................................................................
 * @page cxx14-backports
 * @brief Backports from C++14.
 * 
 * C++14 adds a number of features regarding algorithms and function object support.
 * 
 * A listing of some of the features backported:
 * 
 * * From @link std0algorithm <code>\<algorithm\></code> @endlink : @c equal() , @c mismatch() , etc.
 * * From <code><functional></code>: @link foo "Transparent Functors" @endlink .
 * * From @link std0memory <code>\<memory\></code> @endlink : @c make_unique() .
 * * From <code><tuple></code>: Tuple @ref gettuple by type.
 * * From <code><utility></code>: @c exchange() , @ref integer_sequence , etc.
 * 
 * See also: @ref cxx11-backports @ref cxx17-backports .
 */

/**
................................................................................
 * A listing of some of the features backported:
 * 
 * * From <code>\<type_traits\></code>: @c endian .
 *
 * See also: @ref cxx17-backports .
 * 
 */

Changes to cxxomfort/cxxomfort/extras.hpp.

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* This header file includes the available, finalized 
 * extras features.
 * (Non-finalized features have to be added explicitly)
 */

#include "base.hpp"

#include "./extras/array_ref.hpp" // array_ref implementation (n3334)
#include "./extras/auto.hpp" // decltype(), auto emulation
#include "./extras/dynarray.hpp" // dynarray aka fixed_vector implementation
#include "./extras/foreach.hpp" // for (var: range) emulation
#include "./extras/localfn.hpp" // local functors in templated calls implementation

#endif








<


<
<



3
4
5
6
7
8
9

10
11


12
13
14
/* This header file includes the available, finalized 
 * extras features.
 * (Non-finalized features have to be added explicitly)
 */

#include "base.hpp"


#include "./extras/auto.hpp" // decltype(), auto emulation
#include "./extras/dynarray.hpp" // dynarray aka fixed_vector implementation



#endif

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

1
2
3
4
5
6
7
8
9
10
11
#ifndef CXXOMFORT_IMPL_CONDITIONAL_HPP
#define CXXOMFORT_IMPL_CONDITIONAL_HPP
/**
 * @file
 * @brief Implementation of std::enable_if , std::conditional
 *
 */

#include "../config.hpp"

#if (CXXOMFORT_CXX_STD < 2011)



|







1
2
3
4
5
6
7
8
9
10
11
#ifndef CXXOMFORT_IMPL_CONDITIONAL_HPP
#define CXXOMFORT_IMPL_CONDITIONAL_HPP
/**
 * @file cxxomfort/type_traits.hpp
 * @brief Implementation of std::enable_if , std::conditional
 *
 */

#include "../config.hpp"

#if (CXXOMFORT_CXX_STD < 2011)

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

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

24
25
26
27
28
29
30
31
32
33
34
35
36

37
38
39
40
41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
#ifndef CXXOMFORT_IMPL_IS_OF_HPP
#define CXXOMFORT_IMPL_IS_OF_HPP
/**
 * @file
 */

#include <cxxomfort/config.hpp>
#define CXXOMFORT_IMPLEMENTS_n2569 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_is_all_of CXXOMFORT_IMPLEMENTS_n2569

namespace cxxomfort {
................................................................................
 * @sa https://wg21.link/n2569
 * @{
 */

/**
 * @brief Returns @c true  if all elements in sequence <var>[ini,fin)</var> comply with predicate @p p .
 * @param p A predicate (a function that returns @c true or @c false ).

 * 
 */
template< class Iterator, class Predicate >
bool all_of(Iterator ini, Iterator fin, Predicate p) {
    for (; ini != fin; ++ini) {
        if (!p(*ini)) return false;
    }
    return true;
}

/**
 * @brief Returns @c true  if at least one element in sequence <var>[ini,fin)</var> comply with predicate @p p .
 * @param p A predicate (a function that returns @c true or @c false ).

 */
template< class Iterator, class Predicate >
bool any_of(Iterator ini, Iterator fin, Predicate p) {
    for (; ini != fin; ++ini) {
        if (p(*ini)) return true;
    }
    return true;
}

/**
 * @brief Returns @c true  if no elements in sequence <var>[ini,fin)</var> comply with predicate @p p .
 * @param p A predicate (a function that returns @c true or @c false ).

 */
template< class Iterator, class Predicate >
bool none_of(Iterator ini, Iterator fin, Predicate p) {
    for (; ini != fin; ++ini) {
        if (p(*ini)) return false;
    }
    return true;



|







 







>













>












>







1
2
3
4
5
6
7
8
9
10
11
..
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef CXXOMFORT_IMPL_IS_OF_HPP
#define CXXOMFORT_IMPL_IS_OF_HPP
/**
 * @file cxxomfort/algorithm.hpp
 */

#include <cxxomfort/config.hpp>
#define CXXOMFORT_IMPLEMENTS_n2569 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_is_all_of CXXOMFORT_IMPLEMENTS_n2569

namespace cxxomfort {
................................................................................
 * @sa https://wg21.link/n2569
 * @{
 */

/**
 * @brief Returns @c true  if all elements in sequence <var>[ini,fin)</var> comply with predicate @p p .
 * @param p A predicate (a function that returns @c true or @c false ).
 * @xrefitem std0algorithm "<algorithm> backports" ""
 * 
 */
template< class Iterator, class Predicate >
bool all_of(Iterator ini, Iterator fin, Predicate p) {
    for (; ini != fin; ++ini) {
        if (!p(*ini)) return false;
    }
    return true;
}

/**
 * @brief Returns @c true  if at least one element in sequence <var>[ini,fin)</var> comply with predicate @p p .
 * @param p A predicate (a function that returns @c true or @c false ).
 * @xrefitem std0algorithm "<algorithm> backports" ""
 */
template< class Iterator, class Predicate >
bool any_of(Iterator ini, Iterator fin, Predicate p) {
    for (; ini != fin; ++ini) {
        if (p(*ini)) return true;
    }
    return true;
}

/**
 * @brief Returns @c true  if no elements in sequence <var>[ini,fin)</var> comply with predicate @p p .
 * @param p A predicate (a function that returns @c true or @c false ).
 * @xrefitem std0algorithm "<algorithm> backports" ""
 */
template< class Iterator, class Predicate >
bool none_of(Iterator ini, Iterator fin, Predicate p) {
    for (; ini != fin; ++ini) {
        if (p(*ini)) return false;
    }
    return true;

Changes to cxxomfort/cxxomfort/impl/11-minmax.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
..
33
34
35
36
37
38
39

40
41
42
43
44
45
46
#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>

namespace cxxomfort {
namespace cxxostd {

/**
 * @ingroup cxx11-backports
 * @xrefitem std0algorithm "" ""
 * @{
 */


//! return a <code>pair(min,max)</code> from two arguments and a comparator @a Less .



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

 * @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
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
..
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>

namespace cxxomfort {
namespace cxxostd {

/**
 * @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);
 

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

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
31
32
33
34
35
36
37

38


39
40
41
42
43
44
45
..
64
65
66
67
68
69
70




71
72
73
74
75
76
77
namespace cxxomfort {
namespace cxxostd {

/**
 * @brief Returns true if range [iniA,finA] (with internally calculated finA) 
 * is a permutation of range [ini1,fin1).
 * @ingroup cxx11-backports
 * @xrefitem std:algorithm "<algorithm>" ""
 * Source: cppreference.com
 * **/
template <typename It1, typename ItA>
bool is_permutation (It1 ini1, It1 fin1, ItA iniA) {
    using namespace std;
    // skip common prefix
    pair<It1&,ItA&>(ini1,iniA) = mismatch(ini1,fin1,iniA);
................................................................................
            typename iterator_traits<It1>::difference_type q = count(i,fin1,*i);
            if (d == 0 || q != d) return false;
        }
    }
    return true;
}


// next_permutation


template<typename BidirIt, typename Compare>
bool next_permutation (BidirIt ini, BidirIt fin, Compare Less) {
    if (ini == fin) return false;
    BidirIt i = fin;
    if (ini == --i) return false;
 
    while (true) {
................................................................................
bool next_permutation (BidirIt ini, BidirIt fin) {
    std::less<typename std::iterator_traits<BidirIt>::value_type> less;
    return next_permutation(ini, fin, less);
}

// prev_permutation





template<typename BidirIt, typename Compare>
bool prev_permutation (BidirIt ini, BidirIt fin, Compare less) {
    if (ini == fin) return false;
    BidirIt i = fin;
    if (ini == --i) return false;
 
    while (true) {







|







 







>
|
>
>







 







>
>
>
>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
..
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
namespace cxxomfort {
namespace cxxostd {

/**
 * @brief Returns true if range [iniA,finA] (with internally calculated finA) 
 * is a permutation of range [ini1,fin1).
 * @ingroup cxx11-backports
 * @xrefitem std:algorithm "" ""
 * Source: cppreference.com
 * **/
template <typename It1, typename ItA>
bool is_permutation (It1 ini1, It1 fin1, ItA iniA) {
    using namespace std;
    // skip common prefix
    pair<It1&,ItA&>(ini1,iniA) = mismatch(ini1,fin1,iniA);
................................................................................
            typename iterator_traits<It1>::difference_type q = count(i,fin1,*i);
            if (d == 0 || q != d) return false;
        }
    }
    return true;
}

/**
 * Shuffles the sequence to become the next_permutation
 * @xrefitem std0algorithm "<algorithm> backports" ""
 * */
template<typename BidirIt, typename Compare>
bool next_permutation (BidirIt ini, BidirIt fin, Compare Less) {
    if (ini == fin) return false;
    BidirIt i = fin;
    if (ini == --i) return false;
 
    while (true) {
................................................................................
bool next_permutation (BidirIt ini, BidirIt fin) {
    std::less<typename std::iterator_traits<BidirIt>::value_type> less;
    return next_permutation(ini, fin, less);
}

// prev_permutation

/**
 * Shuffles the sequence to become the previous permutation
 * @xrefitem std0algorithm "<algorithm> backports" ""
 * */
template<typename BidirIt, typename Compare>
bool prev_permutation (BidirIt ini, BidirIt fin, Compare less) {
    if (ini == fin) return false;
    BidirIt i = fin;
    if (ini == --i) return false;
 
    while (true) {

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

68
69
70
71
72
73
74
75
76
77
78
79
80
81
    }

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

CXXO_GENERATE_RELATIONALS(type_index);

} }

#endif // 









|






68
69
70
71
72
73
74
75
76
77
78
79
80
81
    }

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

CXXO_GENERATE_RELATIONALS0(type_index);

} }

#endif // 


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

12
13
14
15
16
17
18


19
20
21
22
23


24
25
26
27
28
29
30
//#define CXXOMFORT_IMPLEMENTS_nonmember_size CXXOMFORT_IMPLEMENTS_n4017

namespace cxxomfort { namespace cxxostd { namespace iterator {

/**
 * @fn cbegin
 * @brief Returns an iterator to the beginning of a given container or sequence.


 * */

/**
 * @fn cend
 * @brief Returns an iterator to the end of a given container or sequence.


 * */

#if (CXXOMFORT_CXX_STD >= 2011)

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







>
>





>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//#define CXXOMFORT_IMPLEMENTS_nonmember_size CXXOMFORT_IMPLEMENTS_n4017

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)) {

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

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
namespace cxxomfort {
namespace cxxostd {

/**
 * @brief Clamps a value.
 * @return An altered value from @a val to fit into the open interval (@a lo , @a hi ).
 * @ingroup cxx17-backports
 * @xrefitem std:algorithm "<algorithm>" ""
 * @sa http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4536.html
 */
template<class T, class Compare>
CXXO_CONSTEXPR
T const& clamp ( T const& val, T const& lo, T const& hi, Compare comp) {
    return assert( !comp(hi, lo) ),
        comp(val, lo) ? lo : comp(hi, val) ? hi : val;
}

//! @overload clamp

template<class T>
CXXO_CONSTEXPR
T const& clamp ( T const& val, T const& lo, T const& hi) {
    return clamp (val, lo, hi, std::less<T>() );
}

} // algorithm







|










>







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
namespace cxxomfort {
namespace cxxostd {

/**
 * @brief Clamps a value.
 * @return An altered value from @a val to fit into the open interval (@a lo , @a hi ).
 * @ingroup cxx17-backports
 * @xrefitem std0algorithm "<algorithm> backports" ""
 * @sa http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4536.html
 */
template<class T, class Compare>
CXXO_CONSTEXPR
T const& clamp ( T const& val, T const& lo, T const& hi, Compare comp) {
    return assert( !comp(hi, lo) ),
        comp(val, lo) ? lo : comp(hi, val) ? hi : val;
}

//! @overload clamp
//! @xrefitem std0algorithm "<algorithm> backports" ""
template<class T>
CXXO_CONSTEXPR
T const& clamp ( T const& val, T const& lo, T const& hi) {
    return clamp (val, lo, hi, std::less<T>() );
}

} // algorithm

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

65
66
67
68
69
70
71





72
73
74
75
76
77
78
    return N;
}

/*
 * data, from c++17
 */






template <typename C>
#if (CXXOMFORT_CXX_STD < 2011)
typename C::const_pointer 
#else
decltype(std::declval<C const>().data())
#endif
data (C const& c) {







>
>
>
>
>







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
    return N;
}

/*
 * data, from c++17
 */

/**
 * @brief provides access to an internal "<code>.data()</code>" member.
 * @ingroup cxx17-backports
 * @xrefitem std0iterator
 * */
template <typename C>
#if (CXXOMFORT_CXX_STD < 2011)
typename C::const_pointer 
#else
decltype(std::declval<C const>().data())
#endif
data (C const& c) {

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

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
..
29
30
31
32
33
34
35



36
37
38
39
40
41
42
..
86
87
88
89
90
91
92










93
94
95
96
97
98
99
...
135
136
137
138
139
140
141
















142
143
144
145
146
147
148
#define CXXOMFORT_IMPL_STRING_VIEW_HPP
/**
 * @file
 * @brief Implementation for std::string_view and allies
 *
 */

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

namespace cxxomfort { namespace cxxostd {
................................................................................
    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;



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











    
};

// 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>
................................................................................
(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();
}

















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







<







 







>
>
>







 







>
>
>
>
>
>
>
>
>
>







 







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







2
3
4
5
6
7
8

9
10
11
12
13
14
15
..
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
..
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
...
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
#define CXXOMFORT_IMPL_STRING_VIEW_HPP
/**
 * @file
 * @brief Implementation for std::string_view and allies
 *
 */


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

namespace cxxomfort { namespace cxxostd {
................................................................................
    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,
................................................................................
    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>
................................................................................
(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;

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
19
20
21
22
23
#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 {



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

#if (CXXOMFORT_CXX_STD >= 2011)
template <> struct is_character_type<char16_t> : std::true_type {};
template <> struct is_character_type<char32_t> : std::true_type {};
#endif

}}}

#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
#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)
template <> struct is_character_type<char16_t> : ct::true_type {};
template <> struct is_character_type<char32_t> : ct::true_type {};
#endif

}}}

#endif

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

221
222
223
224
225
226
227
228
229
230
231
232

233





234
235
236
237





238
239
240
241
242
243
244
array_ref<T const> carrayref(T*, size_t);
//! Creates an array_ref const view from a non-const one.
template <typename T>
array_ref<T const> carrayref(array_ref<T> const&);


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


template <typename T>





array_ref<T> array_ref<T>::without_front () const {
    pointer const newbegin = (len_>1) ? ptr_+1 : ptr_;
    size_type const newlen= (len_>1) ? len_-1 : len_;
    return array_ref(newbegin,newlen);





}

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








|
|



>

>
>
>
>
>
|
|
|

>
>
>
>
>







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
array_ref<T const> carrayref(T*, size_t);
//! Creates an array_ref const view from a non-const one.
template <typename T>
array_ref<T const> carrayref(array_ref<T> const&);


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


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

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

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

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

Changes to cxxomfort/cxxomfort/impl/p1227r0-ssize.hpp.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// see: https://wg21.link/p1048r0

namespace cxxomfort { namespace impl {

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

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







|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 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;
}

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


















#ifndef CXXOMFORT_ITERATOR_HPP
#define CXXOMFORT_ITERATOR_HPP
/**
 * @file
 * @brief Implementations and backports tied to <code>\<iterator\></code>.
 * 
 * Interfaces defined in this file:
 * 
 * * @c begin() , @c end() accessors.
 * * @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>
 *
 */


#include "base.hpp"
#include CXXO_INCLUDE_SYS(iterator)
#include "base/iterator.hpp"






// make_reverse_iterator
//#include 
// globals size, data, empty from C++17
#include "impl/14-iterator_access.hpp" // cbegin, cend
#include "impl/17-iterator_access.hpp" // size, data, empty


#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
#ifndef CXXOMFORT_ITERATOR_HPP
#define CXXOMFORT_ITERATOR_HPP
/**
 * @file
 * @brief Implementations and backports tied to <code>\<iterator\></code>.
 * @ingroup std0iterator 










 *
 */


#include "base.hpp"
#include CXXO_INCLUDE_SYS(iterator)
#include "base/iterator.hpp"

namespace cxxomfort {
namespace cxxostd {
}
}

// make_reverse_iterator
//#include 
// globals size, data, empty from C++17
#include "impl/14-iterator_access.hpp" // cbegin, cend
#include "impl/17-iterator_access.hpp" // size, data, empty


#endif

/**
 * @page std0iterator
 * @brief Backports from <iterator>
 * 
 * Interfaces defined in this section:
 * 
 * * @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>
 * 
 * */

Changes to cxxomfort/cxxomfort/library.hpp.

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
 * 
 * The @b cxxomfort library does not only implement backports to C++ features; it also brings its own set of features to supplement various functionality that, for example, can not be backported to previous version in a meaningful fashion. 
 * 
 * Including the <code><cxxomfort/library.hpp></code> header and invoking the <code>cxxomfort::</code> namespace makes these features available.
 * 
 * Implementations included from here:
 * 
 * * @subpage library/algorithm.hpp "Supplements for <algorithm>"
 * * @subpage library/functional.hpp "Supplements for <functional>"
 * * @subpage library/iterator.hpp "Supplements for <iterator>"
 * * @subpage library/numeric.hpp "Supplements for <numeric>"
 * * @subpage library/random.hpp "Supplements for <random>"
 * * @subpage library/string.hpp "Supplements for <string>"
 * * @subpage library/tuple.hpp "Supplements for <tuple>"
 * * @subpage library/type_traits.hpp "Supplements for <type_traits>"

 * 
 * * @subpage cxxo-FOREACH "FOREACH (foreach loop)"
 * * @subpage cxxo-i12n "I12N (Container Initialization)"
 * * @subpage cxxo-fundamental "Fundamental"
 * * @subpage cxxo-sequences "Sequence Utilities"
 *   * @link libarrayref @c array_ref @endlink 
 *   * @ref @c libfixedvector 
 * * @subpage cxxo-typesafe_enum "Typesafe @c enum "
 * 
 * * @ref cxxo-pair03 "Pair"
 * * @ref cxxo-clstring "clString"
 * * @ref cxxo-type_name "type_name"
 * 
 */



#endif







|
|
|
|
|
|
|
|
>





|
|











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
 * 
 * The @b cxxomfort library does not only implement backports to C++ features; it also brings its own set of features to supplement various functionality that, for example, can not be backported to previous version in a meaningful fashion. 
 * 
 * Including the <code><cxxomfort/library.hpp></code> header and invoking the <code>cxxomfort::</code> namespace makes these features available.
 * 
 * Implementations included from here:
 * 
 * * @subpage cxxo-sup-algorithm "Supplements for <algorithm>"
 * * @subpage cxxo-sup-functional "Supplements for <functional>"
 * * @subpage cxxo-sup-iterator "Supplements for <iterator>"
 * * @subpage cxxo-sup-numeric "Supplements for <numeric>"
 * * @subpage cxxo-sup-random "Supplements for <random>"
 * * @subpage cxxo-sup-string "Supplements for <string>"
 * * @subpage cxxo-sup-tuple "Supplements for <tuple>"
 * * @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

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

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41








42
43
44
45
46
47
48
..
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
...
100
101
102
103
104
105
106

107
108
109
110
111
112
113
...
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
...
256
257
258
259
260
261
262

263

264



265





266























#include <cxxomfort/base.hpp>
#include <algorithm>
#include <iterator>

/**
 * @file cxxomfort/library/algorithm.hpp
 * @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 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: @link algorithm.hpp "<algorithm>" @endlink .
 * 
 */

namespace cxxomfort { namespace library { namespace algorithm {

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

// copy_leftmost_n is simply copy_n








template <typename Iter1, typename Integer, typename Iter2>
Iter2 copy_leftmost_n (Iter1 ini1, Iter1 /*fin1*/, Integer n, Iter2 ini2) {
    return copy_n(ini1,n,ini2);
}

namespace detail {

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

} // detail

/** 
 * @brief Like @c copy_n  except it copies the @e rightmost @a n elements from the sequence.
 * @return Iterator pointing to the end of the copied sequence at the destination.




 */
template <typename It1, typename Integer, typename It2>
It2 copy_rightmost_n (It1 ini1, It1 fin1, Integer n, It2 ini2) {
    const typename std::iterator_traits<It1>::iterator_category cat;
    return detail::copy_rightmost_n(ini1, fin1, n, ini2, cat);
}


/** 
 * @brief Finds a pair of elements that are out of place (ie.: the second one is "less" than the first).
 * @return Iterator pointing to the first such element, or @a fin if none.

 * 
 * See also: @c fix_inversion().
 * 
**/
template <typename Iter, typename Less> inline
Iter find_inversion (Iter ini, Iter fin, Less m) {
    for (; ini != fin; ++ini) {
................................................................................
    }
    return ini;
}

/** 
 * @brief Fixes a pair of misplaced elements where the second one is "less" than the first.
 * @return Iterator pointing to the first such element, or @a fin if none.

 * 
 * See also: @c find_inversion().
 * 
**/
template <typename Iter, typename Less> inline
Iter fix_inversion (Iter ini, Iter fin, Less m) {
    Iter inv = find_inversion(ini,fin,m);
................................................................................
    }
    return ret;
}



/**
 * @fn transform_inplace
 * @brief Transform elements in the range in-place via the transformation @a tf .
 * @param tf A transformation of the form <code>TF(value_type) → value_type</code>.
 * @return The @e end iterator of the sequence.

 */
template <typename FIter, typename TF>
FIter transform_inplace (FIter ini, FIter fin, TF tf) {
    for (; ini != fin; ++ini) {
        *ini= tf(*ini);
    }
    return ini;
................................................................................
}

/**
 * @brief Transform elements in the range conditionally.
 * @param tf A transformation of the form <code>TF(*FIter) -> *FIter</code>.
 * @param p a predicate to decide if the elements need transformation.
 * @return The @e end iterator of the sequence.

 */
template <typename FIter, typename TF, typename P>
FIter transform_inplace_if (FIter ini, FIter fin, TF tf, P p) {
    for (; ini != fin; ++ini) {
        if (p(*ini)) *ini= tf(*ini);
    }
    return ini;
}

/**
 * @brief Transform elements up to n times
 * @param tf A transformation of the form <code>TF(*FIter) -> *FIter</code>.

 */
template <typename IIterator, typename OIterator, typename TF, typename Integer>
inline OIterator transform_n (IIterator ini, Integer n, OIterator dest, TF tf) {
    for (Integer i(0); i < n; ++i) { *dest= tf(*ini); }
    return dest;
}

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


/**
 * @}
 */

} // .algorithm::

}

}









#endif






























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











>
>
>
>
>
>
>
>







 







>
>
>
>











>







 







>







 







<



>







 







>












>







 







>
|
>
|
>
>
>
|
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
..
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
..
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
...
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
...
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
#include <cxxomfort/base.hpp>
#include <algorithm>
#include <iterator>

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



















 * 
 */

namespace cxxomfort { namespace library { namespace algorithm {

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

// copy_leftmost_n is simply copy_n

/**
 * @brief Like @c copy_n in that it copues @e leftmost @a ("starting") n elements from the sequence.
 * @xrefitem cxxo-sup-algorithm "cxxo-sup-algorithm" "Copying"
 * 
 * See also: copy_rightmost_n() .
 * 
 * */
template <typename Iter1, typename Integer, typename Iter2>
Iter2 copy_leftmost_n (Iter1 ini1, Iter1 /*fin1*/, Integer n, Iter2 ini2) {
    return copy_n(ini1,n,ini2);
}

namespace detail {

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

} // detail

/** 
 * @brief Like @c copy_n  except it copies the @e rightmost @a n elements from the sequence.
 * @return Iterator pointing to the end of the copied sequence at the destination.
 * @xrefitem cxxo-sup-algorithm "cxxo-sup-algorithm" "Copying"
 * 
 * See also: copy_leftmost_n() .
 * 
 */
template <typename It1, typename Integer, typename It2>
It2 copy_rightmost_n (It1 ini1, It1 fin1, Integer n, It2 ini2) {
    const typename std::iterator_traits<It1>::iterator_category cat;
    return detail::copy_rightmost_n(ini1, fin1, n, ini2, cat);
}


/** 
 * @brief Finds a pair of elements that are out of place (ie.: the second one is "less" than the first).
 * @return Iterator pointing to the first such element, or @a fin if none.
 * @xrefitem cxxo-sup-algorithm "" "Sorting"
 * 
 * See also: @c fix_inversion().
 * 
**/
template <typename Iter, typename Less> inline
Iter find_inversion (Iter ini, Iter fin, Less m) {
    for (; ini != fin; ++ini) {
................................................................................
    }
    return ini;
}

/** 
 * @brief Fixes a pair of misplaced elements where the second one is "less" than the first.
 * @return Iterator pointing to the first such element, or @a fin if none.
 * @xrefitem cxxo-sup-algorithm "" "Sorting"
 * 
 * See also: @c find_inversion().
 * 
**/
template <typename Iter, typename Less> inline
Iter fix_inversion (Iter ini, Iter fin, Less m) {
    Iter inv = find_inversion(ini,fin,m);
................................................................................
    }
    return ret;
}



/**

 * @brief Transform elements in the range in-place via the transformation @a tf .
 * @param tf A transformation of the form <code>TF(value_type) → value_type</code>.
 * @return The @e end iterator of the sequence.
 * @xrefitem cxxo-sup-algorithm "" "Transforms"
 */
template <typename FIter, typename TF>
FIter transform_inplace (FIter ini, FIter fin, TF tf) {
    for (; ini != fin; ++ini) {
        *ini= tf(*ini);
    }
    return ini;
................................................................................
}

/**
 * @brief Transform elements in the range conditionally.
 * @param tf A transformation of the form <code>TF(*FIter) -> *FIter</code>.
 * @param p a predicate to decide if the elements need transformation.
 * @return The @e end iterator of the sequence.
 * @xrefitem cxxo-sup-algorithm "" ""Transforms"
 */
template <typename FIter, typename TF, typename P>
FIter transform_inplace_if (FIter ini, FIter fin, TF tf, P p) {
    for (; ini != fin; ++ini) {
        if (p(*ini)) *ini= tf(*ini);
    }
    return ini;
}

/**
 * @brief Transform elements up to n times
 * @param tf A transformation of the form <code>TF(*FIter) -> *FIter</code>.
 * @xrefitem cxxo-sup-algorithm "" ""Transforms"
 */
template <typename IIterator, typename OIterator, typename TF, typename Integer>
inline OIterator transform_n (IIterator ini, Integer n, OIterator dest, TF tf) {
    for (Integer i(0); i < n; ++i) { *dest= tf(*ini); }
    return dest;
}

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


/**
 * @}
 */

} // .algorithm::
} }

#endif

/**
 * @page cxxo-sup-algorithm
 * @brief cxxomfort Supplementals for <algorithm>
 * 
 * @code
 * #include <cxxomfort/library/algorithm.hpp>
 * 
 * namespace algorithm2 = cxxomfort::library::algorithm;
 * 
 * @endcode
 * 
 * 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  .
 * 
 * */

Changes to cxxomfort/cxxomfort/library/fixed_vector.hpp.

60
61
62
63
64
65
66







67
68
69
70
71
72
73
 * * 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.







 *
 */
template <typename T, typename Alloc=std::allocator<T> > class fixed_vector {
    typedef fixed_vector<T>  this_type;
    private:
    typedef Alloc        alloc_t;
    typedef ::std::allocator_traits<Alloc>     alloc_traits;







>
>
>
>
>
>
>







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
 * * 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;
    typedef ::std::allocator_traits<Alloc>     alloc_traits;

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

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 * @file
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 * @brief Implements <code>= {...}</code>-like initialization semantics for containers.
 */


/**
 * @page library: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:
 * 







|







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 * @file
 * @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:
 * 

Deleted cxxomfort/cxxomfort/library/iteratorfn.hpp.

1
2
3
#include <cxxomfort/config.hpp>
#pragma message CXXO_WARNING("this header is deprecated. New header is <cxxomfort/library/iterator.hpp>")
#include <cxxomfort/library/iterator.hpp>
<
<
<






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

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
...
245
246
247
248
249
250
251


































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

/**
 * @file cxxomfort/library/numeric.hpp
 * 
 * This file provides supplementary features for the set of 
 * algorithms present in <code><numeric></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 accumulate_left() , @c accumulate_right() , @c accumulate_associative()
 * * @c static_abs 
 * * @c static_min , @c static_max , @link cxxomfort::library::numeric::static_minmax static_minmax @endlink
 * * @c #static_gcd , @c #static_lcm 
 * * @ref @c static_sum
 * * @c to_signed() , @c to_unsigned() 
 * 
 * 
 * 
 * All interfaces are defined in the namespace <code>cxxomfort::library::numeric::</code>.
 * 
 */


#include "../impl/to_signed.hpp"

namespace cxxomfort { namespace library {
namespace numeric {

using cxxomfort::impl::numeric::to_signed;
using cxxomfort::impl::numeric::to_unsigned;



// integral constant 
// (reimplemented here for a simpler interface and to avoid a dependency on probably incomplete type_traits)

template <typename T, T v>
struct T_constant {
................................................................................
} // numeric::
} // library::
}



#endif









































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










>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
...
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
#include <cxxomfort/base.hpp>
#include <numeric>
#include <iterator>

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


















 */


#include "../impl/to_signed.hpp"

namespace cxxomfort { namespace library {
namespace numeric {

using cxxomfort::impl::numeric::to_signed;
using cxxomfort::impl::numeric::to_unsigned;
// using cxxomfort::impl::numeric::to_enclosing_integer;


// integral constant 
// (reimplemented here for a simpler interface and to avoid a dependency on probably incomplete type_traits)

template <typename T, T v>
struct T_constant {
................................................................................
} // numeric::
} // library::
}



#endif

/**
 * @page cxxo-sup-numeric
 * @brief cxxomfort Supplementals for <numeric>
 * 
 * @code
 * #include <cxxomfort/library/numeric.hpp>
 * 
 * namespace numeric2 = cxxomfort::library::numeric;
 * 
 * @endcode

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

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

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
...
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
#include <type_traits>
#include "../util/type_traits.hpp"
#include "../library/i12n.hpp"
#include "../impl/17-bool_constant.hpp"
#include "../using.hpp"

/**
 * @page Sequence Helpers
 * @ingroup independent-features
 * 
 * Interfaces defined in this file:
 * 
 * * @c is_std_array
 * * @c is_sequence_container
 * * @c is_indexable_like_array
 * * @c is_iterator
................................................................................
struct is_maybe_contiguous_sequence
: public std::bool_constant<
 (false==std::is_fundamental<S>::value) && registered_contiguous<S>::value
> {
};

} // cxxomfort

// make_array
//#include "impl/n4031_make_array.hpp"



#endif








|
|







 







<
<
<
<




12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
...
316
317
318
319
320
321
322




323
324
325
326
#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:
 * 
 * * @c is_std_array
 * * @c is_sequence_container
 * * @c is_indexable_like_array
 * * @c is_iterator
................................................................................
struct is_maybe_contiguous_sequence
: public std::bool_constant<
 (false==std::is_fundamental<S>::value) && registered_contiguous<S>::value
> {
};

} // cxxomfort






#endif

Changes to cxxomfort/cxxomfort/library/string.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
...
347
348
349
350
351
352
353































#ifndef CXXOMFORT_CXXO_STRING_SUPP_HPP
#define CXXOMFORT_CXXO_STRING_SUPP_HPP
/**
 * @file cxxomfort/library/string.hpp
 *
 * This file provides supplementary features to the ones
 * present in <code><string></code> that are
 * specific to cxxomfort.
 *
 * * @c chr() , @c utf8chr()  - Conversion from integer/codepoint to character.
 * * @c codepoint() - Conversion from character to integer/codepoint.
 * * @c string_cast() - convert between string representations; overload point.
 * * @c join() - Joins elements into a string.
 * * @c split_to() , @c split_to_n() - Split elements from a string.
 * * @c explode() - Splits elements from a string into a std::vector.
 * * @c l_trim() , @c r_trim() , @c trim()  - Removes elements from a string's ends.
 * * @c string_replace - Replace substrings in a string.
 * * @c string_pad - Pad a string to length.
 * * @c to_string() - Variadic for of to_string.
 *
 *
 * All interfaces are defined in the namespace <code>cxxomfort::algorithm::</code>.
 *
 */

#include <cxxomfort/base.hpp>
#include <cxxomfort/string.hpp>
#include <cstring>
#include <string>
................................................................................


}} // cxxomfort::library



#endif



































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







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5

















6
7
8
9
10
11
12
...
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
#ifndef CXXOMFORT_CXXO_STRING_SUPP_HPP
#define CXXOMFORT_CXXO_STRING_SUPP_HPP
/**
 * @file cxxomfort/library/string.hpp
 * @xrefitem cxxo-sup-string "<string>" "Header"

















 *
 */

#include <cxxomfort/base.hpp>
#include <cxxomfort/string.hpp>
#include <cstring>
#include <string>
................................................................................


}} // cxxomfort::library



#endif

/**
 * @page cxxo-sup-string
 * @brief cxxomfort Supplementals for <string> 
 * 
 * @code
 * #include <cxxomfort/library/string.hpp>
 * 
 * namespace string2 = cxxomfort::library::string;
 * 
 * @endcode
 *
 * This section provides supplementary features to the ones
 * present in <code><string></code> that are
 * specific to cxxomfort.
 *
 * * @c chr() , @c utf8chr()  - Conversion from integer/codepoint to character.
 * * @c codepoint() - Conversion from character to integer/codepoint.
 * * @c string_cast() - convert between string representations; overload point.
 * * @c join() - Joins elements into a string.
 * * @c split_to() , @c split_to_n() - Split elements from a string.
 * * @c explode() - Splits elements from a string into a std::vector.
 * * @c l_trim() , @c r_trim() , @c trim()  - Removes elements from a string's ends.
 * * @c string_replace - Replace substrings in a string.
 * * @c string_pad - Pad a string to length.
 * * @c to_string() - Variadic for of to_string.
 *
 *
 * All interfaces are defined in the namespace <code>cxxomfort::algorithm::</code>.
 *
 * */

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

55
56
57
58
59
60
61





62
63
64
65
66

































//

const struct none_t {
    CXXO_CONSTEXPR operator std::nullptr_t () const CXXO_NOEXCEPTNOTHROW { return nullptr; }
} none = {};








}
}}

#endif








































>
>
>
>
>





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

const struct none_t {
    CXXO_CONSTEXPR operator std::nullptr_t () const CXXO_NOEXCEPTNOTHROW { return nullptr; }
} none = {};


//
// typed null
//



}
}}

#endif

/**
 * @page cxxo-sup-utility
 * @brief cxxomfort Supplementals for <utility>
 * 
 * @code
 * #include <cxxomfort/library/utility.hpp>
 * 
 * namespace utility2 = cxxomfort::library::urility;
 * 
 * @endcode

 * 
 * This file provides supplementary features for the set of 
 * facilities present in <code><utility></code> that are 
 * specific to cxxomfort.
 * 
 * Interfaces defined here:
 * 
 * * @c v_in_place_type(), @c v_in_place_index() .
 * * @c #strict_type .
 * 
 * TBA:
 * 
 * * @c null_device() .
 * 
 * 
 * All interfaces are defined in the namespace <code>cxxomfort::library::utility::</code>.
 * 
 * See also: @ref std0utility .
 * 
 */

Changes to cxxomfort/cxxomfort/memory.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
...
176
177
178
179
180
181
182


















#ifndef CXXOMFORT_MEMORY_HPP
#define CXXOMFORT_MEMORY_HPP
/**
 * @file
 * @brief Implementations and additions tied to Standard Header <memory>.
 *
 * Interfaces defined in this file:
 *
 * * @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>.
 *
 */

#include "config.hpp"
#include "base/alignof.hpp"
#include CXXO_INCLUDE_SYS(memory)

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







/* alignas, aligned_storage */
#if ((CXXOMFORT_CXX_STD < 2011) && (CXXO_COMPILER_SUPPORT_alignment_tools==0))

//
// alignas
................................................................................
        }
    };
CXXO_CLOSE_STDTR1() // } /* tr1 */ }
    #endif
#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
...
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
#ifndef CXXOMFORT_MEMORY_HPP
#define CXXOMFORT_MEMORY_HPP
/**
 * @file
 * @brief Implementations and additions tied to Standard Header <memory>.
 * @xrefitem std0memory "<memory>" ""










 *
 */

#include "config.hpp"
#include "base/alignof.hpp"
#include CXXO_INCLUDE_SYS(memory)

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

namespace cxxomfort {
namespace cxxostd {
}
}


/* alignas, aligned_storage */
#if ((CXXOMFORT_CXX_STD < 2011) && (CXXO_COMPILER_SUPPORT_alignment_tools==0))

//
// alignas
................................................................................
        }
    };
CXXO_CLOSE_STDTR1() // } /* tr1 */ }
    #endif
#endif

#endif // file

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

Changes to cxxomfort/cxxomfort/numeric.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
..
91
92
93
94
95
96
97















#ifndef CXXOMFORT_NUMERIC_HPP
#define CXXOMFORT_NUMERIC_HPP
/**
 * @file
 * @brief Implementations and backports tied to <code><numeric></code>.
 * 
 * Interfaces defined in this file:
 * 
 * * @c iota() (C++11)
 * * @c gcd() , @c lcm() (C++17)
 * 
 * See also: @link algorithm.hpp "<algorithm>" @endlink , @ref cxxo-sup-numeric (supplemental), 
 * <a href="https://en.cppreference.com/w/cpp/header/numeric">\<numeric\> \@cppreference</a>.
 */


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

................................................................................
template <typename FwIt, typename Integer, typename T>
FwIt iota_n (FwIt ini, Integer n, T i0) {
    while (n-->0) { *ini= i0; ++ini; ++i0; }
    return ini;
}


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

namespace cxxomfort {
namespace cxxostd {

/**
 * @brief Calculates the greatest common divisor.
 * @ingroup cxx17-backports
 * @sa lcm
 */
template <typename IM, typename IN>
................................................................................
        using ::cxxomfort::cxxostd::gcd;
        using ::cxxomfort::cxxostd::lcm;
    }
    #endif
#endif // no std using

#endif





















<
<
<
<
<
<
<







 







<
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6







7
8
9
10
11
12
13
..
28
29
30
31
32
33
34





35
36
37
38
39
40
41
..
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef CXXOMFORT_NUMERIC_HPP
#define CXXOMFORT_NUMERIC_HPP
/**
 * @file
 * @brief Implementations and backports tied to <code><numeric></code>.
 * 







 */


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

................................................................................
template <typename FwIt, typename Integer, typename T>
FwIt iota_n (FwIt ini, Integer n, T i0) {
    while (n-->0) { *ini= i0; ++ini; ++i0; }
    return ini;
}








/**
 * @brief Calculates the greatest common divisor.
 * @ingroup cxx17-backports
 * @sa lcm
 */
template <typename IM, typename IN>
................................................................................
        using ::cxxomfort::cxxostd::gcd;
        using ::cxxomfort::cxxostd::lcm;
    }
    #endif
#endif // no std using

#endif

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

Changes to cxxomfort/cxxomfort/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
...
118
119
120
121
122
123
124



















#ifndef CXXOMFORT_RANDOM_HPP
#define CXXOMFORT_RANDOM_HPP
/**
 * @file
 * @brief Implementations and additions tied to Standard header <code><random></code>.
 * 
 * Interfaces defined in this file:
 * 
 * * @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>.
 * 
 */

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


// #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>
................................................................................
        using ::cxxomfort::cxxostd::knuth_b;
    }
    #endif
#endif


#endif
























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









>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6












7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
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
#ifndef CXXOMFORT_RANDOM_HPP
#define CXXOMFORT_RANDOM_HPP
/**
 * @file
 * @brief Implementations and additions tied to Standard header <code><random></code>.
 * @ingroup std0random 












 * 
 */

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

Deleted cxxomfort/cxxomfort/sequences.hpp.

1
2
3
#include <cxxomfort/config.hpp>
#pragma message CXXO_WARNING("this header is deprecated. New header is <cxxomfort/library/sequences.hpp>")
#include <cxxomfort/library/sequences.hpp>
<
<
<






Changes to cxxomfort/cxxomfort/string.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
...
106
107
108
109
110
111
112



















#ifndef CXXOMFORT_STRING_HPP
#define CXXOMFORT_STRING_HPP
/**
 * @file cxxomfort/string.hpp
 * @brief Implementations and additions tied to <code><string></code>.
 * 
 * Interfaces defined in this file:
 * 
 * * @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
 *
 */



#include "base.hpp"
#include <iostream>
#include <string>
................................................................................
} } // std::tr1

    #endif // gcc
#endif


#endif
























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







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6











7
8
9
10
11
12
13
..
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
#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"
#include <iostream>
#include <string>
................................................................................
} } // std::tr1

    #endif // gcc
#endif


#endif

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

Changes to cxxomfort/cxxomfort/string_view.hpp.

12
13
14
15
16
17
18







    using cxxomfort::cxxostd::u16string_view;
    using cxxomfort::cxxostd::u32string_view;
#endif
}

#endif
#endif














>
>
>
>
>
>
>
12
13
14
15
16
17
18
19
20
21
22
23
24
25
    using cxxomfort::cxxostd::u16string_view;
    using cxxomfort::cxxostd::u32string_view;
#endif
}

#endif
#endif

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

Changes to cxxomfort/cxxomfort/typeindex.hpp.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#define CXXOMFORT_TYPE_INDEX_HPP
/**
 * @file
 * @brief Implementations and backports tied to Standard Header <code><typeindex></code>.
 * 
 * Interfaces defined in this file:
 * 
 * * @c std::type_index (C++11)
 * * @c std::hash<std::type_index> (C++11)
 *
 * @see https://en.cppreference.com/w/cpp/header/typeindex
 * 
 */

#include "config.hpp"
#include "base.hpp"   // move, forward







|
|







2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#define CXXOMFORT_TYPE_INDEX_HPP
/**
 * @file
 * @brief Implementations and backports tied to Standard Header <code><typeindex></code>.
 * 
 * Interfaces defined in this file:
 * 
 * * @c type_index (C++11)
 * * @c hash<type_index> (C++11)
 *
 * @see https://en.cppreference.com/w/cpp/header/typeindex
 * 
 */

#include "config.hpp"
#include "base.hpp"   // move, forward

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

88
89
90
91
92
93
94











95
96
97
98
99
100
101
...
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
...
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
...
218
219
220
221
222
223
224




225
226
227
228
229
230
231
232
233
234
235
236
237
...
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
: public integral_constant<bool, B> {};

//! true_type
struct false_type : integral_constant<bool,false> {};
//! false_type
struct true_type : integral_constant<bool,true> {};












//
// is_void
//
template <typename T> struct is_void : false_type {};
TR1LITE_DEF_SPECIALIZE_CV_TRUE(is_void,void);

//
................................................................................
//
template <typename T> struct is_floating_point : false_type {};
TR1LITE_DEF_SPECIALIZE_CV_TRUE(is_floating_point,float);
TR1LITE_DEF_SPECIALIZE_CV_TRUE(is_floating_point,double);
TR1LITE_DEF_SPECIALIZE_CV_TRUE(is_floating_point,long double);




//
// is_same
//
template <typename TA, typename TB> struct is_same : false_type {};
template <typename T> struct is_same<T,T> : true_type {};


................................................................................
template <typename T> struct remove_volatile {
    typedef T type;
};
template <typename T> struct remove_volatile<T volatile> {
    typedef T type;
};

//! remove_cv
template <typename T> struct remove_cv {
    typedef typename remove_const< typename remove_volatile<T>::type >::type type;
};

//
// is_const
//
template <typename T> struct is_const
: false_type {};
template <typename T> struct is_const<T const>
................................................................................

//
// is_reference
//
template <typename T> struct is_reference : false_type {};
template <typename T> struct is_reference<T&> : true_type {};





//
// is_pointer
//
template <typename T> struct is_pointer : false_type {};
template <typename T> struct is_pointer<T*> : true_type {};


//
// is_signed
//
template <typename T> struct is_signed : false_type {};
TR1LITE_DEF_SPECIALIZE_CV_TRUE(is_signed,signed short);
TR1LITE_DEF_SPECIALIZE_CV_TRUE(is_signed,signed int);
................................................................................
//
template <typename T> struct remove_reference {
    typedef T type;
};
template <typename T> struct remove_reference<T&> {
    typedef T type;
};



//
// add_reference
template <typename T> struct add_reference {
    // careful with T == cv-qualified void
    typedef typename helper::conditional< 







>
>
>
>
>
>
>
>
>
>
>







 







<
<







 







<
<
<
<







 







>
>
>
>





<







 







<







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
...
139
140
141
142
143
144
145


146
147
148
149
150
151
152
...
163
164
165
166
167
168
169




170
171
172
173
174
175
176
...
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238

239
240
241
242
243
244
245
...
428
429
430
431
432
433
434

435
436
437
438
439
440
441
: public integral_constant<bool, B> {};

//! true_type
struct false_type : integral_constant<bool,false> {};
//! false_type
struct true_type : integral_constant<bool,true> {};

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

template <typename T> struct remove_cv<T const> { typedef T type; };
template <typename T> struct remove_cv<T volatile> { typedef T type; };
template <typename T> struct remove_cv<T const volatile> { typedef T type; };

//
// is_void
//
template <typename T> struct is_void : false_type {};
TR1LITE_DEF_SPECIALIZE_CV_TRUE(is_void,void);

//
................................................................................
//
template <typename T> struct is_floating_point : false_type {};
TR1LITE_DEF_SPECIALIZE_CV_TRUE(is_floating_point,float);
TR1LITE_DEF_SPECIALIZE_CV_TRUE(is_floating_point,double);
TR1LITE_DEF_SPECIALIZE_CV_TRUE(is_floating_point,long double);




//
// is_same
//
template <typename TA, typename TB> struct is_same : false_type {};
template <typename T> struct is_same<T,T> : true_type {};


................................................................................
template <typename T> struct remove_volatile {
    typedef T type;
};
template <typename T> struct remove_volatile<T volatile> {
    typedef T type;
};






//
// is_const
//
template <typename T> struct is_const
: false_type {};
template <typename T> struct is_const<T const>
................................................................................

//
// is_reference
//
template <typename T> struct is_reference : false_type {};
template <typename T> struct is_reference<T&> : true_type {};

// is_lvalue_reference
template <typename T> struct is_lvalue_reference : false_type {};
template <typename T> struct is_lvalue_reference<T&> : true_type {};

//
// is_pointer
//
template <typename T> struct is_pointer : false_type {};
template <typename T> struct is_pointer<T*> : true_type {};


//
// is_signed
//
template <typename T> struct is_signed : false_type {};
TR1LITE_DEF_SPECIALIZE_CV_TRUE(is_signed,signed short);
TR1LITE_DEF_SPECIALIZE_CV_TRUE(is_signed,signed int);
................................................................................
//
template <typename T> struct remove_reference {
    typedef T type;
};
template <typename T> struct remove_reference<T&> {
    typedef T type;
};



//
// add_reference
template <typename T> struct add_reference {
    // careful with T == cv-qualified void
    typedef typename helper::conditional< 

Changes to cxxomfort/cxxomfort/utility.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
...
146
147
148
149
150
151
152




















#ifndef CXXOMFORT_UTILITY_HPP
#define CXXOMFORT_UTILITY_HPP
/**
 * @file
 * @brief Implementations and backports tied to Standard Header <code><utility></code>.
 * 
 * Interfaces defined in this file:
 * 
 * * @c move() (C++11)
 * * @c declval() (C++11)
 * * @c exchange() (C++14)
 * * @c integer_sequence , @c index_sequence (C++14) (down to C++11 only)
 * * @c as_const() (C++17)
 * * @c in_place_t , @c in_place_type_t (C++17)
 *
 * See also @ref type_traits.hpp , @ref tuple.hpp , 
 * <a href="https://en.cppreference.com/w/cpp/header/utility">\<utility\> \@cppreference</a>.
 */



#include "config.hpp"
#include "base.hpp"   // move, forward
#include CXXO_INCLUDE_SYS(utility)
................................................................................
#endif


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

#endif

























|
<

<
<
<
<
<
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6

7









8
9
10
11
12
13
14
...
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
#ifndef CXXOMFORT_UTILITY_HPP
#define CXXOMFORT_UTILITY_HPP
/**
 * @file
 * @brief Implementations and backports tied to Standard Header <code><utility></code>.
 * @xrefitem std0utility "<utility>" "Header"

 * 









 */



#include "config.hpp"
#include "base.hpp"   // move, forward
#include CXXO_INCLUDE_SYS(utility)
................................................................................
#endif


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

#endif

/**
 * @page std0utility
 * @brief Backports from <utility>
 * 
 * Interfaces defined in this file:
 * 
 * * @c move() (C++11)
 * * @c declval() (C++11)
 * * @c exchange() (C++14)
 * * @c integer_sequence , @c index_sequence (C++14) (down to C++11 only)
 * * @c as_const() (C++17)
 * * @c in_place_t , @c in_place_type_t (C++17)
 *
 * See also @ref type_traits.hpp , @ref tuple.hpp , 
 * <a href="https://en.cppreference.com/w/cpp/header/utility">\<utility\> \@cppreference</a>.
 * 
 * See also @ref cxxo-sup-utility (supplemental).
 * 
 * */