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

Overview
Comment:Commit 2019-11-11 - .at() the end of year _or close.
  • cxxomfort: CXXOMFORT_CXX_EMULATION now returns >=2007 for C++98/03 mode with TR1, where possible.
  • cxxomfort: library is now **not** included autimatically. It must be included explicitly even with cxxomfort.hpp.
  • algorithm: Added count, count_if from C++20 (fixes: [ac8af64591]).
  • algorithm: Tentatively marking find, count algorithms as constexpr for C++14.
  • array: Fixed a wrong call to lexicographical_compare in pre-TR1 implementation.
  • iterator: Added contiguous_iterator_tag. Note that pre-C++17 Standard code would not know how to use it.
  • iterator: Added make_reverse_iterator from C++14.
  • random: Fixed a missing cxxomfort::fix in certain compilers in C++11 mode (enhances: [5ba7743db6] Clang-4.x support, GCC-6.x support).
  • string_view: Added .at_or().
  • library:array_ref: Added .at_or().
  • library:fixed_vector: Added .at_or().
  • library:fixed_vector: Made size, empty accessors constexpr.
  • library:tuple: Implemented variadic versions of tuple_shift, tuple_pop.
  • library:utility: Added make_simple_pair.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | y2019 | gcc_min_404 | clang_min_302 | gcc_max_600
Files: files | file ages | folders
SHA3-256:1dfa7ad4e804d2c52c17ff3563240941d545a727d3ee17d72b9b7a1134fae914
User & Date: luismachuca 2019-11-11 04:41:40
References
2019-11-11
04:39 Fixed ticket [ac8af645]: Support for C++17 count, count_if plus 6 other changes artifact: 3b8c248c user: luismachuca
Context
2020-01-14
05:29
Commit 2020-01-13 - The “don't ask me for documentation fixes, I don't have 2020 vision” release.
  • cxxomfort: Added detection of Clang 4.x with some features.
  • cxxomfort: CXXOMFORT_VERSION now copies CXXOMFORT_DATE.
  • config: Slightly improved detection of Clang __has_extension.
  • algorithm: Fixed any_of returning always true (Fixes: [98efdadf5b]).
  • functional: Fixed missing connection of documentation for heterogeneous functors.
  • iterator: Defined and documented the behaviour of fix:is_contiguous_access_iterator for "checked" iterators.
  • limits: Fixed missing documentation for integral_limits.
  • memory: Fixed documentation for the to_bool fixes.
  • system_error: Fixed Doxygen marking for the category functions.
  • library:functional: Fixed missing connection of documentation for heterogeneous functors.
  • library:iterator: Added at_or() adapter.
  • library:tuple: Fixed missing Doxygen marking for tuple_pop, tuple_shift.
  • library:utility: Added valcmp (also in library:algorithm).
  • library:array_ref: Fixed constructors in accordance to n3334.
  • library:function_ref: Added support for 3, 4, 5-args functions.
  • library:typesafe_enum: Corrected default constructor as per [expr.type.conv] and https://stackoverflow.com/questions/53897991/enum-class-default-initialization .
  • tags: Added tags for new features in library:functional.
  • tags: Updated cxxomfort tags for new fix / assists.
  • tags: Removed references to CXXOMFORT_VERSION.
  • doc: Updated autogenerated documentation.
  • LICENSE: Now reflects year 2020.
This release marks the opening of (pre-)releases to be marked with the 'y2020' tag.
check-in: 4817fec6 user: luismachuca tags: trunk, gcc_min_404, msvc_min_1500, clang_min_303, release, y2020
2019-11-11
04:41
Commit 2019-11-11 - .at() the end of year _or close.
  • cxxomfort: CXXOMFORT_CXX_EMULATION now returns >=2007 for C++98/03 mode with TR1, where possible.
  • cxxomfort: library is now **not** included autimatically. It must be included explicitly even with cxxomfort.hpp.
  • algorithm: Added count, count_if from C++20 (fixes: [ac8af64591]).
  • algorithm: Tentatively marking find, count algorithms as constexpr for C++14.
  • array: Fixed a wrong call to lexicographical_compare in pre-TR1 implementation.
  • iterator: Added contiguous_iterator_tag. Note that pre-C++17 Standard code would not know how to use it.
  • iterator: Added make_reverse_iterator from C++14.
  • random: Fixed a missing cxxomfort::fix in certain compilers in C++11 mode (enhances: [5ba7743db6] Clang-4.x support, GCC-6.x support).
  • string_view: Added .at_or().
  • library:array_ref: Added .at_or().
  • library:fixed_vector: Added .at_or().
  • library:fixed_vector: Made size, empty accessors constexpr.
  • library:tuple: Implemented variadic versions of tuple_shift, tuple_pop.
  • library:utility: Added make_simple_pair.
check-in: 1dfa7ad4 user: luismachuca tags: trunk, y2019, gcc_min_404, clang_min_302, gcc_max_600
2019-08-28
19:57
Commit 2019-08-28 - MSVC and the End of <time.h>s as we Know It™
  • config: Fixed namespace placement of ere-TR1 features in MSVC 2010, 2012 (enhances: [70b70d8017]).
  • ctime: Added header with backports for timespec_get.
  • algorithm: Moved copy_if_not out of std and into its proper location in supplement.
  • algorithm: Documentation of algorithms now points to the corresponding cppreference page.
  • ios: Added header, with backport of C++11 io_errc.
  • ios: Added missing left,right manips to ios in OpenWatcom (enhances: [b8ea55b791]).
  • memory: Fixed to_bool of shared_ptr when the latter is unavailable (enhances: [11f57a70cf]).
  • numeric: Added midpoint, from C++20.
  • string_view: Fixed implementation to not use inheritance.
  • string_view: Fixed an issue where it did not include the correct <system_error> implementation.
  • typeindex: Removed a warning of conversion to bool when in MSVC.
  • type_traits: Fixed is_base_of for Clang 2.8, 3.0 (enhances: [1cbdc0b48d]).
  • library:string: ifdef-out the header for pre-C++1997 mode.
  • library:string: Partially extended support for variadic to_string.
  • library:utility: ifdef-out the header for pre-C++1997 mode.
  • library:typesafe_enum: Now default-constructs to 0 to emulate enum class behaviour.
  • tags: Updated with new information on macros.
check-in: 44499e7b user: luismachuca tags: trunk
Changes

Changes to cxxomfort/CHANGELOG.txt.


















1
2
3
4
5
6
7

















Commit 2019-08-28 - MSVC and the End of <time.h>s as we Know It™

  *  config: Fixed namespace placement of ere-TR1 features in MSVC 2010, 2012 (enhances: [70b70d8017]).
  *  ctime: Added header with backports for <tt>timespec_get</tt>.
  *  algorithm: Moved <tt>copy_if_not</tt> out of std and into its proper location in supplement.
  *  algorithm: Documentation of algorithms now points to the corresponding <em>cppreference</em> page.
  *  ios: Added header, with backport of C++11 <tt>io_errc</tt>.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Commit 2019-11-11 - .at() the end of year _or close.

  *  cxxomfort: <tt>CXXOMFORT_CXX_EMULATION</tt> now returns <tt>>=2007</tt> for C++98/03 mode with TR1, where possible.
  *  cxxomfort: <tt>library</tt> is now **not** included autimatically. It must be included explicitly even with <tt>cxxomfort.hpp</tt>.
  *  algorithm: Added <tt>count</tt>, <tt>count_if</tt> from C++20 (fixes: [ac8af64591]).
  *  algorithm: Tentatively marking <tt>find</tt>, <tt>count</tt> algorithms as <tt>constexpr</tt> for C++14.
  *  array: Fixed a wrong call to <tt>lexicographical_compare</tt> in pre-TR1 implementation.
  *  iterator: Added <tt>contiguous_iterator_tag</tt>. Note that pre-C++17 Standard code would not know how to use it.
  *  iterator: Added <tt>make_reverse_iterator</tt> from C++14.
  *  random: Fixed a missing cxxomfort::fix in certain compilers in C++11 mode (enhances: [5ba7743db6] Clang-4.x support, GCC-6.x support).
  *  string_view: Added <tt>.at_or()</tt>.
  *  library:array_ref: Added <tt>.at_or()</tt>.
  *  library:fixed_vector: Added <tt>.at_or()</tt>.
  *  library:fixed_vector: Made size, empty accessors <tt>constexpr</tt>.
  *  library:tuple: Implemented variadic versions of <tt>tuple_shift</tt>, <tt>tuple_pop</tt>.
  *  library:utility: Added <tt>make_simple_pair</tt>.

Commit 2019-08-28 - MSVC and the End of <time.h>s as we Know It™

  *  config: Fixed namespace placement of ere-TR1 features in MSVC 2010, 2012 (enhances: [70b70d8017]).
  *  ctime: Added header with backports for <tt>timespec_get</tt>.
  *  algorithm: Moved <tt>copy_if_not</tt> out of std and into its proper location in supplement.
  *  algorithm: Documentation of algorithms now points to the corresponding <em>cppreference</em> page.
  *  ios: Added header, with backport of C++11 <tt>io_errc</tt>.

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
..
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
...
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188

189
190

191
192
193
194
195
196
197
198
199
200
201







202
203



204






205
206
207
208
209
210
211
212
213
214
215
216
217
#ifndef CXXOMFORT_ALGORITHM_HPP
#define CXXOMFORT_ALGORITHM_HPP
/**
 * @file cxxomfort/algorithm.hpp
 * @brief Implementations and Backports for Standard header <code>\<algorithm\></code>.
 * @xrefitem std0algorithm "<algorithm>" "Header"
 * 




 */

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

namespace cxxomfort { namespace cxxostd {

#if (CXXOMFORT_CXX_STD<2011)

/**
 * @brief Copy elements conditionally to @a dest if they fulfill @a f .
................................................................................
    for (; ini != fin; ++ini) {
        if (f(*ini)) *Dtrue++= *ini; 
        else *Dfalse++= *ini;
    } // end for
    return std::pair<OutI1,OutI2>(Dtrue,Dfalse);
}




























/**
 * @brief Finds like @c find_if but the predicate is reversed.
 * @xrefitem std0algorithm "" "Search"
 * @ingroup cxx11-backports
 * @sa @cppref{algorithm/find_if}





 **/
template<class It, class Pred>

It find_if_not(It ini, It fin, Pred f) {
    for (; ini != fin; ++ini) {
        if (!f(*ini)) {
            return ini;
        }
    }
    return fin; // < all the elements fulfill f
}













































































/**
 * @brief Determines if a sequence is sorted according to a given criteria.
 * @param less Criteria for sorting, a binary function f(x,y) that returns @c true if <code>x<y</code>.
 * @return A bool response about if the sequence is sorted.
 * @xrefitem std0algorithm "<algorithm> backports" "Sorting"
 * @ingroup cxx11-backports
................................................................................
// c++17 onwards
#include "impl/17-clamp.hpp"

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

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

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

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


    //! copy_if

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

    using ::cxxomfort::cxxostd::find_if_not;

    //! is_sorted
    using ::cxxomfort::cxxostd::is_sorted;
    using ::cxxomfort::cxxostd::shuffle;








    using ::cxxomfort::cxxostd::equal; // c++14
    



    using ::cxxomfort::cxxostd::for_each_n; // c++17






    
    
}
    #endif // std using

#endif // using emulation


#endif

/**
 * @page std0algorithm <algorithm>
 * @brief Backports from @c <algorithm> 







>
>
>
>




|







 







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






>
>
>
>
>


>








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







 







<
<
<
<
<
<
|
|
<
<
>

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







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
...
284
285
286
287
288
289
290






291
292


293
294

295
296

297
298

299


300
301

302
303
304
305
306
307
308
309

310
311
312
313
314
315
316
317
318
319
320
321

322


323
324
325
326
327
328
329
#ifndef CXXOMFORT_ALGORITHM_HPP
#define CXXOMFORT_ALGORITHM_HPP
/**
 * @file cxxomfort/algorithm.hpp
 * @brief Implementations and Backports for Standard header <code>\<algorithm\></code>.
 * @xrefitem std0algorithm "<algorithm>" "Header"
 * 
 * This header covers backports for the various algorithm utilities in C++. 
 * A general listing of the Standard utilities here, with sample implementations, 
 * can be found at @cppref{header/algorithm}.
 * 
 */

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

namespace cxxomfort { namespace cxxostd {

#if (CXXOMFORT_CXX_STD<2011)

/**
 * @brief Copy elements conditionally to @a dest if they fulfill @a f .
................................................................................
    for (; ini != fin; ++ini) {
        if (f(*ini)) *Dtrue++= *ini; 
        else *Dfalse++= *ini;
    } // end for
    return std::pair<OutI1,OutI2>(Dtrue,Dfalse);
}


/**
 * @brief Finds an element in a sequence that matches a predicate.
 * @xrefitem std0algorithm "" "Search"
 * @sa @cppref{algorithm/find_if}
 * 
 * @note This algorithm is already provided in C++03. It is provided here only
 * for enhancements in later Standards that might be desirable to invoke 
 * backports for explicitly.
 * 
 * @note This algorithm is <tt>constexpr</tt> starting C++20; here it is 
 * tentatively marked <tt>constexpr</tt> for C++14 as well. We can't modify 
 * the C++17 version.
 * 
 **/
template<class It, class Pred>
CXXO_CONSTEXPR14
It find_if (It ini, It fin, Pred f) {
    for (; ini != fin; ++ini) {
        if (f(*ini)) {
            return ini;
        }
    }
    return fin; // < none of the elements fulfill f
}


/**
 * @brief Finds like @c find_if but the predicate is reversed.
 * @xrefitem std0algorithm "" "Search"
 * @ingroup cxx11-backports
 * @sa @cppref{algorithm/find_if}
 * 
 * @note This algorithm is <tt>constexpr</tt> starting C++20; here it is 
 * tentatively marked <tt>constexpr</tt> for C++14 as well. We can't modify 
 * the C++17 version.
 * 
 **/
template<class It, class Pred>
CXXO_CONSTEXPR14
It find_if_not(It ini, It fin, Pred f) {
    for (; ini != fin; ++ini) {
        if (!f(*ini)) {
            return ini;
        }
    }
    return fin; // < all the elements fulfill f
}

/**
 * @brief Counts the number of times in a sequence the criteria @a p is matched.
 * @xrefitem std0algorithm "" "Search"
 * @ingroup cxx17-backports
 * @sa @cppref{algorithm/count}
 * @sa @ref count
 * 
 * @note This algorithm is <tt>constexpr</tt> starting C++20; here it is 
 * tentatively marked <tt>constexpr</tt> for C++14 as well. We can't modify 
 * the C++17 version.
 * 
 **/
template<class It, class Pred>
CXXO_CONSTEXPR14 typename std::iterator_traits<It>::difference_type 
count_if (It ini, It fin, Pred p) {
	typename std::iterator_traits<It>::difference_type ret= 0;
    for (; ini != fin; ++ini) {
        if (p(*ini)) {
            ++ret;
        }
    }
    return ret; 
}

/**
 * @brief Counts the number of times in a sequence a given value is found.
 * @xrefitem std0algorithm "" "Search"
 * @ingroup cxx17-backports
 * @sa @cppref{algorithm/count}
 * @sa @ref count_if
 * 
 * @note This algorithm is <tt>constexpr</tt> starting C++20; here it is 
 * tentatively markes <tt>constexpr</tt> for C++14 as well. We can't modify 
 * the C++17 version.
 * 
 **/
template<class It, typename T>
CXXO_CONSTEXPR14 typename std::iterator_traits<It>::difference_type 
count (It ini, It fin, T const& tv) {
	typename std::iterator_traits<It>::difference_type ret= 0;
    for (; ini != fin; ++ini) {
        if (*ini == tv) {
            ++ret;
        }
    }
    return ret; 
}


/**
 * @brief Fills a sequence with a given value.
 * @xrefitem std0algorithm "" "Modify"
 * @sa @cppref{algorithm/fill}
 * 
 * @note This algorithm is already provided in C++03. It is provided here only
 * for enhancements in later Standards that might be desirable to invoke 
 * backports for explicitly.
 * 
 * @note This algorithm is <tt>constexpr</tt> starting C++20; here it is 
 * tentatively marked <tt>constexpr</tt> for C++14 as well. We can't modify 
 * the C++17 version.
 * 
 **/
template <typename It, typename T>
CXXO_CONSTEXPR14 
void fill (It ini, It fin, T const& tv) {
	for (; ini != fin; ++ini) { *ini= tv; }
}

template <typename It, typename Numeric, typename T>
CXXO_CONSTEXPR14 
void fill_n (It ini, Numeric n, T const& tv) {
	for (Numeric i= 0; i<n; ++i, ++ini) { *ini= tv; }
}


/**
 * @brief Determines if a sequence is sorted according to a given criteria.
 * @param less Criteria for sorting, a binary function f(x,y) that returns @c true if <code>x<y</code>.
 * @return A bool response about if the sequence is sorted.
 * @xrefitem std0algorithm "<algorithm> backports" "Sorting"
 * @ingroup cxx11-backports
................................................................................
// c++17 onwards
#include "impl/17-clamp.hpp"

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







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


	// the commented ones here are using'd in subheaders:


	#if (CXXOMFORT_CXX_STD < 2011 || CXXOMFORT_CXX_EMULATION < 2011)
	using ::cxxomfort::cxxostd::copy_if;

	using ::cxxomfort::cxxostd::copy_n;
	using ::cxxomfort::cxxostd::partition_copy;

	using ::cxxomfort::cxxostd::find_if_not;


	using ::cxxomfort::cxxostd::is_sorted;
	using ::cxxomfort::cxxostd::shuffle;

	//using ::cxxomfort::cxxostd::all_of;
	//using ::cxxomfort::cxxostd::any_of;
	//using ::cxxomfort::cxxostd::none_of;
	//using ::cxxomfort::cxxostd::minmax;
	//using ::cxxomfort::cxxostd::minmax_element;
	#endif
	#if (CXXOMFORT_CXX_STD < 2014 || CXXOMFORT_CXX_EMULATION < 2014)
	using ::cxxomfort::cxxostd::equal;

	using ::cxxomfort::cxxostd::mismatch;
	#endif
	#if (CXXOMFORT_CXX_STD < 2017 || CXXOMFORT_CXX_EMULATION < 2017)
	using ::cxxomfort::cxxostd::for_each_n;
	//using ::cxxomfort::cxxostd::clamp;
	#endif
	#if (CXXOMFORT_CXX_STD < 2020 || CXXOMFORT_CXX_EMULATION < 2020)
	using ::cxxomfort::cxxostd::count;
	using ::cxxomfort::cxxostd::count_if;
	#endif
	
	

#endif




#endif

/**
 * @page std0algorithm <algorithm>
 * @brief Backports from @c <algorithm> 

Changes to cxxomfort/cxxomfort/array.hpp.

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
..
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
 *
 */

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


#if (CXXOMFORT_CXX_STD<1997 && defined CXXO_USE_INTERNAL_TR1)




	// not even C++03
	#include "impl/07-array.hpp"









#elif (CXXOMFORT_CXX_STD < 2011 && CXXOFLAG_tr1 > 0)











	// c++03, with TR1
	#if (CXXOFLAG_directory_tr1>0)
		#include <tr1/array>
	#else 
		#include <array>
	#endif

	#if (CXXOFLAG_namespace_tr1>0)
namespace std {
    using tr1::array;
    using tr1::get;
}
	#endif



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

#endif

................................................................................
 * 
 * Interfaces defined in this section:
 * 
 * * @c std::array (C++11) - C++ type version of a C-array.
 * * @c get() - Get an element from an array by its compile-time index.
 * 
 * 
 * @see 
 * 
 * * @cppref{header/array} (cppreference)
 * * @cppref{array}
 * * @ref{libarrayref,cxxomfort's @c array_ref }
 * 
 * */








|
>
>
>
>
|
|

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

|
|
|
|
|
|
>
>







 







|

|
|
|



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
..
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 *
 */

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


#if (CXXOMFORT_CXX_STD<1997)
	#if defined(CXXOMFORT_USE_INTERNAL_TR1)
		#if (CXXOMFORT_NOTICES > 1)
			#pragma message CXXO_NOTICE("internal TR1: <array>")
		#endif
		// not even C++03
		#include "impl/07-array.hpp"


namespace std {
	using ::cxxomfort::cxxostd::array::array;
	using ::cxxomfort::cxxostd::array::get;
}

	#endif

#elif (CXXOMFORT_CXX_STD < 2011)
	#if defined(CXXOMFORT_USE_INTERNAL_TR1)
		// not even C++03
		#include "impl/07-array.hpp"


namespace std {
	using ::cxxomfort::cxxostd::array::array;
	using ::cxxomfort::cxxostd::array::get;
}

	#elif (CXXOFLAG_tr1 > 0)
		// c++03, with TR1
		#if (CXXOFLAG_directory_tr1>0)
			#include <tr1/array>
		#else 
			#include <array>
		#endif

		#if (CXXOFLAG_namespace_tr1>0)
	namespace std {
		using tr1::array;
		using tr1::get;
	}
		#endif

	#endif // tr1

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

#endif

................................................................................
 * 
 * Interfaces defined in this section:
 * 
 * * @c std::array (C++11) - C++ type version of a C-array.
 * * @c get() - Get an element from an array by its compile-time index.
 * 
 * 
 * @section See Also 
 * 
 * @see @cppref{header/array} (cppreference)
 * @see @cppref{array}
 * @see @ref{libarrayref,cxxomfort's @c array_ref }
 * 
 * */

Changes to cxxomfort/cxxomfort/config.hpp.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
49
50
51
52
53
54
55

56




57

58

59
60
61
62
63
64
65
66
..
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
...
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151


152
153
154
155
156
157
158
159
160
161
162
163
164
 * @ingroup cxxomfort-config
 *
 * This file contains configuration macros used by the cxxomfort library
 * and it is not intended to be directly used.
 */

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

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


/*
 * Behaviour macros
................................................................................
#define CXXOFLAG_SHADOW_KEYWORD_constexpr 0


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

 * 




 * */

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

#define CXXO_INCLUDE_SYS(NAME) <NAME>

#endif // doxygen


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


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

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


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

// Detect CXX_STD and operation mode (initial)

/*
#if (__cplusplus >= 201103L && __cplusplus < 201402L)
    #undef  CXXOMFORT_CXX_STD
    #define CXXOMFORT_CXX_STD 2011
#elif (__cplusplus >= 201402L)
    #undef  CXXOMFORT_CXX_STD
    #define CXXOMFORT_CXX_STD 2014
#endif
*/

/*
 * Detect compilers and apply specific configurations.
 */
#if 0
#elif defined(__clang__)
    #include "./config/clang.hpp"
................................................................................
/*
 * Set up more friendly messages
 */
    #if (CXXOMFORT_NOTICES > 1)

        #if 0
        #elif (CXXOMFORT_CXX_STD >= 2017)
            #pragma message( CXXO_NOTICE("detected C++17 or above mode") );
        #elif (CXXOMFORT_CXX_STD >= 2014)
            #pragma message CXXO_NOTICE("detected C++14 mode")
        #elif (CXXOMFORT_CXX_STD == 2011)
            #pragma message CXXO_NOTICE("detected C++11 mode")
        #elif (CXXOMFORT_CXX_STD >=1997 && CXXOMFORT_CXX_STD < 2011)
            #pragma message CXXO_NOTICE("detected C++03 or basic mode")
        #else
			#pragma message ("detected C++ not at least C++03.");
			#pragma message ("insuffucient compiler support - expect hard compilation fail!")
        #endif

        #if 0


        #elif (CXXOMFORT_CXX_EMULATION == 2011) 
            #pragma message CXXO_NOTICE("running in emulation / c++0x mode (c++11)")
        #elif (CXXOMFORT_CXX_EMULATION == 2014)
            #pragma message CXXO_NOTICE("running in emulation / c++1y mode (c++14)")
        #elif (CXXOMFORT_CXX_EMULATION >= 2017)
            #pragma message CXXO_NOTICE("running in emulation / c++1z mode (c++17)")
        #endif
        
    #endif // friendly notices

#endif

//







|


|







 







>

>
>
>
>

>
|
>
|







 







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







 







|

|
|
|

|

|
|



>
>

|

|

|







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
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
..
80
81
82
83
84
85
86













87
88
89
90
91
92
93
...
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
 * @ingroup cxxomfort-config
 *
 * This file contains configuration macros used by the cxxomfort library
 * and it is not intended to be directly used.
 */

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

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


/*
 * Behaviour macros
................................................................................
#define CXXOFLAG_SHADOW_KEYWORD_constexpr 0


/**
 * @def CXXOFLAG_INCLUDE_PATH
 * @ingroup cxxomfort-config
 * @brief Set path to C++ compiler headers.
 * @note Customization point.
 * 
 * The user can define a value for this macro, which should be the path where 
 * the compiler-provided Standard headers of C++ can be found. For example, 
 * in GCC 6 under Linux, <tt>"/usr/include/c++/6"</tt>.
 * 
 * */
#if !defined(CXXOFLAG_INCLUDE_PATH)
#define CXXOFLAG_INCLUDE_PATH() ""
#endif
#define CXXO_INCLUDE_SYS(NAME) <CXXOFLAG_INCLUDE_PATH()NAME>

#endif // doxygen


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


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

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
















/*
 * Detect compilers and apply specific configurations.
 */
#if 0
#elif defined(__clang__)
    #include "./config/clang.hpp"
................................................................................
/*
 * Set up more friendly messages
 */
    #if (CXXOMFORT_NOTICES > 1)

        #if 0
        #elif (CXXOMFORT_CXX_STD >= 2017)
            #pragma message CXXO_NOTICE("C++17 or newer mode") );
        #elif (CXXOMFORT_CXX_STD >= 2014)
            #pragma message CXXO_NOTICE("C++14 mode")
        #elif (CXXOMFORT_CXX_STD >= 2011)
            #pragma message CXXO_NOTICE("C++11 mode")
        #elif (CXXOMFORT_CXX_STD >=1997 && CXXOMFORT_CXX_STD < 2011)
            #pragma message CXXO_NOTICE("C++03 or basic mode")
        #else
			#pragma message CXXO_WARNING("detected C++ not at least C++03.");
			#pragma message CXXO_WARNING("insuffucient compiler support - expect hard compilation fail!")
        #endif

        #if 0
        #elif (CXXOMFORT_CXX_EMULATION == 2007)
            #pragma message CXXO_NOTICE("emulation / c++98+tr1 mode (2007)")
        #elif (CXXOMFORT_CXX_EMULATION == 2011) 
            #pragma message CXXO_NOTICE("emulation / c++0x mode (c++11)")
        #elif (CXXOMFORT_CXX_EMULATION == 2014)
            #pragma message CXXO_NOTICE("emulation / c++1y mode (c++14)")
        #elif (CXXOMFORT_CXX_EMULATION >= 2017)
            #pragma message CXXO_NOTICE("emulation / c++1z mode (c++17)")
        #endif
        
    #endif // friendly notices

#endif

//

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

3
4
5
6
7
8
9
10






11
12







13
14
15
16
17
18
19
..
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#endif
#ifndef CXXOMFORT_CONFIG_SUPPORT_HPP
#define CXXOMFORT_CONFIG_SUPPORT_HPP
/**
 * @file
 */

//! Year of the standard in use (the year part in @c __cplusplus ).






#define CXXOMFORT_CXX_STD (__cplusplus/100)
//! Year of the standard emulated when the compiler is in emulation mode.







#define CXXOMFORT_CXX_EMULATION 0

// 
// compilers supported
// 

#define CXXO_COMPILERID_GCC 101
................................................................................
//! If compiler declares std::tr1::is_const<> et al.
#define CXXO_COMPILER_SUPPORT_tr1_type_traits 0
//! If compiler provides support for @c __typeof__ eg.: in C++03.
#define CXXO_COMPILER_SUPPORT_typeof 0
//! If compiler provides support for variadic macros (<code>__VA_ARG__</code>).
#define CXXO_COMPILER_SUPPORT_va_args 0

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

// c++11 stuff

//! If compiler provides a <array> header
#define CXXO_CXXSTDHEADER_array (CXXOMFORT_CXX_STD>=2011)







|
>
>
>
>
>
>

<
>
>
>
>
>
>
>







 







|

|







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
..
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#endif
#ifndef CXXOMFORT_CONFIG_SUPPORT_HPP
#define CXXOMFORT_CONFIG_SUPPORT_HPP
/**
 * @file
 */

/**
 * @brief Year of the Standard mode found.
 * 
 * Example possible values: 
 * @c 2017 (C++17), @c 2014 (C++14), @c 2011 (C++11), @c 1997 (C++98), @c 1 or @c 0 (for compilers that don't set <tt>__cplusplus</tt>)
 * 
 * */
#define CXXOMFORT_CXX_STD (__cplusplus/100)

/**
 * @brief Year of the Standard version that is being emulated, if it can be determined.
 * 
 * Example possible values: 
 * @c 2017 (C++17), @c 2014 (C++14), @c 2011 (C++11 / C++0x), @c 2007 (C++98 with TR1) or @c 0 
 * 
 * */
#define CXXOMFORT_CXX_EMULATION 0

// 
// compilers supported
// 

#define CXXO_COMPILERID_GCC 101
................................................................................
//! If compiler declares std::tr1::is_const<> et al.
#define CXXO_COMPILER_SUPPORT_tr1_type_traits 0
//! If compiler provides support for @c __typeof__ eg.: in C++03.
#define CXXO_COMPILER_SUPPORT_typeof 0
//! If compiler provides support for variadic macros (<code>__VA_ARG__</code>).
#define CXXO_COMPILER_SUPPORT_va_args 0

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

// c++11 stuff

//! If compiler provides a <array> header
#define CXXO_CXXSTDHEADER_array (CXXOMFORT_CXX_STD>=2011)

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

45
46
47
48
49
50
51



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70




71
72
73
74
75
76
77
78





















79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
    #pragma message CXXO_NOTICE("Found the Clang C++ Compiler.")
#endif

#if defined(_LIBCPP)
	#pragma message CXXO_NOTICE("with libcxx")
#endif




//
// compatibility detail for older clang as shown in 
// http://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros
//
#ifndef __has_extension
	#define __has_extension __has_extension
#endif


#undef  CXXO_COMPILER_SUPPORT___alignof
#define CXXO_COMPILER_SUPPORT___alignof 1
#undef  CXXO_COMPILER_SUPPORT_type_intrinsics
#define CXXO_COMPILER_SUPPORT_type_intrinsics 1
#undef  CXXO_COMPILER_SUPPORT_typeof
#define CXXO_COMPILER_SUPPORT_typeof 1
#undef  CXXO_COMPILER_SUPPORT_va_args
#define CXXO_COMPILER_SUPPORT_va_args 1

// c++03





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






















// c++11

#undef  CXXO_COMPILER_SUPPORT_alignof
#define CXXO_COMPILER_SUPPORT_alignof (CXXOMFORT_CXX_STD >= 2011 || CXXOMFORT_COMPILER_VERSION>=209)
#undef  CXXO_COMPILER_SUPPORT_alignment_tools
#define CXXO_COMPILER_SUPPORT_alignment_tools __has_extension(cxx_alignas)
#undef  CXXO_COMPILER_SUPPORT_attribute
#define CXXO_COMPILER_SUPPORT_attribute __has_extension(cxx_attributes)
#undef  CXXO_COMPILER_SUPPORT_auto
#define CXXO_COMPILER_SUPPORT_auto __has_extension(cxx_auto_type)
#undef  CXXO_COMPILER_SUPPORT_constexpr
#define CXXO_COMPILER_SUPPORT_constexpr __has_extension(cxx_constexpr)
#undef  CXXO_COMPILER_SUPPORT_decltype
#define CXXO_COMPILER_SUPPORT_decltype __has_extension(cxx_decltype_incomplete_return_types)
#undef  CXXO_COMPILER_SUPPORT_default_delete
#define CXXO_COMPILER_SUPPORT_default_delete (__has_extension(cxx_defaulted_functions) * __has_extension(cxx_deleted_functions))
#undef  CXXO_COMPILER_SUPPORT_enum_class
#define CXXO_COMPILER_SUPPORT_enum_class __has_extension(cxx_strong_enums)
#undef  CXXO_COMPILER_SUPPORT_explicit_operator
#define CXXO_COMPILER_SUPPORT_explicit_operator __has_extension(cxx_explicit_conversions)
#undef  CXXO_COMPILER_SUPPORT_foreach
#define CXXO_COMPILER_SUPPORT_foreach __has_extension(cxx_range_for)
#undef  CXXO_COMPILER_SUPPORT_initializer_list
#define CXXO_COMPILER_SUPPORT_initializer_list __has_extension(cxx_inheriting_constructors)
#undef  CXXO_COMPILER_SUPPORT_local_types
#define CXXO_COMPILER_SUPPORT_local_types __has_extension(cxx_local_type_template_args)
#undef  CXXO_COMPILER_SUPPORT_noexcept







>
>
>





|













>
>
>
>








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







|

|

|





|

|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
    #pragma message CXXO_NOTICE("Found the Clang C++ Compiler.")
#endif

#if defined(_LIBCPP)
	#pragma message CXXO_NOTICE("with libcxx")
#endif

#undef  CXXOFLAG_tr1
#define CXXOFLAG_tr1 0

//
// compatibility detail for older clang as shown in 
// http://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros
//
#ifndef __has_extension
	#define __has_extension __has_feature
#endif


#undef  CXXO_COMPILER_SUPPORT___alignof
#define CXXO_COMPILER_SUPPORT___alignof 1
#undef  CXXO_COMPILER_SUPPORT_type_intrinsics
#define CXXO_COMPILER_SUPPORT_type_intrinsics 1
#undef  CXXO_COMPILER_SUPPORT_typeof
#define CXXO_COMPILER_SUPPORT_typeof 1
#undef  CXXO_COMPILER_SUPPORT_va_args
#define CXXO_COMPILER_SUPPORT_va_args 1

// c++03

#if (CXXOMFORT_CXX_STD >= 1997 && CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_COMPILER_VERSION >= 300)

#endif

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

#if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_COMPILER_VERSION >= 300 && CXXOMFORT_COMPILER_VERSION < 400)
	#undef  CXXOFLAG_tr1
	#define CXXOFLAG_tr1 1
	#ifdef _LIBCPP
		
	#else
		// TR1 stuff is under directory tr1/
		#undef  CXXOFLAG_directory_tr1
		#define CXXOFLAG_directory_tr1 1
		#undef  CXXOFLAG_namespace_tr1 
		#define CXXOFLAG_namespace_tr1 1
		#undef  CXXO_STDTR1_NAME
		#define CXXO_STDTR1_NAME() std::tr1
		#undef  CXXO_STDTR1_OPEN
		#define CXXO_STDTR1_OPEN() namespace std { namespace tr1 {
		#undef  CXXO_STDTR1_CLOSE
		#define CXXO_STDTR1_CLOSE() } }


	#endif
#endif
// c++11

#undef  CXXO_COMPILER_SUPPORT_alignof
#define CXXO_COMPILER_SUPPORT_alignof (CXXOMFORT_CXX_STD >= 2011 || CXXOMFORT_COMPILER_VERSION>=209)
#undef  CXXO_COMPILER_SUPPORT_alignment_tools
#define CXXO_COMPILER_SUPPORT_alignment_tools __has_extension(cxx_alignas)
#undef  CXXO_COMPILER_SUPPORT_attribute
#define CXXO_COMPILER_SUPPORT_attribute __has_feature(cxx_attributes)
#undef  CXXO_COMPILER_SUPPORT_auto
#define CXXO_COMPILER_SUPPORT_auto __has_feature(cxx_auto_type)
#undef  CXXO_COMPILER_SUPPORT_constexpr
#define CXXO_COMPILER_SUPPORT_constexpr __has_feature(cxx_constexpr)
#undef  CXXO_COMPILER_SUPPORT_decltype
#define CXXO_COMPILER_SUPPORT_decltype __has_extension(cxx_decltype_incomplete_return_types)
#undef  CXXO_COMPILER_SUPPORT_default_delete
#define CXXO_COMPILER_SUPPORT_default_delete (__has_extension(cxx_defaulted_functions) * __has_extension(cxx_deleted_functions))
#undef  CXXO_COMPILER_SUPPORT_enum_class
#define CXXO_COMPILER_SUPPORT_enum_class __has_feature(cxx_strong_enums)
#undef  CXXO_COMPILER_SUPPORT_explicit_operator
#define CXXO_COMPILER_SUPPORT_explicit_operator __has_feature(cxx_explicit_conversions)
#undef  CXXO_COMPILER_SUPPORT_foreach
#define CXXO_COMPILER_SUPPORT_foreach __has_extension(cxx_range_for)
#undef  CXXO_COMPILER_SUPPORT_initializer_list
#define CXXO_COMPILER_SUPPORT_initializer_list __has_extension(cxx_inheriting_constructors)
#undef  CXXO_COMPILER_SUPPORT_local_types
#define CXXO_COMPILER_SUPPORT_local_types __has_extension(cxx_local_type_template_args)
#undef  CXXO_COMPILER_SUPPORT_noexcept

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

83
84
85
86
87
88
89


90
91
92
93
94
95
96
...
115
116
117
118
119
120
121
122
123
124
125


126
127
128
129
130
131
132
...
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/** GCC old versions define __cplusplus to be 1 but still have 
 * some good C++1997 and C++2003 support.
 * */
#if (CXXOMFORT_COMPILER_VERSION >= 400 && CXXOMFORT_COMPILER_VERSION <= 406 \
&& CXXOMFORT_CXX_STD<10)
	#undef  CXXOMFORT_CXX_STD
	#define CXXOMFORT_CXX_STD 1997


#endif

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

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

#if (CXXOMFORT_CXX_STD >= 1997 && CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011)


	#undef  CXXOFLAG_tr1
	#define CXXOFLAG_tr1 1
#endif

// set up TR1 headers
#if (CXXOFLAG_tr1 > 0)
	// TR1 stuff is under directory tr1/
................................................................................
	#define CXXO_CXXSTDHEADER_tr1_cstdint 1
	#define CXXO_CXXSTDHEADER_tr1_cinttypes 1
	#define CXXO_CXXSTDHEADER_tr1_random 1
	#define CXXO_CXXSTDHEADER_tr1_tuple 1
	#define CXXO_CXXSTDHEADER_tr1_type_traits 1
#endif

#if (CXXOFLAG_tr1  && CXXOMFORT_CXX_EMULATION < 2011)
	#define CXXOFLAG_namespace_tr1 1
	#undef  CXXO_STDTR1_NAME
	#define CXXO_STDTR1_NAME() std::tr1
	#undef  CXXO_STDTR1_OPEN
	#define CXXO_STDTR1_OPEN() namespace std { namespace tr1 {
	#undef  CXXO_STDTR1_CLOSE
	#define CXXO_STDTR1_CLOSE() } }







>
>







 







|


|
>
>







 







|







83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
...
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/** GCC old versions define __cplusplus to be 1 but still have 
 * some good C++1997 and C++2003 support.
 * */
#if (CXXOMFORT_COMPILER_VERSION >= 400 && CXXOMFORT_COMPILER_VERSION <= 406 \
&& CXXOMFORT_CXX_STD<10)
	#undef  CXXOMFORT_CXX_STD
	#define CXXOMFORT_CXX_STD 1997
	#undef  CXXOMFORT_CXX_EMULATION
	#define CXXOMFORT_CXX_EMULATION 1997
#endif

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

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

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

// set up TR1 headers
#if (CXXOFLAG_tr1 > 0)
	// TR1 stuff is under directory tr1/
................................................................................
	#define CXXO_CXXSTDHEADER_tr1_cstdint 1
	#define CXXO_CXXSTDHEADER_tr1_cinttypes 1
	#define CXXO_CXXSTDHEADER_tr1_random 1
	#define CXXO_CXXSTDHEADER_tr1_tuple 1
	#define CXXO_CXXSTDHEADER_tr1_type_traits 1
#endif

#if (CXXOFLAG_tr1  && CXXOMFORT_CXX_EMULATION == 2007)
	#define CXXOFLAG_namespace_tr1 1
	#undef  CXXO_STDTR1_NAME
	#define CXXO_STDTR1_NAME() std::tr1
	#undef  CXXO_STDTR1_OPEN
	#define CXXO_STDTR1_OPEN() namespace std { namespace tr1 {
	#undef  CXXO_STDTR1_CLOSE
	#define CXXO_STDTR1_CLOSE() } }

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

71
72
73
74
75
76
77
78




79
80
81
82
83
84

85
86
87
88
89
90
91
...
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1)
    #pragma message CXXO_NOTICE("Using Windows+MSC include paths: " ) 
    #pragma message CXXO_NOTICE( CXXO_STRINGIZE1(CXXO_INCLUDE_SYS(name)) ) 
#endif


// At least VC2005
#if (CXXOMFORT_COMPILER_VERSION > 1300)




#endif


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


		#undef  CXXOFLAG_tr1
		#define CXXOFLAG_tr1 1

		#undef  CXXO_CXXSTDHEADER_array
		#define CXXO_CXXSTDHEADER_array 1
		#undef  CXXO_CXXSTDHEADER_random
		#define CXXO_CXXSTDHEADER_random 1
................................................................................
		#undef  CXXO_STDTR1_CLOSE
		#define CXXO_STDTR1_CLOSE() } }
		#if (defined(CXXOMFORT_NOTICES) && CXXOMFORT_NOTICES > 1)
			#pragma message CXXO_NOTICE ("namespace tr1")
		#endif

    #endif
    #undef  CXXO_COMPILER_SUPPORT_type_intrinsics
    #define CXXO_COMPILER_SUPPORT_type_intrinsics 1
    #undef  CXXO_COMPILER_SUPPORT_va_args
    #define CXXO_COMPILER_SUPPORT_va_args 1
    
#endif

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







|
>
>
>
>

<



|
>







 







<
<







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
...
111
112
113
114
115
116
117


118
119
120
121
122
123
124
#if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1)
    #pragma message CXXO_NOTICE("Using Windows+MSC include paths: " ) 
    #pragma message CXXO_NOTICE( CXXO_STRINGIZE1(CXXO_INCLUDE_SYS(name)) ) 
#endif


// At least VC2005
#if (CXXOMFORT_COMPILER_VERSION >= 1400)
	#undef  CXXOFLAG_tr1
	#define CXXOFLAG_tr1 0
    #undef  CXXO_COMPILER_SUPPORT_type_intrinsics
    #define CXXO_COMPILER_SUPPORT_type_intrinsics 1
#endif


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

		#undef  CXXO_CXXSTDHEADER_array
		#define CXXO_CXXSTDHEADER_array 1
		#undef  CXXO_CXXSTDHEADER_random
		#define CXXO_CXXSTDHEADER_random 1
................................................................................
		#undef  CXXO_STDTR1_CLOSE
		#define CXXO_STDTR1_CLOSE() } }
		#if (defined(CXXOMFORT_NOTICES) && CXXOMFORT_NOTICES > 1)
			#pragma message CXXO_NOTICE ("namespace tr1")
		#endif

    #endif


    #undef  CXXO_COMPILER_SUPPORT_va_args
    #define CXXO_COMPILER_SUPPORT_va_args 1
    
#endif

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

Changes to cxxomfort/cxxomfort/cxxomfort.hpp.

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
..
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
81
82
83
84
85
86
87
88
89
90
91
 * </tr><tr>
 *  <th rowspan="2">Backports & Standard&nbsp;C++</th>
 *  <td align="center"> *  <strong>Backports</strong> 
 *  <tt>#include <cxxomfort/backports.hpp></tt><br/>
 *  @subpage cxx03-backports "C++03" -- @subpage cxx11-backports "C++11" --  @subpage cxx14-backports "C++14" -- @subpage cxx17-backports "C++17" --  @subpage cxx20-backports "C++20?"
 *  </td>
 *  </tr><tr><td align="center">
 * @subpage std0cstddef "<cstddef>" - @subpage std0cstdint "<cstdint>" - <cstdio> - @subpage std0cuchar "<cuchar>" 
 <br/> @subpage std0algorithm "<algorithm>" - @subpage std0functional "<functional>" -  @subpage std0iterator "<iterator>" - @subpage std0numeric "<numeric>" - @subpage std0string "<string>" - @subpage std0string_view "<string_view>" 
 <br/> @subpage std0limits "<limits>" - @subpage std0memory "<memory>" - @subpage std0tuple "<tuple>" - @subpage std0utility "<utility>" 
 <br/> @subpage std0type_traits "<type_traits>" - @subpage std0typeindex "<typeindex>" 
 <br/> @subpage std0array "<array>" - @subpage std0forward_list "<forward_list>" 
 <br/> @subpage std0random "<random>" - @subpage std0system_error "<system_error>"
 * <br/>  @subpage transparent-headers "Transparent Headers" -- @subpage cxxomfort-fix "Fixes to implementation issues"
 * </td>
................................................................................
 * <br/>
 * Supplementals for Standard C++ Headers
 * </td></tr>
 * <tr><td style="text-align:center;">  @cxxowiki{Extras,Extra Projects}</a>
 * </td></tr>
 * </table>
 * 
 *
 * <table>
 * <tr><th colspan="9"> Installation and Usage </th></tr>
 * <tr><td> @cxxowiki{Installation,Installation}   </td>
 *  <td> @cxxowiki{Configuration,Configuration} </td>
 *  <td> <a href="http://ryan.gulix.cl/fossil.cgi/cxxomfort/ticket" target="_blank">Tickets & Reports</a>
 * </tr>
 * </table>
 * 
 * 
 * <h2>Licensing Terms</h2>
 * 
 * This library is distributed under the terms of the
 * MIT License. Check @ref LICENSE.txt for more information.
 * 
 */

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

// Backports
#include "backports.hpp"

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


#endif







|







 







<
<
<
<
<
<
<
<
<
<







 







|



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
..
55
56
57
58
59
60
61










62
63
64
65
66
67
68
..
71
72
73
74
75
76
77
78
79
80
81
 * </tr><tr>
 *  <th rowspan="2">Backports & Standard&nbsp;C++</th>
 *  <td align="center"> *  <strong>Backports</strong> 
 *  <tt>#include <cxxomfort/backports.hpp></tt><br/>
 *  @subpage cxx03-backports "C++03" -- @subpage cxx11-backports "C++11" --  @subpage cxx14-backports "C++14" -- @subpage cxx17-backports "C++17" --  @subpage cxx20-backports "C++20?"
 *  </td>
 *  </tr><tr><td align="center">
 * @subpage std0cstddef "<cstddef>" - @subpage std0cstdint "<cstdint>" - <cstdio> - @subpage std0ctime "<ctime>" - @subpage std0cuchar "<cuchar>" 
 <br/> @subpage std0algorithm "<algorithm>" - @subpage std0functional "<functional>" -  @subpage std0iterator "<iterator>" - @subpage std0numeric "<numeric>" - @subpage std0string "<string>" - @subpage std0string_view "<string_view>" 
 <br/> @subpage std0limits "<limits>" - @subpage std0memory "<memory>" - @subpage std0tuple "<tuple>" - @subpage std0utility "<utility>" 
 <br/> @subpage std0type_traits "<type_traits>" - @subpage std0typeindex "<typeindex>" 
 <br/> @subpage std0array "<array>" - @subpage std0forward_list "<forward_list>" 
 <br/> @subpage std0random "<random>" - @subpage std0system_error "<system_error>"
 * <br/>  @subpage transparent-headers "Transparent Headers" -- @subpage cxxomfort-fix "Fixes to implementation issues"
 * </td>
................................................................................
 * <br/>
 * Supplementals for Standard C++ Headers
 * </td></tr>
 * <tr><td style="text-align:center;">  @cxxowiki{Extras,Extra Projects}</a>
 * </td></tr>
 * </table>
 * 










 * <h2>Licensing Terms</h2>
 * 
 * This library is distributed under the terms of the
 * MIT License. Check @ref LICENSE.txt for more information.
 * 
 */

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

// Backports
#include "backports.hpp"

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


#endif

Changes to cxxomfort/cxxomfort/functional.hpp.

54
55
56
57
58
59
60



61
62
63
64
65
66
67
		#if defined(CXXOFLAG_USE_INTERNAL_TR1)
		#endif

	#endif // compiler
#else
	// before support for TR1
	#if defined(CXXOFLAG_USE_INTERNAL_TR1)



		#include "./impl/07-reference_wrapper.hpp"
		#include "./impl/07-hash.hpp"
	#endif
#endif // c++ pre-11, tr1


namespace cxxomfort {







>
>
>







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
		#if defined(CXXOFLAG_USE_INTERNAL_TR1)
		#endif

	#endif // compiler
#else
	// before support for TR1
	#if defined(CXXOFLAG_USE_INTERNAL_TR1)
		#if (CXXOMFORT_NOTICES > 1)
			#pragma message CXXO_NOTICE("internal TR1: <functional>")
		#endif
		#include "./impl/07-reference_wrapper.hpp"
		#include "./impl/07-hash.hpp"
	#endif
#endif // c++ pre-11, tr1


namespace cxxomfort {

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

1
2
3
4
5
6
7
8




9
10
11
12
13
14
15
..
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
..
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
...
108
109
110
111
112
113
114

115
116
117
118
119
120
121
#ifndef CXXOMFORT_IMPL_03_STD_ARRAY_HPP
#define CXXOMFORT_IMPL_03_STD_ARRAY_HPP
/**
 * @file
 * 
 * This file is intended to be included only in circumstances where 
 * cxxomfort detects there is not an <array> or <tr1/array> available 
 * (detection which has yet to be implemented via CXXOFLAG_NO_TR1 )




 */
#include <cxxomfort/base.hpp>
#include <cxxomfort/impl/relationals.hpp>
#include CXXO_INCLUDE_SYS(iterator)
#include CXXO_INCLUDE_SYS(algorithm)
#define CXXOMFORT_IMPLEMENTS_n1479 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_std_array CXXOMFORT_IMPLEMENTS_n1479
................................................................................
    typedef typename detail::add_pointer<const_value_type>::type const_pointer;
    
    typedef T&           reference;
    typedef T const&     const_reference;
    
    typedef pointer           iterator;
    typedef const_pointer     const_iterator;
    typedef typename std::reverse_iterator<iterator>::type reverse_iterator;
    typedef typename std::reverse_iterator<const_iterator>::type const_reverse_iterator;
    
    
    pointer         data () CXXO_NOEXCEPTNOTHROW { return elems; }
    const_pointer   data () const CXXO_NOEXCEPTNOTHROW { return elems; }
    size_t     size () const CXXO_NOEXCEPTNOTHROW { return N; }
    size_t     max_size () const CXXO_NOEXCEPTNOTHROW { return N; }
    bool       empty () const CXXO_NOEXCEPTNOTHROW { return false; }
................................................................................
        std::fill(this->begin(), this->end(), t);
    }
    
    friend bool operator== (array const& a1, array const& a2) {
        return std::equal(a1.begin(), a1.end(), a2.begin());
    }
    friend bool operator< (array const& a1, array const& a2) {
        return std::lexicographical_compare(a1.begin(), a1.end(), a2.begin());
    }

    private:
    T elems[N];
};

#define TARGS T,N
................................................................................
}

template <size_t I, typename T, size_t N>
T& get (array<T,N>& a) CXXO_NOEXCEPTNOTHROW {
    static_assert(I<N, "invalid get<> in array");
    return a[I];
}


template <size_t I, typename T, size_t N>
T const& get (array<T,N> const& a) CXXO_NOEXCEPTNOTHROW {
    static_assert(I<N, "invalid get<> in array");
    return a[I];
}






|
|
<
>
>
>
>







 







|
|







 







|







 







>







1
2
3
4
5
6
7

8
9
10
11
12
13
14
15
16
17
18
..
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
..
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#ifndef CXXOMFORT_IMPL_03_STD_ARRAY_HPP
#define CXXOMFORT_IMPL_03_STD_ARRAY_HPP
/**
 * @file
 * 
 * This is an implementation of std::array 
 * not directly used by cxxomfort but made available for TR1 compatibility layers.

 * 
 * This file should end up included only when no TR1 has been found and 
 * the user has requested CXXO_USE_INTERNAL_TR1.
 * 
 */
#include <cxxomfort/base.hpp>
#include <cxxomfort/impl/relationals.hpp>
#include CXXO_INCLUDE_SYS(iterator)
#include CXXO_INCLUDE_SYS(algorithm)
#define CXXOMFORT_IMPLEMENTS_n1479 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_std_array CXXOMFORT_IMPLEMENTS_n1479
................................................................................
    typedef typename detail::add_pointer<const_value_type>::type const_pointer;
    
    typedef T&           reference;
    typedef T const&     const_reference;
    
    typedef pointer           iterator;
    typedef const_pointer     const_iterator;
    typedef std::reverse_iterator<iterator> reverse_iterator;
    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
    
    
    pointer         data () CXXO_NOEXCEPTNOTHROW { return elems; }
    const_pointer   data () const CXXO_NOEXCEPTNOTHROW { return elems; }
    size_t     size () const CXXO_NOEXCEPTNOTHROW { return N; }
    size_t     max_size () const CXXO_NOEXCEPTNOTHROW { return N; }
    bool       empty () const CXXO_NOEXCEPTNOTHROW { return false; }
................................................................................
        std::fill(this->begin(), this->end(), t);
    }
    
    friend bool operator== (array const& a1, array const& a2) {
        return std::equal(a1.begin(), a1.end(), a2.begin());
    }
    friend bool operator< (array const& a1, array const& a2) {
        return std::lexicographical_compare(a1.begin(), a1.end(), a2.begin(), a2.end());
    }

    private:
    T elems[N];
};

#define TARGS T,N
................................................................................
}

template <size_t I, typename T, size_t N>
T& get (array<T,N>& a) CXXO_NOEXCEPTNOTHROW {
    static_assert(I<N, "invalid get<> in array");
    return a[I];
}


template <size_t I, typename T, size_t N>
T const& get (array<T,N> const& a) CXXO_NOEXCEPTNOTHROW {
    static_assert(I<N, "invalid get<> in array");
    return a[I];
}

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

1
2










3
4
5
6
7
8
9
10
11
12



13
14
15
16
17
18
19
#ifndef CXXOMFORT_IMPL_03_HASH_HPP
#define CXXOMFORT_IMPL_03_HASH_HPP












#include <cxxomfort/config.hpp>

#if (CXXOFLAG_tr1==0 || CXXOMFORT_CXX_STD < 2011)
/* 
 * Note: 
 * We declare hash in namespace std:: , since 
 * users have to be able to specialize it.
 * */




namespace std {

template <typename t> struct hash {};

#define CXXO_HASH_NATIVE(T) \
template <> struct hash< T > { \


>
>
>
>
>
>
>
>
>
>










>
>
>







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_IMPL_03_HASH_HPP
#define CXXOMFORT_IMPL_03_HASH_HPP
/**
 * @file
 * 
 * This is an implementation of std::hash 
 * not directly used by cxxomfort but made available for TR1 compatibility layers.
 * 
 * This file should end up included only when no TR1 has been found and 
 * the user has requested CXXO_USE_INTERNAL_TR1.
 * 
 */


#include <cxxomfort/config.hpp>

#if (CXXOFLAG_tr1==0 || CXXOMFORT_CXX_STD < 2011)
/* 
 * Note: 
 * We declare hash in namespace std:: , since 
 * users have to be able to specialize it.
 * */
#if (CXXOMFORT_NOTICES > 2)
	#pragma message CXXO_NOTICE("std::hash")
#endif

namespace std {

template <typename t> struct hash {};

#define CXXO_HASH_NATIVE(T) \
template <> struct hash< T > { \

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

1
2
3
4
5






6
7
8
9
10
11
12
..
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef CXXOMFORT_IMPL_REFERENCE_WRAPPER_HPP
#define CXXOMFORT_IMPL_REFERENCE_WRAPPER_HPP
/**
 * @file
 *






 */

#include "../config.hpp"
#include "11-addressof.hpp"
#define CXXOMFORT_IMPLEMENTS_n1436 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_n1453 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_reference_wrapper CXXOMFORT_IMPLEMENTS_n1453
................................................................................
template <typename T>
struct reference_wrapper {
    public:
    typedef T value_type;
    explicit reference_wrapper(T& t) CXXO_NOEXCEPT 
    : v(std::addressof(t)) {}

    // the copy-ctor and assignment are trivial in C++11
	#if (CXXOMFORT_CXX_STD >= 2011)
	constexpr reference_wrapper (reference_wrapper const& ) noexcept = default;
	reference_wrapper& operator= (reference_wrapper const&) noexcept = default;
    reference_wrapper(T&&) = delete;
	#else
	reference_wrapper (reference_wrapper const& R) CXXO_NOEXCEPTNOTHROW
	: :v(R.get()){} 

    reference_wrapper& operator= (reference_wrapper const& R) CXXO_NOEXCEPTNOTHROW {
        v= R.v;
        return *this;
    }
	#endif

    #if (CXXOMFORT_CXX_STD>=2011)
    #endif


    T& get () const CXXO_NOEXCEPTNOTHROW { return v; }
    operator T& () const CXXO_NOEXCEPTNOTHROW { return v; }

    #if (CXXOMFORT_CXX_STD>=2011)
    template< class... ArgTypes >
    typename std::result_of<T&(ArgTypes&&...)>::type
    operator() ( ArgTypes&&... args ) const; {
        return get()(std::forward<ArgTypes>(args)...);
    }
    #elif (CXXO_COMPILER_SUPPORT_typeof)
    __typeof__( std::declval<T>() ) 
    operator() () const {
        return get()();
    }
    template <typename T1>
    __typeof__( std::declval<T>()(std::declval<T1>()) )
    operator() (T1 const& a1) const {
        return get()(a1);




|
>
>
>
>
>
>







 







|
<
<
<
<
<


>




<
<
<
<





<
<
<
<
<
<
|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
..
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_REFERENCE_WRAPPER_HPP
#define CXXOMFORT_IMPL_REFERENCE_WRAPPER_HPP
/**
 * @file
 * 
 * This is an implementation of std::reference_wrapper and allies 
 * not directly used by cxxomfort but made available for TR1 compatibility layers.
 * 
 * This file should end up included only when no TR1 has been found and 
 * the user has requested CXXO_USE_INTERNAL_TR1.
 * 
 */

#include "../config.hpp"
#include "11-addressof.hpp"
#define CXXOMFORT_IMPLEMENTS_n1436 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_n1453 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_reference_wrapper CXXOMFORT_IMPLEMENTS_n1453
................................................................................
template <typename T>
struct reference_wrapper {
    public:
    typedef T value_type;
    explicit reference_wrapper(T& t) CXXO_NOEXCEPT 
    : v(std::addressof(t)) {}

	//! copy-ctor





	reference_wrapper (reference_wrapper const& R) CXXO_NOEXCEPTNOTHROW
	: :v(R.get()){} 
	//! Assignment operator
    reference_wrapper& operator= (reference_wrapper const& R) CXXO_NOEXCEPTNOTHROW {
        v= R.v;
        return *this;
    }






    T& get () const CXXO_NOEXCEPTNOTHROW { return v; }
    operator T& () const CXXO_NOEXCEPTNOTHROW { return v; }







	#if (CXXO_COMPILER_SUPPORT_typeof)
    __typeof__( std::declval<T>()() ) 
    operator() () const {
        return get()();
    }
    template <typename T1>
    __typeof__( std::declval<T>()(std::declval<T1>()) )
    operator() (T1 const& a1) const {
        return get()(a1);

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

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 * @brief Implementation of std::addressof 
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 *
 */

#include "../config.hpp"

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

namespace cxxomfort {
namespace cxxostd {







|







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 * @brief Implementation of std::addressof 
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 *
 */

#include "../config.hpp"

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

namespace cxxomfort {
namespace cxxostd {

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

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 * */

#if (defined(CXXOMFORT_NOTICES) && CXXOMFORT_NOTICES>2)
    #pragma message CXXO_NOTICE("common_type trait specifics")
#endif

#include "../util/type_traits.hpp"
#include <type_traits>
#include <cxxomfort/utility.hpp> // std::declval
#include "11-decay.hpp"
#include "17-void_t.hpp"
#include <ciso646>

namespace cxxomfort { namespace cxxostd {








|







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 * */

#if (defined(CXXOMFORT_NOTICES) && CXXOMFORT_NOTICES>2)
    #pragma message CXXO_NOTICE("common_type trait specifics")
#endif

#include "../util/type_traits.hpp"
#include <cxxomfort/type_traits.hpp>
#include <cxxomfort/utility.hpp> // std::declval
#include "11-decay.hpp"
#include "17-void_t.hpp"
#include <ciso646>

namespace cxxomfort { namespace cxxostd {

Deleted cxxomfort/cxxomfort/impl/11-reference_wrapper.hpp.

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

#include "../config.hpp"
#include "11-addressof.hpp"
#define CXXOMFORT_IMPLEMENTS_n1436 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_n1453 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_reference_wrapper CXXOMFORT_IMPLEMENTS_n1453

namespace cxxomfort {
namespace cxxostd {

/**
 * @brief reference_wrapper from C++11.
 * @anchor reference_wrapper
 */
template <typename T>
struct reference_wrapper {
    public:
    typedef T value_type;
    explicit reference_wrapper(T& t) CXXO_NOEXCEPT 
    : v(std::addressof(t)) {}

    // in c++11, trivial copy-ctor
    reference_wrapper(reference_wrapper const& R) CXXO_NOEXCEPT 
    CXXOMFORT_CXX11_CODE( = default, :v(R.get){} );

    #if (CXXOMFORT_CXX_STD>=2011)
    reference_wrapper(T&&) = delete;
    #endif

    // in c++11, assignment is trivial
    #if (CXXOMFORT_CXX_STD >= 2011)
    reference_wrapper& operator= (reference_wrapper const& R) CXXO_NOEXCEPT {
        v= R.v;
        return *this;
    }
    #else
    reference_wrapper& operator= (reference_wrapper const&) CXXO_NOEXCEPT = default;
    #endif

    T& get () const CXXO_NOEXCEPT { return v; }
    operator T& () const CXXO_NOEXCEPT { return v; }


    #if (CXXOMFORT_CXX_STD>=2011)
    template< class... ArgTypes >
    typename std::result_of<T&(ArgTypes&&...)>::type
    operator() ( ArgTypes&&... args ) const; {
        return get()(std::forward<ArgTypes>(args)...);
    }
    #else
    typename std::result_of< T&() >::type
    operator() () const {
        return get()();
    }
    template <typename T1>
    typename std::result_of< T&(T1) >::type
    operator() (T1 const& a1) const {
        return get()(a1);
    }
    template <typename T1, typename T2>
    typename std::result_of< T&(T1,T2) >::type
    operator() (T1 const& a1, T2 const& a2) const {
        return get()(a1,a2);
    }
    #endif
    
    private:
    T* v;
};

template <typename T>
reference_wrapper<T> ref (T& t) CXXO_NOEXCEPT {
    return reference_wrapper<T>(t);
}

template <typename T>
reference_wrapper<T const> cref (T const& t) CXXO_NOEXCEPT {
    return reference_wrapper<T const>(t);
}


}
}

#endif // file
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































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

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

/*
 * Support for getting elements of a tuple by type
 * (C++14 proposal n3584 "Wording for Addressing Tuples by Type")
 * based off of n3404 and n3584
 * http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2013/n3584.html
 * 
 * Interfaces defined in this header:
 * 
 * 
 */

#include <cxxomfort/base.hpp>
#include <typeinfo>
#include <cxxomfort/functional.hpp> // std::hash







<
<
<
<
<
<







1
2
3
4
5
6
7






8
9
10
11
12
13
14
#ifndef CXXOMFORT_IMPL_TYPEINDEX_TYPE_INDEX_HPP
#define CXXOMFORT_IMPL_TYPEINDEX_TYPE_INDEX_HPP
/**
 * @file
 */

/*






 * 
 * 
 */

#include <cxxomfort/base.hpp>
#include <typeinfo>
#include <cxxomfort/functional.hpp> // std::hash

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

2
3
4
5
6
7
8

9
10
11
12
13
14
15
..
32
33
34
35
36
37
38
39

40
41
42
43
44
45
46
#define CXXOMFORT_IMPL_UNDERLYING_TYPE_HPP

/**
 * @file
 */
#include <cxxomfort/config.hpp>
#include <cxxomfort/util/type_traits.hpp> // make_signed

#include <cxxomfort/impl/11-conditional.hpp> // make_signed
#include <cxxomfort/impl/zzzvarious.hpp> // integral_of_size


#define CXXOMFORT_IMPLEMENTS_n2984_1055 CXXO_IMPLSTATUS_EMULATION()
#define CXXOMFORT_IMPLEMENTS_underlying_type CXXOMFORT_IMPLEMENTS_n2984_1055

................................................................................
        #if (CXXOMFORT_COMPILER_VERSION<1700)
            #define CXXOMFORT_USING_underlying_type 1
        #endif
    #endif
#endif // support for underlying_type

#if (defined(DOXYGEN_DOC) || defined(CXXOMFORT_USING_underlying_type))
    #include <type_traits>

    #if defined (CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1)
        #pragma message CXXO_WARNING( " cxxomfort library - enabled underlying_type helper" )
    #endif

    #if (CXXOMFORT_CXX_STD < 2011)
namespace {
    using cxxomfort::traits::make_signed;







>







 







|
>







2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
..
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#define CXXOMFORT_IMPL_UNDERLYING_TYPE_HPP

/**
 * @file
 */
#include <cxxomfort/config.hpp>
#include <cxxomfort/util/type_traits.hpp> // make_signed
#include <cxxomfort/type_traits.hpp>
#include <cxxomfort/impl/11-conditional.hpp> // make_signed
#include <cxxomfort/impl/zzzvarious.hpp> // integral_of_size


#define CXXOMFORT_IMPLEMENTS_n2984_1055 CXXO_IMPLSTATUS_EMULATION()
#define CXXOMFORT_IMPLEMENTS_underlying_type CXXOMFORT_IMPLEMENTS_n2984_1055

................................................................................
        #if (CXXOMFORT_COMPILER_VERSION<1700)
            #define CXXOMFORT_USING_underlying_type 1
        #endif
    #endif
#endif // support for underlying_type

#if (defined(DOXYGEN_DOC) || defined(CXXOMFORT_USING_underlying_type))
    //#include <type_traits>
    //#include <cxxomfort/type_traits.hpp>
    #if defined (CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1)
        #pragma message CXXO_WARNING( " cxxomfort library - enabled underlying_type helper" )
    #endif

    #if (CXXOMFORT_CXX_STD < 2011)
namespace {
    using cxxomfort::traits::make_signed;

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

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#define CXXOMFORT_IMPL_ALGORITHM_14EQUAL_HPP
/**
 * @file
 * @brief Implementation of C++14's overloads for @c equal(), @c mismatch() .
 * */
#include <cxxomfort/base.hpp>
#include "../algorithm.hpp"
#include <cxxomfort/type_traits.hpp>
// <algorithm> should have been included already

#define CXXOMFORT_IMPLEMENTS_n3671 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_two_ranges_equal_mismatch CXXOMFORT_IMPLEMENTS_n3671

namespace cxxomfort {
namespace cxxostd {







|







2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#define CXXOMFORT_IMPL_ALGORITHM_14EQUAL_HPP
/**
 * @file
 * @brief Implementation of C++14's overloads for @c equal(), @c mismatch() .
 * */
#include <cxxomfort/base.hpp>
#include "../algorithm.hpp"
//#include <cxxomfort/type_traits.hpp>
// <algorithm> should have been included already

#define CXXOMFORT_IMPLEMENTS_n3671 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_two_ranges_equal_mismatch CXXOMFORT_IMPLEMENTS_n3671

namespace cxxomfort {
namespace cxxostd {

Changes to cxxomfort/cxxomfort/impl/14-functional-transparent.hpp.

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

#include CXXO_INCLUDE_SYS(functional)
// <functional> needs to be #included for this to make any sense
#if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1)
#pragma message CXXO_NOTICE("enabled <functional> transparent functors")
#endif

#include <type_traits> // common_type
#include "../type_traits.hpp"
#include "../impl/11-common_type.hpp"

namespace cxxomfort {
namespace cxxostd {

/**







|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

#include CXXO_INCLUDE_SYS(functional)
// <functional> needs to be #included for this to make any sense
#if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 1)
#pragma message CXXO_NOTICE("enabled <functional> transparent functors")
#endif

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

namespace cxxomfort {
namespace cxxostd {

/**

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

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

52
53
54
55
56
57
58
59
/**
 * @ingroup cxx14-backports
 * @{
 */
template <typename T, T... Elems>
struct integer_sequence {
    typedef T type;
    static const size_t size= sizeof...(Elems);
}; 

template <typename T, size_t N, size_t ...Is>
struct make_integer_sequence 
: make_integer_sequence<T, N-1, N-1, Is...> {};

template <typename T, size_t ...Is>
struct make_integer_sequence<T, 0, Is...>
: integer_sequence<T, Is...> {};

template <size_t... Is>
struct index_sequence
: integer_sequence<size_t, Is...> {};

template <size_t N, size_t ...Is>
struct make_index_sequence
: make_index_sequence<N-1,N-1,Is...> {};

template <size_t ...Is>
struct make_index_sequence<0, Is...>
: index_sequence<Is...> {};

template <typename ...Types>
struct index_sequence_for 

: make_index_sequence<sizeof...(Types)> {};

# if 0
// https://gist.github.com/sahchandler/8d13f0935a0511af8d1d/520903a0b187a87be66cf99977126cc4db4e431a

/**
 * @struct integer_sequence
 * @brief A type that packs a sequence of integers.







|










|
|
<

|
|
<

<
<
<

<
<
>
|







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
/**
 * @ingroup cxx14-backports
 * @{
 */
template <typename T, T... Elems>
struct integer_sequence {
    typedef T type;
    static constexpr size_t size () { return sizeof...(Elems); }
}; 

template <typename T, size_t N, size_t ...Is>
struct make_integer_sequence 
: make_integer_sequence<T, N-1, N-1, Is...> {};

template <typename T, size_t ...Is>
struct make_integer_sequence<T, 0, Is...>
: integer_sequence<T, Is...> {};

template <std::size_t... N>
using index_sequence = integer_sequence<std::size_t, N...>;


template <std::size_t... N>
using make_index_sequence = make_integer_sequence<std::size_t, N...>;








template<class... T>
using index_sequence_for = make_index_sequence<sizeof...(T)>;

# if 0
// https://gist.github.com/sahchandler/8d13f0935a0511af8d1d/520903a0b187a87be66cf99977126cc4db4e431a

/**
 * @struct integer_sequence
 * @brief A type that packs a sequence of integers.

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

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82


83
84
85
86
87
88
89
...
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
to_byte (I i) noexcept {
	return byte{i};
}
	
} }  // cxxomfort::cxxostd

#elif (CXXOMFORT_CXX_STD>=2011)
	// implement using enum class
	#define CXXOMFORT_IMPLEMENTS_p0298r3 CXXO_IMPLSTATUS_BACKPORT()

namespace cxxomfort { namespace cxxostd {

enum class byte : unsigned char {};

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

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


} } // cxxomfort::cxxostd

#elif (0&&CXXOMFORT_CXX_STD>=1997)
	// implement using typesafe_enum



	#define CXXOMFORT_IMPLEMENTS_p0298r3 CXXO_IMPLSTATUS_EMULATION()

#include "typesafe_enum-core.hpp"

namespace cxxomfort { namespace cxxostd {

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

} }  // cxxomfort::cxxostd


#else 
	// implement using a simple struct
	#define CXXOMFORT_IMPLEMENTS_p0298r3 CXXO_IMPLSTATUS_EMULATION()

namespace cxxomfort { namespace cxxostd {

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







<







|





|







|
|
>
>







 







|







52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
...
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
to_byte (I i) noexcept {
	return byte{i};
}
	
} }  // cxxomfort::cxxostd

#elif (CXXOMFORT_CXX_STD>=2011)

	#define CXXOMFORT_IMPLEMENTS_p0298r3 CXXO_IMPLSTATUS_BACKPORT()

namespace cxxomfort { namespace cxxostd {

enum class byte : unsigned char {};

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

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


} } // cxxomfort::cxxostd

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

	#define CXXOMFORT_IMPLEMENTS_p0298r3 CXXO_IMPLSTATUS_EMULATION()

#include "typesafe_enum-core.hpp"

namespace cxxomfort { namespace cxxostd {

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

} }  // cxxomfort::cxxostd


#else 
	// implement using a simple struct
	#define CXXOMFORT_IMPLEMENTS_p0298r3 3001

namespace cxxomfort { namespace cxxostd {

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

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

90
91
92
93
94
95
96


97
98
99
100
101
102
103
    using membertype::end;

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


    
    using membertype::front;
    using membertype::back;

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







>
>







90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
    using membertype::end;

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

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

Changes to cxxomfort/cxxomfort/impl/20-endian.hpp.

68
69
70
71
72
73
74
75


76
77
78

79
80
81
82
83
84
85
 * in a system with a different (non-little, non-big) endianness.
 * 
 * */

#if (CXXOMFORT_CXX_STD>=2011)
enum class endian { CXXO_endian_members() };
#else
namespace {


    struct def { enum type { CXXO_endian_members() }; };
}
typedef ::cxxomfort::impl::typesafe_enum<def,unsigned> endian;


#endif
#undef CXXO_endian_members

} // type_traits
}} // cxxomfort::std








<
>
>
|
|
<
>







68
69
70
71
72
73
74

75
76
77
78

79
80
81
82
83
84
85
86
 * in a system with a different (non-little, non-big) endianness.
 * 
 * */

#if (CXXOMFORT_CXX_STD>=2011)
enum class endian { CXXO_endian_members() };
#else


struct endian {
	enum type { CXXO_endian_members() };
};



#endif
#undef CXXO_endian_members

} // type_traits
}} // cxxomfort::std

Changes to cxxomfort/cxxomfort/impl/20-type_identity.hpp.

4
5
6
7
8
9
10
11


12
13
14
15

16

17
18
19
20
21
22
#include <cxxomfort/config.hpp>

// https://en.cppreference.com/w/cpp/types/type_identity

namespace cxxomfort {
namespace cxxostd {

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



}} // cxxomfort::std

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

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


#else

#endif

#endif







|
>
>




>
|
>






4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <cxxomfort/config.hpp>

// https://en.cppreference.com/w/cpp/types/type_identity

namespace cxxomfort {
namespace cxxostd {

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

}} // cxxomfort::std

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

#else

#endif

#endif

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

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


14



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#define CXXOMFORT_IMPL_HASH_HPP

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

#if (CXXOMFORT_CXX_STD >= 1997)

/**
 * @file 
 * @ingroup cxx14-backports


 * */



namespace cxxomfort {  namespace fix {

/**
 * @struct hash
 * @brief Specialization-friendly alternatve to @c std::hash .
 * 
 *  A version of @c std::hash that allows for better specialization. 
 * When not specialized, it just delegates to the already available 
 * specialization of @c std::hash .
 * 
 * @ingroup cxx14-backports
 * @xrefitem std0functional "<functional>" "Non-backport Assists"
 * @see 
 * * Documentation for C++ @c std::hash .
 * 
 */







<
<

|
<
>
>

>
>
>






|

|







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

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



/**
 * @file

 * @brief cxxomfort "fix" helper for <tt>std::hash</tt>.
 * 
 * */

#if (CXXOMFORT_CXX_STD >= 1997)

namespace cxxomfort {  namespace fix {

/**
 * @struct hash
 * @brief Specialization-friendly alternatve to @c std::hash .
 * 
 * A version of @c std::hash that allows for better specialization. 
 * When not specialized, it just delegates to the already available 
 * specialization of @c std::hash for the given template parameters.
 * 
 * @ingroup cxx14-backports
 * @xrefitem std0functional "<functional>" "Non-backport Assists"
 * @see 
 * * Documentation for C++ @c std::hash .
 * 
 */

Changes to cxxomfort/cxxomfort/impl/ic_types.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
..
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

75
76
77
#ifndef CXXOMFORT_IMPL_IC_TYPES_HPP
#define CXXOMFORT_IMPL_IC_TYPES_HPP



/**
 * @file 
 * @brief Implements shortcut types for @c std::integral_constant  
 * @sa bool_constant 
 *
 * Interfaces defined in this header:
 *
 * * iC - integral_constant of @c int type
 * * uC - integral_constant of @c unsigned @c int type
 * * huC - integral_constant of @c unsigned @c short type
 * * luC - integral_constant of @c unsigned @c long type
 * * juC - integral_constant of @c uintmax_t type
 * * zuC - integral_constant of @c size_t type
 * * integral_constant_cast
 * 
 * The library makes available, as supplements to @c integral_constant , 
 * a series of shortcut names for specific instantiations, using 
 * specific numeric types. These instantiations follow the naming scheme 
 * of the @c printf family format flags (eg.: "hu" for short unsigned).
 * 
 * @code

template <typename T> foo ();

namespace TT = cxxomfort::library::type_traits;

foo ( TT::juC<5>() ); // calls foo<std::integral_constant<uintmax_t,5> >

 * @endcode
 * 
 */

#include <cxxomfort/base.hpp>

#include <cxxomfort/type_traits.hpp> // std::integral_constant

namespace cxxomfort { namespace library { namespace type_traits {
namespace ic_types {

//! @c integral_constant using @c int as the subyacent type.
template <int X>
................................................................................
template <size_t X>
struct zuC : std::integral_constant<size_t,X> {};

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

} // ic_types
} } }




#endif  // guard


>
>
>

|
|
|










|
|
|
|

|









|



>







 







|







>



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
..
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef CXXOMFORT_IMPL_IC_TYPES_HPP
#define CXXOMFORT_IMPL_IC_TYPES_HPP

#if (CXXOMFORT_CXX_STD >= 1997)

/**
 * @file
 * @brief Implements shortcut types for @c std::integral_constant
 * @sa bool_constant
 *
 * Interfaces defined in this header:
 *
 * * iC - integral_constant of @c int type
 * * uC - integral_constant of @c unsigned @c int type
 * * huC - integral_constant of @c unsigned @c short type
 * * luC - integral_constant of @c unsigned @c long type
 * * juC - integral_constant of @c uintmax_t type
 * * zuC - integral_constant of @c size_t type
 * * integral_constant_cast
 *
 * The library makes available, as supplements to @c integral_constant ,
 * a series of shortcut names for specific instantiations, using
 * specific numeric types. These instantiations follow the naming scheme
 * of the @c printf family format flags (eg.: "hu" for short unsigned).
 *
 * @code

template <typename T> foo ();

namespace TT = cxxomfort::library::type_traits;

foo ( TT::juC<5>() ); // calls foo<std::integral_constant<uintmax_t,5> >

 * @endcode
 *
 */

#include <cxxomfort/base.hpp>
#include <cxxomfort/cstdint.hpp>
#include <cxxomfort/type_traits.hpp> // std::integral_constant

namespace cxxomfort { namespace library { namespace type_traits {
namespace ic_types {

//! @c integral_constant using @c int as the subyacent type.
template <int X>
................................................................................
template <size_t X>
struct zuC : std::integral_constant<size_t,X> {};

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

} // ic_types
} } }

#endif


#endif  // guard

Changes to cxxomfort/cxxomfort/impl/metaprogramming.hpp.

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

#include <cxxomfort/base.hpp>
#include <cxxomfort/util/type_traits.hpp>
#include <type_traits>
#include <cxxomfort/type_traits.hpp>
#if (CXXOMFORT_CXX_STD>=1997)

namespace cxxomfort {
namespace traits {

template <typename T>





|







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

#include <cxxomfort/base.hpp>
#include <cxxomfort/util/type_traits.hpp>
//#include <type_traits>
#include <cxxomfort/type_traits.hpp>
#if (CXXOMFORT_CXX_STD>=1997)

namespace cxxomfort {
namespace traits {

template <typename T>

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

6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
..
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
...
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173













174
175
176
177
178
179
180
**/

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


#define CXXOMFORT_IMPLEMENTS_n3334 CXXO_IMPLSTATUS_LIBRARY()
#define CXXOMFORT_IMPLEMENTS_array_ref CXXOMFORT_IMPLEMENTS_n3334

#if (defined(CXXOMFORT_NOTICES) && CXXOMFORT_NOTICES>1)
    #pragma message CXXO_NOTICE("enabled library: array_ref<T> implementation")
#endif
................................................................................
 * @tparam T Type of the kind of value contained in the view.
 * @ingroup cxxo-sup 
 * @xrefitem cxxo-sup "Supplements" "Container Supplements"
 * 
 * A @c array_ref is a non-owning view of a sequence of 
 * *contiguous* elements via a simple {pointer+length} package. 
 * In many ways it could be considered an analogue to 
 * <code>std::array</code> except it doesn't actually hold the data 
 * (hence the name, @c array_ref ).
 * 
 * It provides some of the same operatios available for readable
 * sequences, in particular begin() and end(). Because it points to 
 * an area of memory directly, iterators are raw pointer types.
 * 
 * This implementation is intended to be used for sequences of 
 * const elements (ie.: template argument is <code>T const</code>).
 * 
 * The utility function make_array_ref() helps create 
 * array_refs from contexts where they can be needed.
 * 
 * 
 * See also: <code>std::vector</code>, @c seq_ .
 * 
 * Differences from the original proposal:
 * 
 * * Allows for a @c array_ref of non-const objects.
 * * Adds ( @c pointer , @c pointer ) constructor.
 * * Discards @c vector constructor for lower dependency overhead.
 * * Adds member functions @c front , @c back .
................................................................................
    CXXO_CONSTEXPR 
    array_ref (std::array<T,N> const& arr) CXXO_NOEXCEPTNOTHROW
    : ptr_(arr.data()), len_(arr.size()) {}

    
    // access to elements

    // nonconst should only be enabled if T is nonconst
    reference       at (size_t i) { check_range(i); return ptr_[i]; }
    //! Checked access to i-th element; throws if the index is out of range.
    const_reference at (size_t i) const { check_range(i); return ptr_[i]; }
#if (CXXOMFORT_CXX_STD>=1997)
    //! Checked access to i-th element; sets up an @c error_code if the index is out of range.
    const_reference at (size_t i, std::error_code& ec) const { check_range(i,ec); return ptr_[i]; }
#endif
    //! Unchecked(!) access to the i-th element.
    CXXO_CONSTEXPR14
    reference       operator[] (size_t i) CXXO_NOEXCEPTNOTHROW { return ptr_[i]; }
    //! Unchecked(!) access to the i-th element.
    CXXO_CONSTEXPR 
    const_reference operator[] (size_t i) const CXXO_NOEXCEPTNOTHROW { return ptr_[i]; }













    
    // view info
    
    CXXO_CONSTEXPR size_t     max_size () const CXXO_NOEXCEPTNOTHROW { return len_; }
    //! @return size of the view as a @c size_t .
    CXXO_CONSTEXPR size_t     size () const CXXO_NOEXCEPTNOTHROW { return len_; }
    //! @return @c bool .







<



>







 







|
|

|
|
<




|



|







 







<
<
<
<
<
<
<
<






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







6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23
..
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
...
152
153
154
155
156
157
158








159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
**/

#include <cxxomfort/base.hpp>
#include <iterator>
#include <stdexcept>
#include <valarray> // maybe do away with this
#include <cxxomfort/cerrno.hpp>

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

#define CXXOMFORT_IMPLEMENTS_n3334 CXXO_IMPLSTATUS_LIBRARY()
#define CXXOMFORT_IMPLEMENTS_array_ref CXXOMFORT_IMPLEMENTS_n3334

#if (defined(CXXOMFORT_NOTICES) && CXXOMFORT_NOTICES>1)
    #pragma message CXXO_NOTICE("enabled library: array_ref<T> implementation")
#endif
................................................................................
 * @tparam T Type of the kind of value contained in the view.
 * @ingroup cxxo-sup 
 * @xrefitem cxxo-sup "Supplements" "Container Supplements"
 * 
 * A @c array_ref is a non-owning view of a sequence of 
 * *contiguous* elements via a simple {pointer+length} package. 
 * In many ways it could be considered an analogue to 
 * <tt>std::array</tt> except it doesn't actually hold the data 
 * (hence the name, @c array_ref ), and to <tt>std::reference_wrapper</tt>.
 * 
 * Being a reference/view type, it is good to pass by value. 
 * Also, iterator types are raw pointers.

 * 
 * This implementation is intended to be used for sequences of 
 * const elements (ie.: template argument is <code>T const</code>).
 * 
 * The utility function @c arrayref() and @c carrayref() help create 
 * array_refs from contexts where they can be needed.
 * 
 * 
 * See also: <tt>std::array</tt>, <tt>std::vector</tt>, @c seq_ .
 * 
 * Differences from the original proposal:
 * 
 * * Allows for a @c array_ref of non-const objects.
 * * Adds ( @c pointer , @c pointer ) constructor.
 * * Discards @c vector constructor for lower dependency overhead.
 * * Adds member functions @c front , @c back .
................................................................................
    CXXO_CONSTEXPR 
    array_ref (std::array<T,N> const& arr) CXXO_NOEXCEPTNOTHROW
    : ptr_(arr.data()), len_(arr.size()) {}

    
    // access to elements









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

    // nonconst should only be enabled if T is nonconst
    reference       at (size_t i) { check_range(i); return ptr_[i]; }
    //! Checked access to i-th element; throws if the index is out of range.
    const_reference at (size_t i) const { check_range(i); return ptr_[i]; }

	reference       at_or (size_t i, reference rx) { return i < size() ? ptr_[i] : rx; }
	const_reference at_or (size_t i, const_reference rx) const { return i < size() ? ptr_[i] : rx; }

#if (CXXOMFORT_CXX_STD>=2011)
    //! Checked access to i-th element; sets up an @c error_code if the index is out of range.
    const_reference at (size_t i, std::error_code& ec) const { check_range(i,ec); return ptr_[i]; }
#endif
    
    // view info
    
    CXXO_CONSTEXPR size_t     max_size () const CXXO_NOEXCEPTNOTHROW { return len_; }
    //! @return size of the view as a @c size_t .
    CXXO_CONSTEXPR size_t     size () const CXXO_NOEXCEPTNOTHROW { return len_; }
    //! @return @c bool .

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

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

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

//
// make_array
// contructs an object of std::array<T,N> type with automatically calculated N.
// See proposal:  http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2014/n4031.html
//





|
|







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

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

//
// make_array
// contructs an object of std::array<T,N> type with automatically calculated N.
// See proposal:  http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2014/n4031.html
//

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

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#define CXXOMFORT_IMPLEMENTS_function_ref CXXOMFORT_IMPLEMENTS_p0792


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

namespace cxxomfort { namespace impl {

template <typename Signature> class function_ref;


/**







<







11
12
13
14
15
16
17

18
19
20
21
22
23
24
#define CXXOMFORT_IMPLEMENTS_function_ref CXXOMFORT_IMPLEMENTS_p0792


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


namespace cxxomfort { namespace impl {

template <typename Signature> class function_ref;


/**

Changes to cxxomfort/cxxomfort/impl/seq_.hpp.

6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
..
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

// implementation of seq_<T>(), ...

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

namespace cxxomfort {

namespace impl {

template <typename Ty>
struct generate_seq_t {
    private:
    struct p_notype;
    
................................................................................
 * @endcode
 */
template <typename Ty>
generate_seq_t<Ty> seq_() {
    return generate_seq_t<Ty>();
}

}

//! @deprecated 
using impl::seq_;

} // cxxomfort

#endif







|
>







 







|

<


|


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
82
83
84
85
86
87
88
89
90

91
92
93
94
95

// implementation of seq_<T>(), ...

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

namespace cxxomfort { namespace library {

namespace impl {

template <typename Ty>
struct generate_seq_t {
    private:
    struct p_notype;
    
................................................................................
 * @endcode
 */
template <typename Ty>
generate_seq_t<Ty> seq_() {
    return generate_seq_t<Ty>();
}

} // impl::


using impl::seq_;

} } // cxxomfort::library

#endif

Added cxxomfort/cxxomfort/impl/to_basic_string_precxx.hpp.





















































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
#ifndef CXXOMFORT_IMPL_TO_BASIC_STRING_03_HPP
#define CXXOMFORT_IMPL_TO_BASIC_STRING_03_HPP

#include <cstring>
#include <strstream>
#include <ostream>
#include <cxxomfort/ios.hpp>

namespace cxxomfort { namespace impl {
namespace string {

namespace detail_string {

const struct no_t {} noitem;

template <typename Stream>
struct streamizer {
    streamizer (Stream& s)
    : stream(s)
    {
        using namespace std;
        stream.exceptions(ios_base::failbit | ios_base::badbit);
    }

    template <typename T>
    streamizer& operator<< (T const& t) const {
        stream<< t;
        return *this;
    }

    Stream& stream;

};


} // cxxomfort::library::string::detail_string

#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_OW)
}
}}

std::ostream&
operator<< (std::ostream& os, cxxomfort::impl::string::detail_string::no_t const& n) {
	(void)n;
	return os;
}

namespace cxxomfort { namespace impl {
namespace string {
#endif


template <typename Ch, typename Tr, typename Alloc
, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9
>
std::basic_string<Ch,Tr,Alloc>
to_basic_string
(T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, T5 const& t5, T6 const& t6, T7 const& t7, T8 const& t8, T9 const& t9) {
    using namespace std;
    typedef std::ostrstream stream_t;
    stream_t stream;
    //detail_string::streamizer<stream_t> s(stream);
    int dummy[] = { (stream<< t0, 0)
        , (stream<< t1, 0), (stream<< t2, 0), (stream<< t3, 0)
        , (stream<< t4, 0), (stream<< t5, 0), (stream<< t6, 0)
        , (stream<< t7, 0), (stream<< t8, 0), (stream<< t9, 0)
    };
    (void)dummy;
    return stream.str();

}

// 9 arguments
template <typename Ch, typename Tr, typename Alloc
, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8
>
std::basic_string<Ch,Tr,Alloc>
to_basic_string
(T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, T5 const& t5, T6 const& t6, T7 const& t7, T8 const& t8) {
    return to_basic_string<Ch,Tr,Alloc> (t0,t1,t2,t3,t4,t5,t6,t7,t8,detail_string::noitem);
}

// 8 arguments
template <typename Ch, typename Tr, typename Alloc
, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7
>
std::basic_string<Ch,Tr,Alloc>
to_basic_string
(T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, T5 const& t5, T6 const& t6, T7 const& t7) {
    return to_basic_string<Ch,Tr,Alloc> (t0,t1,t2,t3,t4,t5,t6,t7,detail_string::noitem, detail_string::noitem);
}

// 7 arguments
template <typename Ch, typename Tr, typename Alloc
, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6
>
std::basic_string<Ch,Tr,Alloc>
to_basic_string
(T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, T5 const& t5, T6 const& t6) {
    return to_basic_string<Ch,Tr,Alloc> (t0,t1,t2,t3,t4,t5,t6, detail_string::noitem, detail_string::noitem, detail_string::noitem);
}

// 6 arguments
template <typename Ch, typename Tr, typename Alloc
, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5
>
std::basic_string<Ch,Tr,Alloc>
to_basic_string
(T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, T5 const& t5) {
    return to_basic_string<Ch,Tr,Alloc> (t0,t1,t2,t3,t4,t5,
    detail_string::noitem, detail_string::noitem, detail_string::noitem, detail_string::noitem);
}


// 5 arguments
template <typename Ch, typename Tr, typename Alloc
, typename T0, typename T1, typename T2, typename T3, typename T4
>
std::basic_string<Ch,Tr,Alloc>
to_basic_string
(T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4) {
    return to_basic_string<Ch,Tr,Alloc> (t0,t1,t2,t3,t4,
    detail_string::noitem, detail_string::noitem, detail_string::noitem, detail_string::noitem, detail_string::noitem);
}

// 4 arguments
template <typename Ch, typename Tr, typename Alloc
, typename T0, typename T1, typename T2, typename T3
>
std::basic_string<Ch,Tr,Alloc>
to_basic_string
(T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3) {
    return to_basic_string<Ch,Tr,Alloc> (t0,t1,t2,t3,
    detail_string::noitem, detail_string::noitem, detail_string::noitem,
    detail_string::noitem, detail_string::noitem, detail_string::noitem);
}

// 3 arguments
template <typename Ch, typename Tr, typename Alloc
, typename T0, typename T1, typename T2
>
std::basic_string<Ch,Tr,Alloc>
to_basic_string
(T0 const& t0, T1 const& t1, T2 const& t2) {
    return to_basic_string<Ch,Tr,Alloc> (t0,t1,t2,
    detail_string::noitem,
    detail_string::noitem,
    detail_string::noitem,
    detail_string::noitem,
    detail_string::noitem,
    detail_string::noitem,
    detail_string::noitem);
}

// 2 arguments
template <typename Ch, typename Tr, typename Alloc
, typename T0, typename T1
>
std::basic_string<Ch,Tr,Alloc>
to_basic_string
(T0 const& t0, T1 const& t1) {
    return to_basic_string<Ch,Tr,Alloc> (t0,t1,
    detail_string::noitem, detail_string::noitem, detail_string::noitem,
    detail_string::noitem, detail_string::noitem, detail_string::noitem,
    detail_string::noitem, detail_string::noitem);
}


//
// to_basic_string_defaults
//

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

// 9 arguments
template <typename Ch, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
std::basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
to_basic_string_defaults
(T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, T5 const& t5, T6 const& t6, T7 const& t7, T8 const& t8) {
    return to_basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
    (t0,t1,t2,t3,t4,t5,t6,t7,t8);
}

// 8 arguments
template <typename Ch, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
std::basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
to_basic_string_defaults
(T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, T5 const& t5, T6 const& t6, T7 const& t7) {
    return to_basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
    (t0,t1,t2,t3,t4,t5,t6,t7);
}

// 7 arguments
template <typename Ch, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
std::basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
to_basic_string_defaults
(T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, T5 const& t5, T6 const& t6) {
    return to_basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
    (t0,t1,t2,t3,t4,t5,t6);
}

// 6 arguments
template <typename Ch, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
std::basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
to_basic_string_defaults
(T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4, T5 const& t5) {
    return to_basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
    (t0,t1,t2,t3,t4,t5);
}

// 5 arguments
template <typename Ch, typename T0, typename T1, typename T2, typename T3, typename T4>
std::basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
to_basic_string_defaults
(T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3, T4 const& t4) {
    return to_basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
    (t0,t1,t2,t3,t4);
}

// 4 arguments
template <typename Ch, typename T0, typename T1, typename T2, typename T3>
std::basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
to_basic_string_defaults
(T0 const& t0, T1 const& t1, T2 const& t2, T3 const& t3) {
    return to_basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
    (t0,t1,t2,t3);
}

// 3 arguments
template <typename Ch, typename T0, typename T1, typename T2>
std::basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
to_basic_string_defaults
(T0 const& t0, T1 const& t1, T2 const& t2) {
    return to_basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
    (t0,t1,t2);
}

// 2 arguments
template <typename Ch, typename T0, typename T1>
std::basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
to_basic_string_defaults
(T0 const& t0, T1 const& t1) {
    return to_basic_string<Ch, std::char_traits<Ch>, std::allocator<Ch> >
    (t0,t1);
}

//
// to_string
//


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

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

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

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

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

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

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

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

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

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

#endif

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

81
82
83
84
85
86
87
88


89
90
91
92
93
94
95

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

#elif (CXXOMFORT_CXX_STD>=1997)
#include "to_basic_string_cxx03.hpp"
#else
	// unsupported


#endif

#if defined(DOXYGEN_DOC)

/**
 * @brief Provides a string expression of its arguments.
 * @ingroup independent-utilities







|
>
>







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97

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

#elif (CXXOMFORT_CXX_STD>=1997)
#include "to_basic_string_cxx03.hpp"
#else
#include "to_basic_string_precxx.hpp"


#endif

#if defined(DOXYGEN_DOC)

/**
 * @brief Provides a string expression of its arguments.
 * @ingroup independent-utilities

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

209
210
211
212
213
214
215
216
217
218
219
220
221
222
223

#else
#define CXXO_ENUM_BEGIN(Name,Storage) enum class Name : Storage
#define CXXO_ENUM_END(Name,Storage) 

#endif // c++11

#define ENUM_ITERABLE(Name) \
std::enable_if< lpp::detail::is_scoped_enum< Name >::value, Name>::type  \
begin (Name) { return Name::First; }\
std::enable_if< lpp::detail::is_scoped_enum< Name >::value, Name>::type  \
end (Name) { return Name::Last; }\


#endif // SAFEENUM.HPP







<
<
<
<
<

<

209
210
211
212
213
214
215





216

217

#else
#define CXXO_ENUM_BEGIN(Name,Storage) enum class Name : Storage
#define CXXO_ENUM_END(Name,Storage) 

#endif // c++11








#endif // SAFEENUM.HPP

Changes to cxxomfort/cxxomfort/impl/unique_ptr-poor.hpp.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * Dependencies from type_traits:
 * is_reference
 * add_reference
 * remove_reference
 * is_const
 * enable_if (provided by meta.hpp)
 * is_empty
 */


namespace cxxomfort {
namespace cxxostd {

namespace detail_unique_ptr {

using ::cxxomfort::traits::is_empty;
using ::cxxomfort::traits::is_reference;
using ::cxxomfort::traits::add_reference;
using ::cxxomfort::traits::remove_reference;


//
// rv wrapper class







<








<







19
20
21
22
23
24
25

26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
/*
 * Dependencies from type_traits:
 * is_reference
 * add_reference
 * remove_reference
 * is_const
 * enable_if (provided by meta.hpp)

 */


namespace cxxomfort {
namespace cxxostd {

namespace detail_unique_ptr {


using ::cxxomfort::traits::is_reference;
using ::cxxomfort::traits::add_reference;
using ::cxxomfort::traits::remove_reference;


//
// rv wrapper class

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

41




42
43
44
45
46
47
48
 */


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

 * 




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







|
>
>
>
>
>
>
>
|
>

>
|

>

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





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












>



>

>
>
>
>



|



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


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

namespace cxxomfort { namespace cxxostd {

struct contiguous_iterator_tag : public std::random_access_iterator_tag {};

} }

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


//
// make_reverse_iterator
// (taken from cppreference.com sample code)
//

namespace cxxomfort { namespace cxxostd { 
template <typename It>
CXXO_CONSTEXPR 
std::reverse_iterator<It> make_reverse_iterator (It i) {
    return std::reverse_iterator<It>(i);
}

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



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


// 
// contiguous_access, contiguous_access_iterator
// 

namespace cxxomfort { namespace fix { 

/*
 * Given an iterator type I, indicates whether the type either: 
 * * matches the contiguous_iterator tag
 * * or represents access to a contiguous area of memory, like an array
 */
template <typename Iterator, typename Tag= typename std::iterator_traits<Iterator>::iterator_category >
struct is_contiguous_access_iterator {
	enum { value= 0, specialized= 0 };
};

template <typename Iterator>
struct is_contiguous_access_iterator<Iterator, std::contiguous_iterator_tag> {
	enum { value= 1, specialized= 0 };
};

template <typename T>
struct is_contiguous_access_iterator<T*> {
	enum { value= 1, specialized= 2 };
};


} }

#endif

/**
 * @page std0iterator <iterator>
 * @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 make_reverse_iterator() (C++14).
 * * @c size() accessor (C++17).
 * * @c data() accessor (C++17).
 * * @c empty() accessor (C++17).
 * * @c contiguous_iterator_tag (C++20).
 * 
 * Non-backport interfaces:
 * 
 * * <code>cxxomfort::fix::contiguous_access</code> - A check for contiguous access iterators.
 *
 * 
 * @section also See Also
 * 
 * * @see @cppref{header/iterator} (cppreference)
 * * @see @ref cxxo-sup-algorithm 
 * 
 * */

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

23
24
25
26
27
28
29
30
31




32
33
34
35
36
37
38
..
90
91
92
93
94
95
96

97
98
99


100





101
102
103
104
105
106
107
108
109
110
111
112
113
114




115
116
117
118
119
120
121
122
123
124
125
...
159
160
161
162
163
164
165

166
167
168
169
170
171
172
...
215
216
217
218
219
220
221




222
223
224
225
226
227
228
...
258
259
260
261
262
263
264




265
266
267
268
269
270
271
272
273
274
275
276
277




278
279
280
281
282
283
284
285
286
287
288
289





290
291
292
293
294
295
296
297
298
299
300












301
302
303
304
305
306
307
308
309
 * @{
 */

// copy_leftmost_n is simply copy_n

/**
 * @brief Copy like @c copy_if with inverted predicate (for symmetry with @c find_if_not ).
 * @xrefitem std0algorithm "<algorithm> backports" ""
 * @ingroup cxx11-backports




 */
template <typename OutI, typename InpI, typename Pred> inline 
OutI copy_if_not (InpI ini, InpI fin, OutI dest, Pred p) {
    for (; ini != fin; ++ini) { 
        if (!p(*ini)) { *dest= *ini; ++dest; }
    }
}
................................................................................
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);
}



// 
// binary predicate find, from lwg217
//








template <typename It, typename Pred, typename T>
It find (It ini, It fin, Pred if_, T const& v) {
	using namespace std;
	return find_if(ini,fin, bind(if_,placeholders::_1,v) );
}

//
// find_not, find_if_not from p1223ro (dropped in r1)
// 

/**
 * @brief Finds the first element in the sequence not equal to @e t .
 * @return An iterator, or @e fin .
 * @see @c find() 




 * */
template <typename It, typename T>
It find_not (It ini, It fin, T const& t) {
	using namespace std;
	for (; ini != fin; ++ini) {
		if (t==*ini) {} else { return ini; }
	}
	return fin;
}


................................................................................
    for (; ini != fin && next(ini,1) != fin; ++ini) {
        Iter inext= ini; ++inext;
        if (fin != inext && lt(*inext,*ini)) break;
    }
    return ini;
}


template <typename Iter> inline
Iter find_inversion (Iter ini, Iter fin) {
    std::less<typename Iter::value_type> m;
    return find_inversion(ini, fin, m);
}

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

/**
 * @brief Finds the latest item in a sequence that fits predicate @c if_ .
 * @param ini,fin Delimiters to the sequence to be examined.
 * @param if_ A predicate (a function from <var>ini...fin</var>'s alue type to @c bool ).
 * @return An iterator pointing to the latest item in <code>[ini,fin)</code> that fulfills @c if_ .
 * @anchor find_last_if




 */
template <typename Iter, typename Pred>
Iter find_last_if (Iter ini, Iter fin, Pred if_) {
    const typename std::iterator_traits<Iter>::iterator_category cat;
    return detail::find_last_if(ini, fin, if_, cat);
}

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

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


/**
 * @brief Constructs a map of frequencies each element appears in the sequence.
 * 
 * Given a sequence S=[ini,fin), and a map vi with an associated reductor 





 * rint(vi)-> [0, 1, ...], it iterates x over S and increments the value at
 * vi+f(x)
 * */
template <typename Iterator, typename ValueMapIterator, typename Reductor>
Iterator count_frequencies_map (Iterator ini, Iterator fin, ValueMapIterator vi, Reductor const rint) {
    for (; ini != fin; ++ini) {
        *(vi + rint(*ini))++;
    }
    return ini;
}













template <typename Iterator, typename ValueMap>
Iterator count_frequencies_map (Iterator ini, Iterator fin, ValueMap& v) {
    for (; ini != fin; ++ini) {
        v[*ini]++;
    }
    return ini;
}









|
<
>
>
>
>







 







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






<
<
<
<




>
>
>
>



<







 







>







 







>
>
>
>







 







>
>
>
>













>
>
>
>











|
>
>
>
>
>
|
|









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

|







23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38
39
40
41
..
93
94
95
96
97
98
99
100
101

102
103
104
105
106
107
108
109
110
111
112
113
114
115
116




117
118
119
120
121
122
123
124
125
126
127

128
129
130
131
132
133
134
...
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
...
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
...
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
 * @{
 */

// copy_leftmost_n is simply copy_n

/**
 * @brief Copy like @c copy_if with inverted predicate (for symmetry with @c find_if_not ).
 * @xrefitem cxxo-sup-algorithm "cxxo-sup-algorithm" "Copying"

 * 
 * This is provided for homology with: 
 * <tt>std::find_if_not</tt>, <tt>std::copy_if</tt>.
 * 
 */
template <typename OutI, typename InpI, typename Pred> inline 
OutI copy_if_not (InpI ini, InpI fin, OutI dest, Pred p) {
    for (; ini != fin; ++ini) { 
        if (!p(*ini)) { *dest= *ini; ++dest; }
    }
}
................................................................................
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 an element @em x in a sequence such that <tt>if_(x,v)</tt> holds.
 * @return Iterator pointing to the found element, or <tt>fin</tt>.
 * @xrefitem cxxo-sup-algorithm "cxxo-sup-algorithm" "Searching"
 * 
 * This is taken from proposal <b>wlg217</b>.
 * 
 * See also: <tt>std::find_if</tt>.
 * 
 */
template <typename It, typename Pred, typename T>
It find (It ini, It fin, Pred if_, T const& v) {
	using namespace std;
	return find_if(ini,fin, bind(if_,placeholders::_1,v) );
}





/**
 * @brief Finds the first element in the sequence not equal to @e t .
 * @return An iterator, or @e fin .
 * @see @c find() 
 * 
 * This is provided for homology with: 
 * <tt>std::find</tt>, <tt>std::find_if_not</tt>.
 * 
 * */
template <typename It, typename T>
It find_not (It ini, It fin, T const& t) {

	for (; ini != fin; ++ini) {
		if (t==*ini) {} else { return ini; }
	}
	return fin;
}


................................................................................
    for (; ini != fin && next(ini,1) != fin; ++ini) {
        Iter inext= ini; ++inext;
        if (fin != inext && lt(*inext,*ini)) break;
    }
    return ini;
}

//! @overload find_inversion 
template <typename Iter> inline
Iter find_inversion (Iter ini, Iter fin) {
    std::less<typename Iter::value_type> m;
    return find_inversion(ini, fin, m);
}

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

/**
 * @brief Finds the latest item in a sequence that fits predicate @c if_ .
 * @param ini,fin Delimiters to the sequence to be examined.
 * @param if_ A predicate (a function from <var>ini...fin</var>'s alue type to @c bool ).
 * @return An iterator pointing to the latest item in <code>[ini,fin)</code> that fulfills @c if_ .
 * @anchor find_last_if
 * 
 * This is provided for homology with:
 * <tt>std::find_if</tt>.
 * 
 */
template <typename Iter, typename Pred>
Iter find_last_if (Iter ini, Iter fin, Pred if_) {
    const typename std::iterator_traits<Iter>::iterator_category cat;
    return detail::find_last_if(ini, fin, if_, cat);
}

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

/**
 * @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"
 * 
 * This is provided for homology with: 
 * <tt>std::copy_if</tt>
 * 
 */
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"
 * 
 * This is provided for homology with: 
 * <tt>std::copy_n</tt>.
 * 
 */
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;
}


/**
 * @brief Constructs a map of frequencies each element appears in the sequence.
 * 
 * Given a sequence S=[ini,fin), and a map @em vi of elements of type @em X 
 * with an associated mapping function @em rint such that: 
 * @code
f "rint" : (X) → [0, 1, ..., k]
 * @endcode
 * 
 * Then it iterates over S and increments the value at
 * <tt>vi+f(x)</tt> .
 * */
template <typename Iterator, typename ValueMapIterator, typename Reductor>
Iterator count_frequencies_map (Iterator ini, Iterator fin, ValueMapIterator vi, Reductor const rint) {
    for (; ini != fin; ++ini) {
        *(vi + rint(*ini))++;
    }
    return ini;
}


/**
 * @brief Constructs a map of frequencies each element appears in the sequence.
 * @overload count_frequencies_map
 * 
 * This overload takes an array @em v of frequency holders (a bucket), 
 * accessible with <tt>operator[]</tt> for unchecked access, 
 * instead of an iterable map and a mapping function.
 * 
 * Then it iterates over S and increments the value at
 * <tt>v[f(x)]</tt> .
 * */
template <typename Iterator, typename ValueMap>
Iterator count_frequencies (Iterator ini, Iterator fin, ValueMap& v) {
    for (; ini != fin; ++ini) {
        v[*ini]++;
    }
    return ini;
}


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

17
18
19
20
21
22
23


24
25
26
27
28
29
30
...
132
133
134
135
136
137
138

139
140

141
142

143
144
145
146
147









148
149
150
151
152
153
154
...
162
163
164
165
166
167
168
169
170
171
172

173
174
175
176
177
178
179
180
181
182
183
184
...
355
356
357
358
359
360
361


362
363
364
365
#include <stdexcept>
#include <memory>

#define CXXOMFORT_IMPLEMENTS_fixed_vector CXXO_IMPLSTATUS_LIBRARY()

namespace cxxomfort{
namespace library{



template <typename T, typename Alloc> class fixed_vector;



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

    // Information
    ////////
    
	//! Maximum allowed size (as per allocator).

    size_type       max_size () const CXXO_NOEXCEPTNOTHROW { return m_sz; } 
    //! Current ( = maxium) size.

    size_type       size () const CXXO_NOEXCEPTNOTHROW { return m_sz; }
    //! Check if container is empty ( = has @c size == 0).

    bool            empty () const CXXO_NOEXCEPTNOTHROW { return m_p == nullptr && m_sz == 0; } 
	//! Access to the data pointer.
    const T*        data () const CXXO_NOEXCEPTNOTHROW { return m_p; }
    //! Access to the data pointer.
    T*              data () CXXO_NOEXCEPTNOTHROW { return m_p; }










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

    }
    //! @overload operator[]
    reference operator[] (size_t idx) CXXO_NOEXCEPTNOTHROW {
        return m_p[idx];
    }

    //! Unchecked(!) access to front
    const_reference front () const CXXO_NOEXCEPTNOTHROW { return m_p[0]; }
    //! @overload front
    reference       front () CXXO_NOEXCEPTNOTHROW { return m_p[0]; }
    //! Unchecked (!) access to back
    const_reference back  () const CXXO_NOEXCEPTNOTHROW { return m_p[m_sz-1]; }
................................................................................
}

//! Comparison operator @c != between two @c fixed_vector s.
template <typename T, typename Alloc>
inline bool operator!= (fixed_vector<T,Alloc> const& a, fixed_vector<T,Alloc> const& b) {
    return !(a==b);
}



} } // cxxomfort::library

#endif







>
>







 







>


>


>





>
>
>
>
>
>
>
>
>







 







|
|
|
|
>
|
<
<
<
<







 







>
>




17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
...
176
177
178
179
180
181
182
183
184
185
186
187
188




189
190
191
192
193
194
195
...
366
367
368
369
370
371
372
373
374
375
376
377
378
#include <stdexcept>
#include <memory>

#define CXXOMFORT_IMPLEMENTS_fixed_vector CXXO_IMPLSTATUS_LIBRARY()

namespace cxxomfort{
namespace library{

#if (CXXOMFORT_CXX_STD >= 1997)

template <typename T, typename Alloc> class fixed_vector;



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

    // Information
    ////////
    
	//! Maximum allowed size (as per allocator).
    CXXO_CONSTEXPR 
    size_type       max_size () const CXXO_NOEXCEPTNOTHROW { return m_sz; } 
    //! Current ( = maxium) size.
    CXXO_CONSTEXPR
    size_type       size () const CXXO_NOEXCEPTNOTHROW { return m_sz; }
    //! Check if container is empty ( = has @c size == 0).
    CXXO_CONSTEXPR
    bool            empty () const CXXO_NOEXCEPTNOTHROW { return m_p == nullptr && m_sz == 0; } 
	//! Access to the data pointer.
    const T*        data () const CXXO_NOEXCEPTNOTHROW { return m_p; }
    //! Access to the data pointer.
    T*              data () CXXO_NOEXCEPTNOTHROW { return m_p; }

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

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

	//! Checked (non-throwing) access to elements
	reference       at_or (size_t idx, reference rx) { return idx < m_sz ? m_p[idx] : rx; }
	//! Checked (non-throwing) access to elements
	const_reference at_or (size_t idx, const_reference rx) const { return idx < m_sz ? m_p[idx] : rx; }
	





    //! Unchecked(!) access to front
    const_reference front () const CXXO_NOEXCEPTNOTHROW { return m_p[0]; }
    //! @overload front
    reference       front () CXXO_NOEXCEPTNOTHROW { return m_p[0]; }
    //! Unchecked (!) access to back
    const_reference back  () const CXXO_NOEXCEPTNOTHROW { return m_p[m_sz-1]; }
................................................................................
}

//! Comparison operator @c != between two @c fixed_vector s.
template <typename T, typename Alloc>
inline bool operator!= (fixed_vector<T,Alloc> const& a, fixed_vector<T,Alloc> const& b) {
    return !(a==b);
}

#endif // cxx_std

} } // cxxomfort::library

#endif

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

1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
...
120
121
122
123
124
125
126





































127
128
129
130
131
132
133
#ifndef CXXOMFORT_CXXO_ITERATOR_HPP
#define CXXOMFORT_CXXO_ITERATOR_HPP
#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
#include <iterator>
#include <functional>
//#include <type_traits>



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


/**
 * @file
 * @ingroup cxxo-sup-iterator
................................................................................
function_iterator<I,F> make_function_iterator(I const& i, F & f) {
    return function_iterator<I,F>(i,f);
}

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






































/**
 * @page cxxo-sup-iterator
 * @ingroup cxxo-sup
 * 
 * Supplements to the utilities found in <code><iterator></code>.
 * 
 * Interfaces defined here:
|
|




|
<
>







 







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







1
2
3
4
5
6
7

8
9
10
11
12
13
14
15
...
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#ifndef CXXOMFORT_SUPP_ITERATOR_HPP
#define CXXOMFORT_SUPP_ITERATOR_HPP
#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
#include <iterator>
#include <functional>
#include <cxxomfort/iterator.hpp>

#include <cxxomfort/functional.hpp>

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


/**
 * @file
 * @ingroup cxxo-sup-iterator
................................................................................
function_iterator<I,F> make_function_iterator(I const& i, F & f) {
    return function_iterator<I,F>(i,f);
}

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

// 
// extensions to cxxomfort::fix::contiguous_access
// 

#include <vector>
#include <string>

namespace cxxomfort { namespace fix {

// C++ can not into partial template specializations on subtypes?
// need to figure out how to implement this concept some other way

#if (0)
template <typename T>
struct is_contiguous_access_iterator <
	typename std::vector<T>::iterator

> {
	enum { value = (__cplusplus>=201103L), specialized = 1 };
};
#endif

// in C++11 onwards std::string and std::wstring (but no std::basic_string<...>?) are guaranteed to have contiguous storage

template<> 
struct is_contiguous_access_iterator <std::string::iterator> {
	enum { value = (__cplusplus>=201103L), specialized = 1 };
};

template<> 
struct is_contiguous_access_iterator <std::wstring::iterator> {
	enum { value = (__cplusplus>=201103L), specialized = 1 };
};


} } 

/**
 * @page cxxo-sup-iterator
 * @ingroup cxxo-sup
 * 
 * Supplements to the utilities found in <code><iterator></code>.
 * 
 * Interfaces defined here:

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

1
2










3
4
5
#ifndef CXXOMFORT_CXXO_SUPP_LIMITS_HPP
#define CXXOMFORT_CXXO_SUPP_LIMITS_HPP












#endif


>
>
>
>
>
>
>
>
>
>



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

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

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



#endif

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

159
160
161
162
163
164
165




166
167
168
169
170
171
172
    (t < m) ? m : (M < t ? M : t);
};

// ilog (positive)

// ipow (positive)





template <typename T, T x, unsigned y>
struct static_intpow {
    static const T t = static_intpow<T,x,y/2>::value;
    static const T value = (y%2u==0) ? t*t : x*t*t;
};

template <typename T, T x>







>
>
>
>







159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
    (t < m) ? m : (M < t ? M : t);
};

// ilog (positive)

// ipow (positive)

/*
 * intpow: Given intpow<T,x,y>
 * declares @c value as the the result of pow(x,y)
 * */
template <typename T, T x, unsigned y>
struct static_intpow {
    static const T t = static_intpow<T,x,y/2>::value;
    static const T value = (y%2u==0) ? t*t : x*t*t;
};

template <typename T, T x>

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

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

100


101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
...
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167

168
169

170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
...
203
204
205
206
207
208
209
210
211

212
213
214
215
216

217
218
219


220
221
222
223
224
225
226
227
228
229
230
231
232
...
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
...
259
260
261
262
263
264
265
266
267
268
269
270

271
272
273
274
275
276

277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305






306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
#ifndef CXXOMFORT_LIBRARY_SEQUENCES_HPP
#define CXXOMFORT_LIBRARY_SEQUENCES_HPP

/**
 * @file
 * 
 */

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

/**
 * @page cxxo-sequences Sequence Helpers
 * @ingroup cxxo-sup
 * 
 * Interfaces defined in this file:
 * 
 * * @c is_std_array
 * * @c is_sequence_container
 * * @c is_indexable_like_array
 * * @c is_iterator
 * * @c make_array
 * * @c seq_ , @c generic_sequence_t
 * 
 * Pending:
 * 
 * * @c array<> in C++03 mode with NO_TR1 defined
 *

 */


//
// is_std_array
//

namespace cxxomfort {


/**
 * @brief Type identification trait for <code>std::array<...></code> types.
 */
template <typename T> struct is_std_array 
: std::false_type {};

template <typename T, size_t N> struct is_std_array< std::array<T,N> > 
: std::true_type {};

} // cxxomfort

//
// is_indexable_like_array operator
//
// A type is considered indexable like an array if it exposes a value_type 
// and a []-operator (returning value_type [const] &).
namespace cxxomfort {
namespace detail {

template <typename T> struct bracket_indexable_helper {

    typedef struct { int a; } yes;
    typedef char no;

................................................................................
    private:
    template <typename U, U> struct really_has;

    template <typename C> static yes& Test_op(really_has <typename C::value_type const& (C::*)() const,
                            &C::operator[] >*);

    template <typename> static no& Test_op(...);
    
    public:
    static const bool has_op    = (sizeof(Test_op<T>(0)) == sizeof(yes));

};


} // detail

/**
 * @brief Type identification trait for types that 
 * are indexable via an array-like <code>operator[]</code>.
 */
template <typename T> struct is_indexable_like_array 
: std::conditional< detail::bracket_indexable_helper<T>::has_op, std::true_type, std::false_type>::type
{};

template <typename T, size_t N> struct is_indexable_like_array< T[N] >
: std::true_type 
{};


} //cxxomfort::


// sequence_t and seq_ generator


#include "../impl/seq_.hpp"

//
// is_sequence -- for specializations based on ability to provide 
// access to a sequence of objects
//
#include <iterator>
#include <type_traits>

namespace cxxomfort {

//
// is_iterator
//

namespace detail {

................................................................................
    typedef yes no[2];

    template <typename C> static yes& test_ic(typename C::iterator_category*);
    template <typename C> static no&  test_ic(...);

    public:
    // iterator_category
    static const bool value = sizeof(test_ic<T>(0)) == sizeof(yes);
};

} // detail::

// Given a type @p T , inherit from @c true_type  if @p T  is a type 
// considered an iterator by iterator_traits.
/*
template<typename T, typename = void>
 struct is_iterator : std::false_type {};

template<typename T>
struct is_iterator<
    T, typename std::enable_if<
        detail::has_member_iterator_category< std::iterator_traits<T> >::value 
        and !std::is_same<typename std::iterator_traits<T>::value_type, void>::value 
    >::type> : std::true_type {};
*/


/**
 * @struct is_iterator
 * @brief Type identification trait for iterator types as defined by the <code><iterator></code> interface.
 */
template<class T>
struct is_iterator {   
    static T makeT();
    typedef void * twoptrs[2];  // sizeof(twoptrs) > sizeof(void *)
    static twoptrs & test(...); // Common case
    template<class R> static typename R::iterator_category * test(R); // Iterator
    template<class R> static void * test(R *); // Pointer

    static const bool value = sizeof(test(makeT())) == sizeof(void *); 
};



/* A type S is considered a sequence if:
 * * the calls std::begin(s) and std::end(s) make sense

 * * the return type of those calls is specialized by iterator_traits
 * * alternatively, S is a native C array

 */

namespace detail {

    template <typename T> struct has_sequence_members {
    private:
        typedef char                      yes;
        typedef yes no[2];

        template <typename C> static yes& test_ci(typename C::const_iterator*);
        template <typename C> static no&  test_ci(...);
        template <typename C> static yes& test_vt(typename C::value_type*);
        template <typename C> static no&  test_vt(...);

        public:
        // const_iterator
        static const bool value_ci = sizeof(test_ci<T>(0)) == sizeof(yes);
        // value_type
        static const bool value_vt = sizeof(test_vt<T>(0)) == sizeof(yes);
        typedef T type;

        private:
        template <typename U, U> struct really_has;

        template <typename C> static yes& Test_begin(really_has <typename C::const_iterator (C::*)() const,
                                            &C::begin>*);
................................................................................

        template <typename C> static yes& Test_data(really_has <typename C::const_pointer (C::*)() const,
                                            &C::data>*);

        template <typename> static no& Test_begin(...);
        template <typename> static no& Test_end(...);
        template <typename> static no& Test_data(...);
        
        public:

        static bool const value_begin_end = (
            sizeof(Test_begin<T>(0)) == sizeof(yes) )
            && ( sizeof(Test_end<T>(0)) == sizeof(yes)
            );


        static bool const has_data = (
            sizeof(Test_data<T>(0)) == sizeof(yes)
            );


    };

template <typename T, bool=false>
struct is_sequence_impl: traits::false_type {};

template <typename T> struct is_sequence_impl<T,true> 
: traits::integral_constant<bool, is_iterator<typename T::const_iterator>::value > {};

} // detail::

// at present, a type S is a sequence if:
// 1.- has a const_iterator and value_type member types
// 1b.- has begin, end member functions returning type iterator or const_iterator (other overloads are ignored)
................................................................................
// 2.- or is a C array.

/**
 * @brief Type identification trait for sequence-like types:
 * * have a @c const_iterator member type.
 * * have a @c begin  and @c end  member function.
 */
template <typename S> struct is_sequence 
: detail::is_sequence_impl<S, 
    detail::has_sequence_members<S>::value_ci 
    && detail::has_sequence_members<S>::value_vt
    && detail::has_sequence_members<S>::value_begin_end 
> {};

// arrays are sequences
template <typename T, size_t N>
struct is_sequence< T[N] > : traits::true_type {};

// starting C++11, valarrays are sequences
................................................................................
//
// maybe_contiguous
//


/*
 * criteria for a sequence type to maybe be contiguous:
 * 
 * 1.- is a sequence according to is_sequence
 * 2.- supports member operator[]
 * 3a.- iterator == add_pointer<value_type>
 * 3b.- iterator has random_access_iterator_tag AND sequence has a .data member that returns pointer

 * 4.- the type is registered with register_contiguous_sequence
 * 
 * */

namespace {


template <typename S, typename IfS= void>
struct contiguous_helper {
    typedef typename S::iterator I;
    typedef typename S::value_type V;
    typedef typename std::add_pointer<V>::type P;
    enum { clause1 = is_sequence<S>::value };
    enum { clause2 = is_sequence<S>::value };
    enum { clause3a = std::is_same< I, P >::value };
    enum { clause3b = std::is_same< std::random_access_iterator_tag, typename std::iterator_traits<I>::iterator_category>::value 
        && detail::has_sequence_members<S>::has_data
        };
    
    enum { value = clause1 && clause2 && (clause3a || clause3b) };
};

template <typename T>
struct contiguous_helper<T, typename std::enable_if< std::is_fundamental<T>::value >::type > 
: std::false_type {};

template <typename T, size_t N>
struct contiguous_helper <T[N], typename std::enable_if<true> ::type > {
    enum { value = true };
};

template <typename T>
struct contiguous_helper <std::valarray<T> , typename std::enable_if<true>::type > {
    enum { value = true };
};







}

template <typename T>
struct registered_contiguous 
: std::bool_constant<contiguous_helper<T>::value> {
};


template <typename S>
struct is_maybe_contiguous_sequence
: public std::bool_constant<
 (false==std::is_fundamental<S>::value) && registered_contiguous<S>::value
> {
};

} // cxxomfort


#endif






|













|

|






|

|










|





|


|


|




|

|







 







|









|


|




|



|

>

>
>



|





|







 







|




|








|
|









|






|






>


>









|






|

|







 







|

>
|


<
|
>
|

<
>
>





|







 







|
|
|

|







 







|



|
>

|




>






|

|


|




|












>
>
>
>
>
>



|











|




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
..
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
...
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
...
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
...
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
#ifndef CXXOMFORT_LIBRARY_SEQUENCES_HPP
#define CXXOMFORT_LIBRARY_SEQUENCES_HPP

/**
 * @file
 *
 */

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

/**
 * @page cxxo-sequences Sequence Helpers
 * @ingroup cxxo-sup
 *
 * Interfaces defined in this file:
 *
 * * @c is_std_array
 * * @c is_sequence_container
 * * @c is_indexable_like_array
 * * @c is_iterator
 * * @c make_array
 * * @c seq_ , @c generic_sequence_t
 *
 * Pending:
 *
 * * @c array<> in C++03 mode with NO_TR1 defined
 *

 */


//
// is_std_array
//

namespace cxxomfort { namespace library {


/**
 * @brief Type identification trait for <code>std::array<...></code> types.
 */
template <typename T> struct is_std_array
: std::false_type {};

template <typename T, size_t N> struct is_std_array< std::array<T,N> >
: std::true_type {};

} } // cxxomfort::library

//
// is_indexable_like_array operator
//
// A type is considered indexable like an array if it exposes a value_type
// and a []-operator (returning value_type [const] &).
namespace cxxomfort { namespace library {
namespace detail {

template <typename T> struct bracket_indexable_helper {

    typedef struct { int a; } yes;
    typedef char no;

................................................................................
    private:
    template <typename U, U> struct really_has;

    template <typename C> static yes& Test_op(really_has <typename C::value_type const& (C::*)() const,
                            &C::operator[] >*);

    template <typename> static no& Test_op(...);

    public:
    static const bool has_op    = (sizeof(Test_op<T>(0)) == sizeof(yes));

};


} // detail

/**
 * @brief Type identification trait for types that
 * are indexable via an array-like <code>operator[]</code>.
 */
template <typename T> struct is_indexable_like_array
: std::conditional< detail::bracket_indexable_helper<T>::has_op, std::true_type, std::false_type>::type
{};

template <typename T, size_t N> struct is_indexable_like_array< T[N] >
: std::true_type
{};


} } //cxxomfort::library

// 
// sequence_t and seq_ generator
// 

#include "../impl/seq_.hpp"

//
// is_sequence -- for specializations based on ability to provide
// access to a sequence of objects
//
#include <iterator>
#include <type_traits>

namespace cxxomfort { namespace library {

//
// is_iterator
//

namespace detail {

................................................................................
    typedef yes no[2];

    template <typename C> static yes& test_ic(typename C::iterator_category*);
    template <typename C> static no&  test_ic(...);

    public:
    // iterator_category
    enum { value = sizeof(test_ic<T>(0)) == sizeof(yes) };
};

} // detail::

// Given a type @p T , inherit from @c true_type  if @p T  is a type
// considered an iterator by iterator_traits.
/*
template<typename T, typename = void>
 struct is_iterator : std::false_type {};

template<typename T>
struct is_iterator<
    T, typename std::enable_if<
        detail::has_member_iterator_category< std::iterator_traits<T> >::value
        and !std::is_same<typename std::iterator_traits<T>::value_type, void>::value
    >::type> : std::true_type {};
*/


/**
 * @struct is_iterator
 * @brief Type identification trait for iterator types as defined by the <code><iterator></code> interface.
 */
template<class T>
struct is_iterator {
    static T makeT();
    typedef void * twoptrs[2];  // sizeof(twoptrs) > sizeof(void *)
    static twoptrs & test(...); // Common case
    template<class R> static typename R::iterator_category * test(R); // Iterator
    template<class R> static void * test(R *); // Pointer

    static const bool value = sizeof(test(makeT())) == sizeof(void *);
};



/* A type S is considered a sequence if:
 * * the calls std::begin(s) and std::end(s) make sense
 * * the member type "iterator" and "value_type" are exposed
 * * the return type of those calls is specialized by iterator_traits
 * * alternatively, S is a native C array
 * * alternatively, S is a std::valarray
 */

namespace detail {

    template <typename T> struct has_sequence_members {
    private:
        typedef char                      yes;
        typedef yes no[2];

        template <typename C> static yes& test_ci(typename C::iterator*);
        template <typename C> static no&  test_ci(...);
        template <typename C> static yes& test_vt(typename C::value_type*);
        template <typename C> static no&  test_vt(...);

        public:
        // const_iterator
        enum { value_ci = sizeof(test_ci<T>(0)) == sizeof(yes) };
        // value_type
        enum { value_vt = sizeof(test_vt<T>(0)) == sizeof(yes) };
        typedef T type;

        private:
        template <typename U, U> struct really_has;

        template <typename C> static yes& Test_begin(really_has <typename C::const_iterator (C::*)() const,
                                            &C::begin>*);
................................................................................

        template <typename C> static yes& Test_data(really_has <typename C::const_pointer (C::*)() const,
                                            &C::data>*);

        template <typename> static no& Test_begin(...);
        template <typename> static no& Test_end(...);
        template <typename> static no& Test_data(...);

        public:
        enum { 
		value_begin_end = (
            sizeof(Test_begin<T>(0)) == sizeof(yes) )
            && ( sizeof(Test_end<T>(0)) == sizeof(yes)

            )
        , 
        value_has_data = (
            sizeof(Test_data<T>(0)) == sizeof(yes)

            )
        };
    };

template <typename T, bool=false>
struct is_sequence_impl: traits::false_type {};

template <typename T> struct is_sequence_impl<T,true>
: traits::integral_constant<bool, is_iterator<typename T::const_iterator>::value > {};

} // detail::

// at present, a type S is a sequence if:
// 1.- has a const_iterator and value_type member types
// 1b.- has begin, end member functions returning type iterator or const_iterator (other overloads are ignored)
................................................................................
// 2.- or is a C array.

/**
 * @brief Type identification trait for sequence-like types:
 * * have a @c const_iterator member type.
 * * have a @c begin  and @c end  member function.
 */
template <typename S> struct is_sequence
: detail::is_sequence_impl<S,
    detail::has_sequence_members<S>::value_ci
    && detail::has_sequence_members<S>::value_vt
    && detail::has_sequence_members<S>::value_begin_end
> {};

// arrays are sequences
template <typename T, size_t N>
struct is_sequence< T[N] > : traits::true_type {};

// starting C++11, valarrays are sequences
................................................................................
//
// maybe_contiguous
//


/*
 * criteria for a sequence type to maybe be contiguous:
 *
 * 1.- is a sequence according to is_sequence
 * 2.- supports member operator[]
 * 3a.- iterator == add_pointer<value_type>
 * 3b.- iterator has random_access_iterator_tag AND sequence has a .data() member that returns pointer
 * 3c.- iterator has contiguous_iterator_tag concept (C++20) AND sequence has a .data() member that returns iterator
 * 4.- the type is registered with register_contiguous_sequence
 *
 * */

namespace {

#if (CXXOMFORT_CXX_STD >= 1997)
template <typename S, typename IfS= void>
struct contiguous_helper {
    typedef typename S::iterator I;
    typedef typename S::value_type V;
    typedef typename std::add_pointer<V>::type P;
    enum { clause1 = is_sequence<S>::value };
    enum { clause2 = is_indexable_like_array<S>::value };
    enum { clause3a = std::is_same< I, P >::value };
    enum { clause3b = std::is_same< std::random_access_iterator_tag, typename std::iterator_traits<I>::iterator_category>::value
        && detail::has_sequence_members<S>::has_data
        };

    enum { value = clause1 && clause2 && (clause3a || clause3b) };
};

template <typename T>
struct contiguous_helper<T, typename std::enable_if< std::is_fundamental<T>::value >::type >
: std::false_type {};

template <typename T, size_t N>
struct contiguous_helper <T[N], typename std::enable_if<true> ::type > {
    enum { value = true };
};

template <typename T>
struct contiguous_helper <std::valarray<T> , typename std::enable_if<true>::type > {
    enum { value = true };
};

#else
template <typename S, typename IfS= void>
struct contiguous_helper {
    enum { value = false };
};
#endif
}

template <typename T>
struct registered_contiguous
: std::bool_constant<contiguous_helper<T>::value> {
};


template <typename S>
struct is_maybe_contiguous_sequence
: public std::bool_constant<
 (false==std::is_fundamental<S>::value) && registered_contiguous<S>::value
> {
};

} } // cxxomfort::library


#endif

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

331
332
333
334
335
336
337
338
339
340


















341
342
343
344
345
346
347
...
362
363
364
365
366
367
368
369
370
371
372
373
374
 * @}
 */


}} // cxxomfort::library


#else
	// unsupported
	#error "unsupported"


















#endif // CXX_STD

#endif

/**
 * @page cxxo-sup-string
 * @brief cxxomfort Supplementals for <string> 
................................................................................
 * * @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>.
 *
 * */







|

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







 







|





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
...
380
381
382
383
384
385
386
387
388
389
390
391
392
 * @}
 */


}} // cxxomfort::library


#else // not at least c++97
	// unsupported
	#pragma message CXXO_NOTICE("unsupported supplement - string")
	/* 
	 * a very reduced version of the supplement that only provides:
	 * chr, utf8chr, str_replace
	 * */

#include "../impl/to_basic_string_precxx.hpp"

namespace cxxomfort { namespace library {
namespace string {

using cxxomfort::impl::string::to_string; // variadic to_string

}
} } // cxxomfort::library
	
#include "../impl/to_basic_string_variadic.hpp"


#endif // CXX_STD

#endif

/**
 * @page cxxo-sup-string
 * @brief cxxomfort Supplementals for <string> 
................................................................................
 * * @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 version of to_string.
 *
 *
 * All interfaces are defined in the namespace <code>cxxomfort::algorithm::</code>.
 *
 * */

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

7
8
9
10
11
12
13


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

29
30
31
32
33
34
35
...
363
364
365
366
367
368
369




370
371
372
373
374
375
376

377







378
379
380

381
382
383
384








385
386
387
388
389

390



391
392


393
394
395
396
397
398
399
...
430
431
432
433
434
435
436



437
438
439
440
441
442
443

444








445
446
447

448
449
450
451








452
453
454
455
456
457
458



459
460



461
462
463
464
465
466
467
468
469
470
471
472
473
...
487
488
489
490
491
492
493




494

495






























































































































496
497
498
499
500
501
502
 * This file provides supplementary features for the tuple-related 
 * utilities present in <code><tuple></code>.
 * 
 * Interfaces defined here
 * 
 * * @c tuple_pop()
 * * @c tuple_shift()


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


#if (CXXOMFORT_CXX_STD>=1997)

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

#include "../impl/tuplemeta.hpp"
#include "../impl/14-integer_sequence.hpp"

// note: for these to work correctly MSVC needs to define _VARIADIC_MAX to >= 9, 
// as per https://stackoverflow.com/questions/8274588/c2977-stdtuple-too-many-template-arguments-msvc11
// where for some reason MSVC 2011 defines it as 5... >_>

................................................................................
        typename T5, typename T6, typename R>
    struct function2tuple_t<R(T0,T1,T2,T3,T4,T5,T6)> {
        typedef std::tuple<T0,T1,T2,T3,T4,T5,T6> type;
    };

#endif






#ifdef DOXYGEN_DOC
/**
 * @brief Removes the last type from a tuple
 * @ingroup cxxo-sup-tuple
 * @param tu A @c std::tuple of N+1 elements.
 * @return A tuple of N elements.

 * 







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


#endif

#if (0&&CXXOMFORT_CXX_STD >= 2011)









//! Pops (discards) the rightmost type in a tuple.
//! @ingroup independent-utilities
template <typename AF, typename... Args, typename... Indices>
std::tuple<Args...> tuple_pop (std::tuple<Args...,AF> && _tuple) {

    using namespace std;



    return make_tuple( forward<Args>(get<Indices>(_tuple)...);
}


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

#endif // MSVC silliness

// c++03 impl
#endif





#ifdef DOXYGEN_DOC
/**
 * @brief Removes the first type from a tuple
 * @ingroup cxxo-sup-tuple
 * @param tu A @c std::tuple of N+1 elements.
 * @return A tuple of N elements.

 * 








 */
template <typename Tuple<A0, A1, ..., An> >
tuple<A1, ..., An> tuple_shift(tuple<A0, A1, ..., An> const& tu);


#endif

#if (CXXOMFORT_CXX_STD >= 2011)









//! Shifts a tuple one type to the left, discarding the leftmost type.
//! @ingroup independent-utilities
template <typename A1, typename... Args, typename... Indices>
std::tuple<Args...> tuple_shift 
(std::tuple<A1,Args...> && _tuple) {
    using namespace std;



    return make_tuple( forward<Args...>(get<Indices>(_tuple)...) );
}



#else
// c++03 impl

template <typename A0>
std::tuple<> tuple_shift (std::tuple<A0> const&) {
    using std::get;
    return std::make_tuple<>( );
}
template <typename A0, typename A1>
std::tuple<A1> tuple_shift (std::tuple<A0,A1> const& t) {
    using std::get;
    return std::make_tuple( get<1>(t) );
}
................................................................................
    return std::make_tuple( get<1>(t), get<2>(t), get<3>(t), get<4>(t) );
}
template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
std::tuple<A1,A2,A3,A4,A5> tuple_shift (std::tuple<A0,A1,A2,A3,A4,A5> const& t) {
    using std::get;
    return std::make_tuple( get<1>(t), get<2>(t), get<3>(t), get<4>(t), get<5>(t) );
}






#endif































































































































}
}} // cxxomfort


//
// tuple_call (f, Tuple)







>
>







 







>







 







>
>
>
>







>

>
>
>
>
>
>
>

|
<
>



|
>
>
>
>
>
>
>
>



|
|
>

>
>
>
|

>
>







 







>
>
>







>

>
>
>
>
>
>
>
>

|
<
>




>
>
>
>
>
>
>
>



|

|

>
>
>
|

>
>
>





<







 







>
>
>
>
|
>

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







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
...
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394

395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
...
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487

488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520

521
522
523
524
525
526
527
...
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
 * This file provides supplementary features for the tuple-related 
 * utilities present in <code><tuple></code>.
 * 
 * Interfaces defined here
 * 
 * * @c tuple_pop()
 * * @c tuple_shift()
 * * @c tuple_push()
 * * @c tuple_unshift()
 * * @c tuple2function_t
 * * @c function2tuple_t
 * * @c tuple_call()
 * 
 * Interfaces brought from impl: @c is_tuple , @c tuple_count_type , @c tuple_index 
 * 
 * All interfaces are defined in the namespace <code>cxxomfort::algorithm::</code>.
................................................................................
 */


#if (CXXOMFORT_CXX_STD>=1997)

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

// note: for these to work correctly MSVC needs to define _VARIADIC_MAX to >= 9, 
// as per https://stackoverflow.com/questions/8274588/c2977-stdtuple-too-many-template-arguments-msvc11
// where for some reason MSVC 2011 defines it as 5... >_>

................................................................................
        typename T5, typename T6, typename R>
    struct function2tuple_t<R(T0,T1,T2,T3,T4,T5,T6)> {
        typedef std::tuple<T0,T1,T2,T3,T4,T5,T6> type;
    };

#endif


// 
// tuple_pop
// 

#ifdef DOXYGEN_DOC
/**
 * @brief Removes the last type from a tuple
 * @ingroup cxxo-sup-tuple
 * @param tu A @c std::tuple of N+1 elements.
 * @return A tuple of N elements.
 * @throws Whatever @c make_tuple throws.
 * 
 * Given a tuple @a tu , @c tuple_pop creates a new tuple with copies of all 
 * but the @e last element from the original tuple. 
 * 
 * If @a tu is a tuple with only one element, @c tuple_pop returns an empty tuple.
 * 
 * In C++03, @c tuple_pop works with tuples of up to six (6) (seis) types.
 * 
 */
template <typename... TArgs, typename TLast>

std::tuple<TArgs...> tuple_pop (std::tuple<TArgs..., TLast> const& tu);

#endif

#if (CXXOMFORT_CXX_STD >= 2011)

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


//! Pops (discards) the rightmost type in a tuple.
//! @ingroup independent-utilities
template <typename...Args, typename Az>
std::tuple<Args...> tuple_pop
(std::tuple<Args...,Az> const& _tuple) {
    using namespace std;
    //typedef std::tuple<A1,Args...> TT;
    auto ii = make_index_sequence< sizeof...(Args) /* this discounts Az */ >();
    return tuple_pop_impl ( _tuple, ii);
    //return make_tuple( forward<Args...>(get<Indices + 1>(_tuple)...) );
}


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

#endif // MSVC silliness

// c++03 impl
#endif

// 
// tuple_shift 
// 

#ifdef DOXYGEN_DOC
/**
 * @brief Removes the first type from a tuple
 * @ingroup cxxo-sup-tuple
 * @param tu A @c std::tuple of N+1 elements.
 * @return A tuple of N elements.
 * @throws Whatever @c make_tuple throws.
 * 
 * Given a tuple @a tu , @c tuple_shift creates a new tuple with copies of all 
 * but the @e first element from the original tuple. 
 * 
 * If @a tu is a tuple with only one element, @c tuple_shift returns an empty tuple.
 * 
 * In C++03, @c tuple_shift works with tuples of up to six (6) (seis) types.
 * 
 * 
 */
template <typename... TArgs, typename First>

std::tuple<TArgs...> tuple_shift (std::tuple<TFirst, TArgs...> const& tu);

#endif

#if (CXXOMFORT_CXX_STD >= 2011)

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


//! Shifts a tuple one type to the left, discarding the leftmost type.
//! @ingroup independent-utilities
template <typename A1, typename... Args>
std::tuple<Args...> tuple_shift 
(std::tuple<A1,Args...> const& _tuple) {
    using namespace std;
    //typedef std::tuple<A1,Args...> TT;
    auto ii = make_index_sequence< sizeof...(Args) /* this discounts A1 */ >();
    return tuple_shift_impl ( _tuple, ii);
    //return make_tuple( forward<Args...>(get<Indices + 1>(_tuple)...) );
}



#else
// c++03 impl

template <typename A0>
std::tuple<> tuple_shift (std::tuple<A0> const&) {

    return std::make_tuple<>( );
}
template <typename A0, typename A1>
std::tuple<A1> tuple_shift (std::tuple<A0,A1> const& t) {
    using std::get;
    return std::make_tuple( get<1>(t) );
}
................................................................................
    return std::make_tuple( get<1>(t), get<2>(t), get<3>(t), get<4>(t) );
}
template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
std::tuple<A1,A2,A3,A4,A5> tuple_shift (std::tuple<A0,A1,A2,A3,A4,A5> const& t) {
    using std::get;
    return std::make_tuple( get<1>(t), get<2>(t), get<3>(t), get<4>(t), get<5>(t) );
}
template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
std::tuple<A1,A2,A3,A4,A5,A6> tuple_shift (std::tuple<A0,A1,A2,A3,A4,A5,A6> const& t) {
    using std::get;
    return std::make_tuple( get<1>(t), get<2>(t), get<3>(t), get<4>(t), get<5>(t), get<6>(t) );
}

#endif

// 
// tuple_unshift, tuple_push
// these are basically just taking advantage of std::tuple_cat.
// 

#ifdef DOXYGEN_DOC
/**
 * @brief Returns a tuple with an extra element at the beginning.
 * @ingroup cxxo-sup-tuple
 * @param v An element to be added to a tuple.
 * @param tu A @c std::tuple of N elements.
 * @return A tuple of N+1 elements { v, tu_0, ... } .
 * @throws Whatever @c make_tuple throws.
 * 
 * Given a tuple @a tu and a value @a v , @c tuple_unshift creates 
 * a new tuple the element @a v  and then the elements of @a tu .
 * 
 * If @a tu is a tuple with zero elements, @c tuple_unshift returns a tuple of @a v .
 * 
 * 
 */
template <typename T, typename... TArgs >
std::tuple<T,Targs...> tuple_unshift (T const& t0, std::tuple<TArgs...> const& tu);


/**
 * @brief Returns a tuple with an extra element at the end.
 * @ingroup cxxo-sup-tuple
 * @param v An element to be added to a tuple.
 * @param tu A @c std::tuple of N elements.
 * @return A tuple of N+1 elements { tu_0, ... , v } .
 * @throws Whatever @c make_tuple throws.
 * 
 * Given a tuple @a tu and a value @a v , @c tuple_push creates 
 * a new tuple with the elements of @a tu and then the element @a v .
 * 
 * If @a tu is a tuple with zero elements, @c tuple_push returns a tuple of @a v .
 * 
 * 
 * 
 */
template <typename T, typename... TArgs >
std::tuple<Targs...,T> tuple_push (T const& t0, std::tuple<TArgs...> const& tu);


#endif


#if (CXXOMFORT_CXX_STD >= 2011)

template <typename T, typename... TArgs>
std::tuple<T, TArgs...> tuple_unshift 
( T const& v, std::tuple<TArgs...> const& tu) {
	return std::tuple_cat ( std::make_tuple(v), tu);
}

template <typename... TArgs, typename T>
std::tuple<TArgs..., T> tuple_push
( std::tuple<TArgs...> const& tu, T const& v) {
	return std::tuple_cat ( tu, std::make_tuple(v) );
}

#else

namespace detail {

template <typename T, typename TType>
struct tuple_unshift_t {
};

template <typename T>
struct tuple_unshift_t<T, std::tuple<> > {
	typedef std::tuple<T> type;
	typedef std::tuple<> argument_type;
	type operator() (T const& t, argument_type const&) const {
		return std::make_tuple(t);
	}
};

template <typename T, typename T0>
struct tuple_unshift_t<T, std::tuple<T0> > {
	typedef std::tuple<T,T0> type;
	typedef std::tuple<T0> argument_type;
	type operator() (T const& t, argument_type const& tt) const {
		return std::tuple_cat (std::make_tuple(t), tt);
	}
};

template <typename T, typename T0, typename T1>
struct tuple_unshift_t<T, std::tuple<T0,T1> > {
	typedef std::tuple<T,T0,T1> type;
	type operator() (T const& t, std::tuple<T0,T1> const& tt) const {
		return std::tuple_cat (std::make_tuple(t), tt);
	}
};

template <typename T, typename T0, typename T1, typename T2>
struct tuple_unshift_t<T, std::tuple<T0,T1,T2> > {
	typedef std::tuple<T0,T1,T2> argument_type;
	typedef std::tuple<T,T0,T1,T2> type;
	type operator() (T const& t, argument_type const& tt) const {
		return std::tuple_cat (std::make_tuple(t), tt);
	}
};

template <typename T, typename T0, typename T1, typename T2, typename T3>
struct tuple_unshift_t<T, std::tuple<T0,T1,T2,T3> > {
	typedef std::tuple<T0,T1,T2,T3> argument_type;
	typedef std::tuple<T,T0,T1,T2,T3> type;
	type operator() (T const& t, argument_type const& tt) const {
		return std::tuple_cat (std::make_tuple(t), tt);
	}
};


} // detail

template <typename T, typename Tuple>
typename detail::tuple_unshift_t<T,Tuple>::type 
tuple_unshift (T const& v, Tuple const& tt) {
	return detail::tuple_unshift_t<T,Tuple>()(v,tt);
}

#endif


}
}} // cxxomfort


//
// tuple_call (f, Tuple)

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

109
110
111
112
113
114
115

116
117
118
119
120
121
122
123
124

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

#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_CLANG,>=302)) // 3.2
	string_view S (__PRETTY_FUNCTION__);

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







>

|







109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125

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

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

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
..
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
...
125
126
127
128
129
130
131

132
133
134
135
136
137
138
#ifndef CXXOMFORT_LIBRARY_TYPETRAITS_HPP
#define CXXOMFORT_LIBRARY_TYPETRAITS_HPP
/**
 * @file
 * 
 * Interfaces defined in this file:
 * 
 * * @c is_std_array
 * * @c is_std_basic_string
 * * @c is_std_byte 
 * * @c is_std_pair
 * * @c is_tuple
 * * @c is_enumeration_like
 * * @c has_operator_brackets
 * * @c Ic and @link impl/ic_types.hpp integral_constant shortcuts @endlink 
 *
 * 
 * */
#include <cxxomfort/type_traits.hpp>
#include <cxxomfort/utility.hpp> // pair
#include <cxxomfort/cstddef.hpp> // byte
#include <array> // array
#include "sequences.hpp" 

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


namespace cxxomfort{ namespace library{ 
namespace type_traits{

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

//
// is_noexcept, add_noexcept
//
................................................................................
 */
template <typename T> struct is_std_pair: std::false_type {};
template <typename A, typename B> struct is_std_pair< std::pair<A,B> >: std::true_type {};

// is_fundamental_wrapper



// using others from other facilities
using ::cxxomfort::is_std_array;
//using ::cxxomfort::library::string::is_std_basic_string;
using ::cxxomfort::library::tuple::is_tuple;
//using ::cxxomfort::library::is_typesafe_enum;


/**
 * @brief type_trait that identifies @c enum s , <code>enum class</code> es and typesafe_enums.
 */
/*
template <typename T> struct is_enumeration_like
: std::integral_constant<bool, 
    std::is_enum<T>::value || is_typesafe_enum<T>::value
> {};
*/


#if (0) // UNTESTED

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


}}}

/*
 * integral_constant shortcuts
 * */

#include "../impl/ic_types.hpp"

// fixes for is_trivially_constructible<void>

/*
#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_CXX_EMULATION == 2011)
namespace std {




|

|


|




|

|




|
|




|







 







>





>






|







 







>







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
..
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
...
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#ifndef CXXOMFORT_LIBRARY_TYPETRAITS_HPP
#define CXXOMFORT_LIBRARY_TYPETRAITS_HPP
/**
 * @file
 *
 * Interfaces defined in this file:
 *
 * * @c is_std_array
 * * @c is_std_basic_string
 * * @c is_std_byte
 * * @c is_std_pair
 * * @c is_tuple
 * * @c is_enumeration_like
 * * @c has_operator_brackets
 * * @c Ic and @link impl/ic_types.hpp integral_constant shortcuts @endlink
 *
 *
 * */
#include <cxxomfort/type_traits.hpp>
#include <cxxomfort/utility.hpp> // pair
#include <cxxomfort/cstddef.hpp> // byte
#include <cxxomfort/array.hpp> // array
#include "sequences.hpp"

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


namespace cxxomfort{ namespace library{
namespace type_traits{

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

//
// is_noexcept, add_noexcept
//
................................................................................
 */
template <typename T> struct is_std_pair: std::false_type {};
template <typename A, typename B> struct is_std_pair< std::pair<A,B> >: std::true_type {};

// is_fundamental_wrapper


#if (CXXOMFORT_CXX_STD>=1997)
// using others from other facilities
using ::cxxomfort::is_std_array;
//using ::cxxomfort::library::string::is_std_basic_string;
using ::cxxomfort::library::tuple::is_tuple;
//using ::cxxomfort::library::is_typesafe_enum;
#endif

/**
 * @brief type_trait that identifies @c enum s , <code>enum class</code> es and typesafe_enums.
 */
/*
template <typename T> struct is_enumeration_like
: std::integral_constant<bool,
    std::is_enum<T>::value || is_typesafe_enum<T>::value
> {};
*/


#if (0) // UNTESTED

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


}}}

/*
 * integral_constant shortcuts
 * */

#include "../impl/ic_types.hpp"

// fixes for is_trivially_constructible<void>

/*
#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_CXX_EMULATION == 2011)
namespace std {

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

10
11
12
13
14
15
16







17
18
19
20
21
22
23
..
42
43
44
45
46
47
48






49
50
51
52
53
54
55
#include <cxxomfort/type_traits.hpp>
#include <cxxomfort/utility.hpp> // pair
#include <cxxomfort/impl/relationals.hpp>


namespace cxxomfort { namespace library { 
namespace utility {








#if (CXXOMFORT_CXX_STD >= 1997)


//
// simple_pair
//
................................................................................
		return vl.first==vr.first && vl.second == vr.second;
	}
	friend bool operator<  (simple_pair const& vl, simple_pair const& vr) CXXO_NOEXCEPTNOTHROW {
		return vl.first < vr.first || (!(vr.first < vl.first) && vl.second < vr.second); 
	}
	
};







#define TPARAMS typename T1, typename T2
#define TARGS T1, T2
CXXO_GENERATE_RELATIONALS_T(simple_pair);
#undef TARGS
#undef TPARAMS








>
>
>
>
>
>
>







 







>
>
>
>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
..
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <cxxomfort/type_traits.hpp>
#include <cxxomfort/utility.hpp> // pair
#include <cxxomfort/impl/relationals.hpp>


namespace cxxomfort { namespace library { 
namespace utility {

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

template <>
struct prio<0> {};

#if (CXXOMFORT_CXX_STD >= 1997)


//
// simple_pair
//
................................................................................
		return vl.first==vr.first && vl.second == vr.second;
	}
	friend bool operator<  (simple_pair const& vl, simple_pair const& vr) CXXO_NOEXCEPTNOTHROW {
		return vl.first < vr.first || (!(vr.first < vl.first) && vl.second < vr.second); 
	}
	
};

template <typename T1, typename T2>
simple_pair<T1,T2> make_simple_pair (T1 const& t1, T2 const& t2) {
	simple_pair<T1,T2> ret = { t1, t2 };
	return ret;
}

#define TPARAMS typename T1, typename T2
#define TARGS T1, T2
CXXO_GENERATE_RELATIONALS_T(simple_pair);
#undef TARGS
#undef TPARAMS

Changes to cxxomfort/cxxomfort/limits.hpp.

20
21
22
23
24
25
26

27
28
29
30
31
32
33
#pragma message CXXO_NOTICE("enabled <limits> support.")
#endif


namespace cxxomfort {

namespace impl {

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

template <size_t base>
struct log_<1, base> {
    enum { value = 0 };







>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma message CXXO_NOTICE("enabled <limits> support.")
#endif


namespace cxxomfort {

namespace impl {

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

template <size_t base>
struct log_<1, base> {
    enum { value = 0 };

Changes to cxxomfort/cxxomfort/random.hpp.

212
213
214
215
216
217
218





















219
220
221
222
223
224
225

    #endif
#endif


#endif // CXX_STD >= 1997
#endif






















/**
 * @page std0random <random>
 * @brief Backports from <random>
 * 
 * Including the header brings up <random>'s features, accounting for eg.: 
 * location being @c std::tr1::random... where set up in C++03.







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







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

    #endif
#endif


#endif // CXX_STD >= 1997
#endif



//
// cxxomfort-fixes
// 
namespace cxxomfort { namespace fix {
#if (CXXOMFORT_CXX_STD >= 2011)
	using ::std::shuffle_order_engine;
	using ::std::knuth_b;
#elif (CXXOMFORT_CXX_EMULATION >= 2011 && CXXO_COMPILER_SUPPORT_tr1_random)
	using ::std::tr1::shuffle_order_engine;
	using ::std::tr1::knuth_b;
#else
	using ::cxxomfort::cxxostd::shuffle_order_engine;
	using ::cxxomfort::cxxostd::knuth_b;
#endif


} }


/**
 * @page std0random <random>
 * @brief Backports from <random>
 * 
 * Including the header brings up <random>'s features, accounting for eg.: 
 * location being @c std::tr1::random... where set up in C++03.

Changes to cxxomfort/cxxomfort/string_view.hpp.

1
2
3
4
5

6

7
8
9
10
11
12
13
14
#ifndef CXXOMFORT_STRING_VIEW_HPP
#define CXXOMFORT_STRING_VIEW_HPP

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

#elif (1 || CXXOMFORT_CXX_STD >= 1997)

#include "impl/17-string_view.hpp"
//#include "impl/17-hash_string_view.hpp"

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




|
>

>
|







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

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

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

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

Changes to cxxomfort/cxxomfort/system_error.hpp.

32
33
34
35
36
37
38

39
40
41
42
43
44
45
#else


#include <cxxomfort/base.hpp>
#include <cxxomfort/base/explicit_cast.hpp>
#include <cxxomfort/cerrno.hpp>
#include "impl/relationals.hpp"

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








>







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#else


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

Changes to cxxomfort/cxxomfort/tuple.hpp.

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

34


























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


49
50
51
52
53
54
55
 * @ingroup std0tuple
 * 
 */

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

#elif (CXXOMFORT_CXX_STD>=1997)

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

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

// for TR1, we need to bring names into namespace std
#if (CXXO_COMPILER_SUPPORT_tr1_tuple)
namespace std {
    using tr1::tuple;
    using tr1::tuple_size;
    using tr1::tuple_element;
    using tr1::get;
    using tr1::tie;
    using tr1::ignore;
    using tr1::make_tuple;

}


























#endif

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

namespace cxxomfort {
namespace cxxostd {


} //cxxomfort::cxxostd
} //

#else // CXX_STD < 1997



#endif // CXX_STD

#endif

/**
 * @page std0tuple <tuple>







|

|
|
|
|

|
|
|

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

|
|
|









>
>







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

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

#elif (CXXOMFORT_CXX_STD>=1997 && CXXOFLAG_tr1)

	#include "base.hpp"
	#include "utility.hpp" // index_sequence
	#include <tuple> // d'uh
	#include <cxxomfort/array.hpp> // array <-> tuple conversions

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

	// for TR1, we need to bring names into namespace std
	#if (CXXO_COMPILER_SUPPORT_tr1_tuple)
	namespace std {
		using tr1::tuple;
		using tr1::tuple_size;
		using tr1::tuple_element;
		using tr1::get;
		using tr1::tie;
		using tr1::ignore;
		using tr1::make_tuple;
		//using tr1::tuple_cat;

	}

	// backport tuple_cat

	namespace std {

	template <typename A0, typename B0>
	tuple<A0,B0>
	tuple_cat (tuple<A0> const& a, tuple<B0> const& b) {
		return make_tuple(get<0>(a), get<0>(b) );
	}

	template <typename A0, typename B0, typename B1>
	tuple<A0,B0,B1>
	tuple_cat (tuple<A0> const& a, tuple<B0,B1> const& b) {
		return make_tuple(get<0>(a), get<0>(b), get<1>(b) );
	}

	template <typename A0, typename A1, typename B0, typename B1>
	tuple<A0,A1,B0,B1>
	tuple_cat (tuple<A0,A1> const& a, tuple<B0,B1> const& b) {
		return make_tuple(get<0>(a), get<1>(a), get<0>(b), get<1>(b) );
	}

	}

	#endif

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

namespace cxxomfort {
namespace cxxostd {


} //cxxomfort::cxxostd
} //

#else // CXX_STD < 1997

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

#endif // CXX_STD

#endif

/**
 * @page std0tuple <tuple>

Changes to cxxomfort/cxxomfort/type_traits.hpp.

35
36
37
38
39
40
41
42

43
44
45
46
47
48
49
50
51




52
53



















































54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
...
280
281
282
283
284
285
286

287
288

289
290
291
292
293
294
295


	#include "impl/11-decay.hpp"
	#include "impl/11-underlying_type.hpp"
	#include "impl/11-common_type.hpp"
	#include "impl/11-is_tn_xble.hpp"

#else // CXX_STD < 1997


	// 
	// compilers that don't have <type_traits>; 
	// here we only include a minimum subset of traits
	// and we expect an external vendor to provision 
	// at least some amount of TR1
	//
	
	#include "impl/11-conditional.hpp"




	#include "util/type_traits.hpp" // at least the basic traits




















































	// EXPECT
	#include <type_traits> // <-- vendor?
	#include "impl/using_tr1_type_traits.hpp"

	#include "impl/11-decay.hpp"
	#include "impl/11-is_tn_xble.hpp"
	
	



#endif // CXX_STD
	



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


................................................................................
namespace std {
    template <typename T> struct is_trivially_destructible
    : integral_constant<bool, __has_trivial_destructor(T)> {};
}
#endif    

// is_...._move_constructible - for C++03

#include "impl/11-move_traits.hpp"



#if 0 // -- is_constructible
//
// "variadic" is_constructible, is_assignable implementation
//

//#include "impl/is_constructible.hpp"







|
>









>
>
>
>
|

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

|




<
<
<



<
<







 







>
|
<
>







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115



116
117
118


119
120
121
122
123
124
125
...
331
332
333
334
335
336
337
338
339

340
341
342
343
344
345
346
347


	#include "impl/11-decay.hpp"
	#include "impl/11-underlying_type.hpp"
	#include "impl/11-common_type.hpp"
	#include "impl/11-is_tn_xble.hpp"

#else // CXX_STD < 1997 / no <type_traits>


	// 
	// compilers that don't have <type_traits>; 
	// here we only include a minimum subset of traits
	// and we expect an external vendor to provision 
	// at least some amount of TR1
	//
	
	#include "impl/11-conditional.hpp"
	#if defined(CXXOMFORT_USE_INTERNAL_TR1)
		#if (CXXOMFORT_NOTICES > 2)
			#pragma message CXXO_NOTICE("internal TR1: <type_traits>")
		#endif
		#include "util/type_traits.hpp" // at least the basic traits

namespace std {
	using ::cxxomfort::traits::integral_constant;
	using ::cxxomfort::traits::false_type;
	using ::cxxomfort::traits::true_type;
	using ::cxxomfort::traits::is_same;

	using ::cxxomfort::traits::is_integral;
	using ::cxxomfort::traits::is_floating_point;
	using ::cxxomfort::traits::is_arithmetic;
	using ::cxxomfort::traits::is_void;
	using ::cxxomfort::traits::is_fundamental;

	using ::cxxomfort::traits::is_const;
	using ::cxxomfort::traits::is_volatile;
	using ::cxxomfort::traits::add_const;
	using ::cxxomfort::traits::add_volatile;
	using ::cxxomfort::traits::remove_const;
	using ::cxxomfort::traits::remove_volatile;
	using ::cxxomfort::traits::add_cv;
	using ::cxxomfort::traits::remove_cv;

	using ::cxxomfort::traits::is_pointer;
	using ::cxxomfort::traits::is_reference;
	using ::cxxomfort::traits::add_pointer;
	using ::cxxomfort::traits::add_reference;
	using ::cxxomfort::traits::remove_pointer;
	using ::cxxomfort::traits::remove_reference;

	using ::cxxomfort::traits::is_array;
	using ::cxxomfort::traits::rank;
	using ::cxxomfort::traits::extent;
	using ::cxxomfort::traits::remove_extent;

	using ::cxxomfort::traits::is_function;
	using ::cxxomfort::traits::is_member_function_pointer;
	using ::cxxomfort::traits::is_member_object_pointer;

		#if (CXXO_COMPILER_SUPPORT_type_intrinsics)
	using ::cxxomfort::traits::is_enum;
	using ::cxxomfort::traits::is_union;
	using ::cxxomfort::traits::is_class;
	using ::cxxomfort::traits::is_pod;
		#endif
}

	using ::cxxomfort::traits::is_scalar;
	using ::cxxomfort::traits::is_compound;

	#endif


	// EXPECT
	//#include <type_traits> // <-- vendor?
	#include "impl/using_tr1_type_traits.hpp"

	#include "impl/11-decay.hpp"
	#include "impl/11-is_tn_xble.hpp"





#endif // CXX_STD




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


................................................................................
namespace std {
    template <typename T> struct is_trivially_destructible
    : integral_constant<bool, __has_trivial_destructor(T)> {};
}
#endif    

// is_...._move_constructible - for C++03
	#if (CXXOMFORT_CXX_STD > 1997)
		#include "impl/11-move_traits.hpp"

	#endif

#if 0 // -- is_constructible
//
// "variadic" is_constructible, is_assignable implementation
//

//#include "impl/is_constructible.hpp"

Changes to cxxomfort/cxxomfort/typeindex.hpp.

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
}
	#endif // no_std_using

#endif


#if (CXXOMFORT_CXX_STD >= 2011 || CXXO_CXXSTDHEADER_typeindex>0)

#else
namespace std {
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_CXX_EMULATION==0)
    namespace tr1 {
    #endif
    
    template<>
    struct hash< type_index > {
        typedef type_index argument_type;
        typedef size_t result_type;
        result_type operator()(argument_type const& s) const CXXO_NOEXCEPTNOTHROW   {
            //cout<< "[hash<type_index> for "<< s.name()<< "]"<< flush;
            return s.hash_code();
        }    
    };
    
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_CXX_EMULATION==0)
    } // tr1
    #endif

}
#endif // no_std_using

#endif

/**
 * @page std0typeindex <typeindex>
 * @brief Backports related to <typeindex>







>

<
|
<
<
<










|
<
<
<
<







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
}
	#endif // no_std_using

#endif


#if (CXXOMFORT_CXX_STD >= 2011 || CXXO_CXXSTDHEADER_typeindex>0)
	// already has specialization for std::hash
#else

CXXO_STDTR1_OPEN() 



    template<>
    struct hash< type_index > {
        typedef type_index argument_type;
        typedef size_t result_type;
        result_type operator()(argument_type const& s) const CXXO_NOEXCEPTNOTHROW   {
            //cout<< "[hash<type_index> for "<< s.name()<< "]"<< flush;
            return s.hash_code();
        }    
    };
    
CXXO_STDTR1_CLOSE()




#endif // no_std_using

#endif

/**
 * @page std0typeindex <typeindex>
 * @brief Backports related to <typeindex>

Changes to cxxomfort/cxxomfort/util/meta.hpp.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 * * disable_if
 * * selection
 * * meta_and, meta_or
 * 
 */

#include <cxxomfort/config.hpp>
#include "type_traits.hpp"
#include <cxxomfort/base/static_assert.hpp>
#include <cxxomfort/impl/11-conditional.hpp>
//#define CXXOMFORT_IMPLEMENTS_n2240 CXXO_IMPLSTATUS_LIBRARY()


namespace cxxomfort {








|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 * * disable_if
 * * selection
 * * meta_and, meta_or
 * 
 */

#include <cxxomfort/config.hpp>
//#include "type_traits.hpp"
#include <cxxomfort/base/static_assert.hpp>
#include <cxxomfort/impl/11-conditional.hpp>
//#define CXXOMFORT_IMPLEMENTS_n2240 CXXO_IMPLSTATUS_LIBRARY()


namespace cxxomfort {