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

Overview
Comment:Commit 2017-12-24 - Multuple [sic] improvements with a byte of Saturnalia.
  • cxxomfort: Added <algorithm>, <functional>, <iterator>, <utility> cstd forward headers.
  • cxxomfort: Added <cstdint> cstd forward header.
  • cstddef: Added byte from c++17.
  • library: Added the count_frequencies algorithms.
  • library: Fixed the 7-, 8-, and 9-argument c++03 signatures for to_string.
  • library: Library Utilities in <tuple.hpp> moved to the proper <library/tuplefn.hpp> header.
  • library: Added 6-, 7- and 8- tuple arguments overloads to tuple_pop, tuple_shift.
  • library: Added tuple_visit(function, tuple) (aka foreach for tuples).
  • tuple: Fixed tuple_apply(function,tuple) to correspond as a c++17 backport.
  • tuple: Added make_from_tuple from c++17 (it only works on actual tuples in c++03, c++11).
  • PENDING: library: Add tuple_if
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:0c1dc33fc412517f40129fafe2b35bb0cc370585
User & Date: luismachuca 2017-12-24 20:55:13
Context
2018-07-03
03:05
Commit 2018-07-01 - Forward with library improvements, <numeric> and build logs.
  • cxxomfort: Corrected CXXOMFORT_NOTICES in various headers.
  • cxxomfort: Cleared most "typedef unused" warnings.
  • cxxomfort: Most if not all files converted to LF line endings.
  • cxxomfort: CXXOMFORT_DATE now uses full YYYYMMDD format.
  • cxxomfort: CXXOMFORT_NO_STD_USING.
  • cxxomfort: Added numeric.hpp and numerics to library.
  • cxxomfort: Header files also include javadoc code for generating future documentation.
  • library: algorithm: Added inplace_if.
  • library: numeric: Added static_gcd, static_lcm.
  • library: string: Added chr, wchr, utf8chr.
  • library: string: Added split_to.
  • impl: byte is moved to namespace cxxomfort::cstddef.
  • cstdint: Now c++11 emulation mode also relies on pstdint.h.
  • forward_list: Fixed the implementation of insert_after, emplace_after.
  • iterator: Removed warnings about unused typedefs in begin(), end().
  • memory: Updated make_unique as well as its STD requirements to go below C++14.
  • tuple: Removed a warning about aggregate brackets.
  • type_traits: enable_if, conditional moved to their own impl file.
check-in: 5862a10f user: luismachuca tags: trunk
2017-12-24
20:55
Commit 2017-12-24 - Multuple [sic] improvements with a byte of Saturnalia.
  • cxxomfort: Added <algorithm>, <functional>, <iterator>, <utility> cstd forward headers.
  • cxxomfort: Added <cstdint> cstd forward header.
  • cstddef: Added byte from c++17.
  • library: Added the count_frequencies algorithms.
  • library: Fixed the 7-, 8-, and 9-argument c++03 signatures for to_string.
  • library: Library Utilities in <tuple.hpp> moved to the proper <library/tuplefn.hpp> header.
  • library: Added 6-, 7- and 8- tuple arguments overloads to tuple_pop, tuple_shift.
  • library: Added tuple_visit(function, tuple) (aka foreach for tuples).
  • tuple: Fixed tuple_apply(function,tuple) to correspond as a c++17 backport.
  • tuple: Added make_from_tuple from c++17 (it only works on actual tuples in c++03, c++11).
  • PENDING: library: Add tuple_if
check-in: 0c1dc33f user: luismachuca tags: trunk
2017-12-19
03:32
Commit 2017-12-19 - Transparent headers and typesafe enum.
  • cxxomfort: Added cstddef.hpp and its transparent header mirror.
  • cxxomfort: Added random.hpp and its transparent header mirror.
  • cxxomfort: Corrected CXXOMFORT_NOTICES in various headers.
  • config: Improved detection of MSVC 2015 (ver 1900) C++ support.
  • config: Improved detection of C++17 mode.
  • library: Added typesafe_enum.
  • random: Renames of the functors in C++03 according to C++11.
  • PENDING: cstddef: Adding std::byte from C++17.
  • PENDING: functional: Fixes to functors, adding not_fn.
  • PENDING: in_place tag for experimental::optional.
  • PENDING: library: strsprintf.
check-in: d2fcaba9 user: luismachuca tags: trunk
Changes

Changes to cxxomfort/cxxomfort/algorithm.hpp.

249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
...
268
269
270
271
272
273
274
275
276
277
278
279

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


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

namespace std {

    //! using copy_if and others when in C++03.
    using ::cxxomfort::algorithm::copy_if;
    using ::cxxomfort::algorithm::copy_n;
    using ::cxxomfort::algorithm::partition_copy;

................................................................................
    using ::cxxomfort::algorithm::minmax;
    using ::cxxomfort::algorithm::minmax_element;
    using ::cxxomfort::algorithm::shuffle;
    
    using ::cxxomfort::algorithm::for_each_n;
    
}


#endif // using emulation

#endif







|







 







|




249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
...
268
269
270
271
272
273
274
275
276
277
278
279

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


#if (CXXOMFORT_CXX_STD < 2011) && (CXXO_COMPILER_SUPPORT_std_cxx11_algorithms == 0)
#if (!defined(CXXOMFORT_NO_STD_USING))
namespace std {

    //! using copy_if and others when in C++03.
    using ::cxxomfort::algorithm::copy_if;
    using ::cxxomfort::algorithm::copy_n;
    using ::cxxomfort::algorithm::partition_copy;

................................................................................
    using ::cxxomfort::algorithm::minmax;
    using ::cxxomfort::algorithm::minmax_element;
    using ::cxxomfort::algorithm::shuffle;
    
    using ::cxxomfort::algorithm::for_each_n;
    
}
#endif // std using

#endif // using emulation

#endif

Changes to cxxomfort/cxxomfort/algorithms.hpp.

1
2


3
4
#ifndef CXXOMFORT_ALGORITHMS_HPP
#define CXXOMFORT_ALGORITHMS_HPP


#include "algorithm.hpp"
#endif


>
>


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

Changes to cxxomfort/cxxomfort/base/static_assert.hpp.

22
23
24
25
26
27
28

29
30
31
32
33
34
35
#if (CXXOMFORT_CXX_STD < 2011)
#if (CXXO_COMPILER_SUPPORT_static_assert == 0) // static_assert is not supported
    #define CXXOMFORT_USING_static_assert
#endif
#endif

// implementation


#if defined(CXXOMFORT_USING_static_assert)
    #if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 2)
    #pragma message CXXO_NOTICE("enabled 'static_assert' emulation.")
    #endif

/*







>







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#if (CXXOMFORT_CXX_STD < 2011)
#if (CXXO_COMPILER_SUPPORT_static_assert == 0) // static_assert is not supported
    #define CXXOMFORT_USING_static_assert
#endif
#endif

// implementation
/////////////////

#if defined(CXXOMFORT_USING_static_assert)
    #if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 2)
    #pragma message CXXO_NOTICE("enabled 'static_assert' emulation.")
    #endif

/*

Changes to cxxomfort/cxxomfort/config.hpp.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 * 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 YYYYMM
#define CXXOMFORT_DATE 201712
//! Defines the library version (WARNING: to be deprecated)
#define CXXOMFORT_VERSION 54

#define CXXO_STRINGIZE_IMPL(x) #x
#define CXXO_STRINGIZE(x) CXXO_STRINGIZE_IMPL(x)
#define CXXO_JOIN(x,y) x##y

//
// Standard Mode







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 * 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 YYYYMM
#define CXXOMFORT_DATE 201712
//! Defines the library version (WARNING: to be deprecated)
#define CXXOMFORT_VERSION 55

#define CXXO_STRINGIZE_IMPL(x) #x
#define CXXO_STRINGIZE(x) CXXO_STRINGIZE_IMPL(x)
#define CXXO_JOIN(x,y) x##y

//
// Standard Mode

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

86
87
88
89
90
91
92


93
94
95
96
97
98
99
...
130
131
132
133
134
135
136




137
138
139
140
141
142
143
        #define CXXO_COMPILER_SUPPORT_std_cxx11_algorithms 1
        //#define CXXO_COMPILER_SUPPORT_std_iterator_helpers 1
        #define CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers 1
        #undef  CXXO_COMPILER_SUPPORT_unique_ptr
        #define CXXO_COMPILER_SUPPORT_unique_ptr 1
        #undef  CXXO_COMPILER_SUPPORT_variadic
        #define CXXO_COMPILER_SUPPORT_variadic 1


    #endif
#endif
#if (CXXOMFORT_COMPILER_VERSION >= 406)
    #if defined(__GXX_EXPERIMENTAL_CXX0X__)
        #undef  CXXOMFORT_CXX_EMULATION
        #define CXXOMFORT_CXX_EMULATION 2011
        #undef  CXXO_COMPILER_SUPPORT_alignof
................................................................................
        #undef  CXXO_COMPILER_SUPPORT_std_cxx11_constructible_traits
        #define CXXO_COMPILER_SUPPORT_std_cxx11_constructible_traits 1
        #undef  CXXO_COMPILER_SUPPORT_unique_ptr
        #define CXXO_COMPILER_SUPPORT_unique_ptr 1
        #undef  CXXO_COMPILER_SUPPORT_variadic
        #define CXXO_COMPILER_SUPPORT_variadic 1
    #else




    #endif
#endif

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







>
>







 







>
>
>
>







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
...
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
        #define CXXO_COMPILER_SUPPORT_std_cxx11_algorithms 1
        //#define CXXO_COMPILER_SUPPORT_std_iterator_helpers 1
        #define CXXO_COMPILER_SUPPORT_std_metaprogramming_helpers 1
        #undef  CXXO_COMPILER_SUPPORT_unique_ptr
        #define CXXO_COMPILER_SUPPORT_unique_ptr 1
        #undef  CXXO_COMPILER_SUPPORT_variadic
        #define CXXO_COMPILER_SUPPORT_variadic 1
    #else
        
    #endif
#endif
#if (CXXOMFORT_COMPILER_VERSION >= 406)
    #if defined(__GXX_EXPERIMENTAL_CXX0X__)
        #undef  CXXOMFORT_CXX_EMULATION
        #define CXXOMFORT_CXX_EMULATION 2011
        #undef  CXXO_COMPILER_SUPPORT_alignof
................................................................................
        #undef  CXXO_COMPILER_SUPPORT_std_cxx11_constructible_traits
        #define CXXO_COMPILER_SUPPORT_std_cxx11_constructible_traits 1
        #undef  CXXO_COMPILER_SUPPORT_unique_ptr
        #define CXXO_COMPILER_SUPPORT_unique_ptr 1
        #undef  CXXO_COMPILER_SUPPORT_variadic
        #define CXXO_COMPILER_SUPPORT_variadic 1
    #else
        #undef  CXXO_COMPILER_SUPPORT_tr1_random
        #define CXXO_COMPILER_SUPPORT_tr1_random 1
        #undef  CXXO_COMPILER_SUPPORT_tr1_type_traits
        #define CXXO_COMPILER_SUPPORT_tr1_type_traits 1
    #endif
#endif

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

Added cxxomfort/cxxomfort/cstd/algorithm.



















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
#ifndef CXXOMFORT_STD_ALGORITHM
#define CXXOMFORT_STD_ALGORITHM
/* 
 * Transparent header for automatic inclusion of cxxomfort library
 */
#include "../config.hpp"
#include "../algorithm.hpp"
#include CXXO_INCLUDE_SYS(algorithm)
#endif

Changes to cxxomfort/cxxomfort/cstd/cstddef.

2
3
4
5
6
7
8
9
10
11
12
#define CXXOMFORT_STD_CSTDDEF
/* 
 * Transparent header for automatic inclusion of cxxomfort library
 */
#include "../config.hpp"
#include "../cstddef.hpp"
#include CXXO_INCLUDE_SYS(cstddef)
//#include "../base/nullptr.hpp"
//#include "../base/static_assert.hpp"
//#include "../impl/17-byte.hpp"
#endif







<
<
<

2
3
4
5
6
7
8



9
#define CXXOMFORT_STD_CSTDDEF
/* 
 * Transparent header for automatic inclusion of cxxomfort library
 */
#include "../config.hpp"
#include "../cstddef.hpp"
#include CXXO_INCLUDE_SYS(cstddef)



#endif

Added cxxomfort/cxxomfort/cstd/cstdint.



















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
#ifndef CXXOMFORT_STD_CSTDINT
#define CXXOMFORT_STD_CSTDINT
/* 
 * Transparent header for automatic inclusion of cxxomfort library
 */
#include "../config.hpp"
#include "../cstdint.hpp"
//#include CXXO_INCLUDE_SYS(cstdint)
#endif

Added cxxomfort/cxxomfort/cstd/functional.



















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
#ifndef CXXOMFORT_STD_FUNCTIONAL
#define CXXOMFORT_STD_FUNCTIONAL
/* 
 * Transparent header for automatic inclusion of cxxomfort library
 */
#include "../config.hpp"
#include "../functional.hpp"
#include CXXO_INCLUDE_SYS(functional)
#endif

Added cxxomfort/cxxomfort/cstd/iterator.



















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
#ifndef CXXOMFORT_STD_ITERATOR
#define CXXOMFORT_STD_ITERATOR
/* 
 * Transparent header for automatic inclusion of cxxomfort library
 */
#include "../config.hpp"
#include "../base/iterator.hpp"
#include CXXO_INCLUDE_SYS(iterator)
#endif

Changes to cxxomfort/cxxomfort/cstd/random.

1
2
3
4
5
6
7
8
9
#ifndef CXXOMFORT_STD_RANDOM
#define CXXOMFORT_STD_RANDOM
/* 
 * Transparent header for automatic inclusion of cxxomfort library
 */
#include "../config.hpp"
#include "../random.hpp"
#include CXXO_INCLUDE_SYS(random)
#endif







|

1
2
3
4
5
6
7
8
9
#ifndef CXXOMFORT_STD_RANDOM
#define CXXOMFORT_STD_RANDOM
/* 
 * Transparent header for automatic inclusion of cxxomfort library
 */
#include "../config.hpp"
#include "../random.hpp"
//#include CXXO_INCLUDE_SYS(random)
#endif

Added cxxomfort/cxxomfort/cstd/utility.



















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
#ifndef CXXOMFORT_STD_UTILITY
#define CXXOMFORT_STD_UTILITY
/* 
 * Transparent header for automatic inclusion of cxxomfort library
 */
#include "../config.hpp"
#include "../utility.hpp"
#include CXXO_INCLUDE_SYS(utility)
#endif

Changes to cxxomfort/cxxomfort/cstddef.hpp.

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

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







|

|


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

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

Changes to cxxomfort/cxxomfort/forward_list.hpp.

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
...
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
    private:
    CXXO_COPYABLE_MOVABLE(forward_list);

    public:
    forward_list () CXXO_NOEXCEPT;                //< default-ctor
    forward_list (forward_list const&);           //< copy-ctor
    forward_list (forward_list const&, A const&); //< realloc copy constructor

    explicit forward_list
    (size_t, T const& t= T(), A const& a = A());  //< element-ctor

    template <typename I> forward_list
    (I, I, A const& a = A());                     //< sequence-ctor

    forward_list (CXXO_RV_REF(forward_list));     //< move-ctor

#if (CXXOMFORT_CXX_STD >= 2011)
    explicit forward_list (std::initializer_list<T> const&);          //< init-list-ctor
#endif
    ~forward_list ();                             //< destructor




    forward_list& operator=
    (CXXO_COPY_ASSIGN_REF(forward_list));                   //< copy-assignment
    forward_list& operator= (CXXO_RV_REF(forward_list));    //< move-assignment
#if (CXXOMFORT_CXX_STD >= 2011)
    forward_list& operator= (init_list_t);        //< init-list assignment
#endif

    void  assign (size_type, T const&); //< assign multiple copies of a value
    template <typename Iterator>
    void  assign (Iterator,Iterator);   //< assign a sequence

#if (CXXOMFORT_CXX_STD >= 2011)

    void  assign (std::initializer_list<T> const&);    //< assign a init-list
#endif

    allocator_type  get_allocator () const;  //< direct access to allocator



    bool       empty () const;          //< check if empty
    size_type  max_size () const;       //< max size




    const_reference front () const;     //< direct access to front
    reference       front ();           //< direct access to front

    const_iterator  cbegin () const CXXO_NOEXCEPT;     //< read-only iteration from begin
    const_iterator  begin ()  const CXXO_NOEXCEPT { return cbegin(); }
    const_iterator  cend ()   const CXXO_NOEXCEPT;     //< read-only iteration mark end
    const_iterator  end ()    const CXXO_NOEXCEPT { return cend(); }
    iterator        begin () CXXO_NOEXCEPT;            //< mutating iteration from begin
    iterator        end ()   CXXO_NOEXCEPT;            //< mutating iteration mark end

    //const_iterator  cbefore_begin () const;  //< read-only iteration mark before begin
    const_iterator  before_begin () const CXXO_NOEXCEPT;    //< read-only iteration mark before begin
    iterator        before_begin () CXXO_NOEXCEPT;          //< mutating iteration mark before begin




    void  push_front (T const&);        //< insert at begin
    void  push_front (CXXO_RV_REF(T));  //< insert at begin (by move)
    void  push_back (T const&);         //< insert at end, constant time; not in std
//    void  push_back (CXXO_RV_REF(T));   // insert at end, constant time (by move); not in std
    void  pop_front ();                 //< erase at begin

    CXXO_PSEUDOVARIADIC_MEMBER(void , emplace_front , );

    iterator   insert_after (const_iterator, T const&);          //< insert
    iterator   insert_after (const_iterator, CXXO_RV_REF(T));    //< insert (by move)
    iterator   insert_after (const_iterator, size_type, T const&);    //< insert multiple copies
    template< class I >
    iterator   insert_after (const_iterator pos, I ini, I fin);  //< insert a sequence
#if (CXXOMFORT_CXX_STD >= 2011)
    iterator   insert_after (const_iterator, std::initializer_list<T> const&);         //< insert a init-list
#else













#endif

    // emplace_after( p, ...)

    iterator   erase_after (const_iterator);           //< erase after position
    iterator   erase_after (const_iterator, const_iterator);     //< erase a sequence of elements

    void       clear ();                //< erase everything - return to defaulted state
    void       swap (forward_list&);    //< swap contents with another list


#if 0 // pending




    void       resize (size_type);
    void       resize (size_type, T const&);



    void  merge (forward_list&);
    void  merge (CXXO_RV_REF(forward_list));
    template <typename Compare>
    void  merge (forward_list&, Compare);
    template <typename Compare>
    void  merge (CXXO_RV_REF(forward_list), Compare);
................................................................................
    void       splice_after (const_iterator, forward_list &, const_iterator); // 2

    void       remove (T const&);
    template <typename Cond>
    void       remove_if (Cond c);

#if 0 // pending
    void  sort ();
    template <typename Compare>
    void  sort (Compare);

    void  reverse ();

    void  unique ();
    template <typename Compare>
    void  unique (Compare);
#endif







>


>


>

>





>
>
>



<
<
<
|



>

>



|
>
|
>


>
>
>



|






|




>
>
>




<
|
<
<








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





|
|
|
|
|
>

<
>
>
>
>


>
>







 







<
<
<







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
...
205
206
207
208
209
210
211



212
213
214
215
216
217
218
    private:
    CXXO_COPYABLE_MOVABLE(forward_list);

    public:
    forward_list () CXXO_NOEXCEPT;                //< default-ctor
    forward_list (forward_list const&);           //< copy-ctor
    forward_list (forward_list const&, A const&); //< realloc copy constructor
    
    explicit forward_list
    (size_t, T const& t= T(), A const& a = A());  //< element-ctor
    
    template <typename I> forward_list
    (I, I, A const& a = A());                     //< sequence-ctor
    
    forward_list (CXXO_RV_REF(forward_list));     //< move-ctor

#if (CXXOMFORT_CXX_STD >= 2011)
    explicit forward_list (std::initializer_list<T> const&);          //< init-list-ctor
#endif
    ~forward_list ();                             //< destructor

    // Assignment
    ////////
    
    forward_list& operator=
    (CXXO_COPY_ASSIGN_REF(forward_list));                   //< copy-assignment
    forward_list& operator= (CXXO_RV_REF(forward_list));    //< move-assignment



    
    void  assign (size_type, T const&); //< assign multiple copies of a value
    template <typename Iterator>
    void  assign (Iterator,Iterator);   //< assign a sequence
    
#if (CXXOMFORT_CXX_STD >= 2011)
    forward_list& operator= (std::initializer_list<T> const&);        //< init-list assignment
    void  assign (std::initializer_list<T> const&);    //< assign a init-list
#endif

    // Get Info
    ////////
    
    allocator_type  get_allocator () const;  //< direct access to allocator
    bool       empty () const;          //< check if empty
    size_type  max_size () const;       //< max size

    // Access
    ////////

    const_reference front () const;     //< direct access to front
    reference       front ();           //< direct access to front
    
    const_iterator  cbegin () const CXXO_NOEXCEPT;     //< read-only iteration from begin
    const_iterator  begin ()  const CXXO_NOEXCEPT { return cbegin(); }
    const_iterator  cend ()   const CXXO_NOEXCEPT;     //< read-only iteration mark end
    const_iterator  end ()    const CXXO_NOEXCEPT { return cend(); }
    iterator        begin () CXXO_NOEXCEPT;            //< mutating iteration from begin
    iterator        end ()   CXXO_NOEXCEPT;            //< mutating iteration mark end
    
    //const_iterator  cbefore_begin () const;  //< read-only iteration mark before begin
    const_iterator  before_begin () const CXXO_NOEXCEPT;    //< read-only iteration mark before begin
    iterator        before_begin () CXXO_NOEXCEPT;          //< mutating iteration mark before begin

    // Insertions
    ////////
    
    void  push_front (T const&);        //< insert at begin
    void  push_front (CXXO_RV_REF(T));  //< insert at begin (by move)
    void  push_back (T const&);         //< insert at end, constant time; not in std
//    void  push_back (CXXO_RV_REF(T));   // insert at end, constant time (by move); not in std

    


    iterator   insert_after (const_iterator, T const&);          //< insert
    iterator   insert_after (const_iterator, CXXO_RV_REF(T));    //< insert (by move)
    iterator   insert_after (const_iterator, size_type, T const&);    //< insert multiple copies
    template< class I >
    iterator   insert_after (const_iterator pos, I ini, I fin);  //< insert a sequence
#if (CXXOMFORT_CXX_STD >= 2011)
    iterator   insert_after (const_iterator, std::initializer_list<T> const&);         //< insert a init-list
#else
    CXXO_PSEUDOVARIADIC_MEMBER(void , emplace_front , ); //< emplace-insertion at the front

    // Deletions
    ////////
    
    void  pop_front ();                 //< erase at begin
    iterator   erase_after (const_iterator);           //< erase after position
    iterator   erase_after (const_iterator, const_iterator);     //< erase a sequence of elements
    
    void       clear ();                //< erase everything - return to defaulted state



#endif

    // emplace_after( p, ...)

    // Sort
    ////////
    
    void  sort ();
    template <typename Compare>
    void  sort (Compare);


    // General Modifications
    ////////
    
    void       swap (forward_list&);    //< swap contents with another list
    void       resize (size_type);
    void       resize (size_type, T const&);

#if 0 // pending

    void  merge (forward_list&);
    void  merge (CXXO_RV_REF(forward_list));
    template <typename Compare>
    void  merge (forward_list&, Compare);
    template <typename Compare>
    void  merge (CXXO_RV_REF(forward_list), Compare);
................................................................................
    void       splice_after (const_iterator, forward_list &, const_iterator); // 2

    void       remove (T const&);
    template <typename Cond>
    void       remove_if (Cond c);

#if 0 // pending




    void  reverse ();

    void  unique ();
    template <typename Compare>
    void  unique (Compare);
#endif

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

49
50
51
52
53
54
55

56
57
58
59
60
61
62
63
64
65
66
67

68
69
    return true;
}

} // cxxomfort::algo
} // cxxomfort

// These were added in c++11

#if (CXXOMFORT_CXX_STD < 2011)
namespace std {
#if (CXXOMFORT_COMPILER_ID==CXXO_VALUE_COMPILER_GCC && CXXOMFORT_COMPILER_VERSION >=404 && CXXOMFORT_COMPILER_VERSION <= 406 && CXXOMFORT_CXX_EMULATION==2011 )
    // GCC already has defined these in 4.4-4.6 c++0x mode
#else
    using ::cxxomfort::algorithm::all_of;
    using ::cxxomfort::algorithm::any_of;
    using ::cxxomfort::algorithm::none_of;
#endif

}
#endif // c++11

#endif








>












>


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
    return true;
}

} // cxxomfort::algo
} // cxxomfort

// These were added in c++11
#if (!defined(CXXOMFORT_NO_STD_USING))
#if (CXXOMFORT_CXX_STD < 2011)
namespace std {
#if (CXXOMFORT_COMPILER_ID==CXXO_VALUE_COMPILER_GCC && CXXOMFORT_COMPILER_VERSION >=404 && CXXOMFORT_COMPILER_VERSION <= 406 && CXXOMFORT_CXX_EMULATION==2011 )
    // GCC already has defined these in 4.4-4.6 c++0x mode
#else
    using ::cxxomfort::algorithm::all_of;
    using ::cxxomfort::algorithm::any_of;
    using ::cxxomfort::algorithm::none_of;
#endif

}
#endif // c++11
#endif // no-using
#endif

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

92
93
94
95
96
97
98

99
100
101
102
103
104
105
106
107
108
109
110

111
    return prev_permutation(ini, fin, less);
}

} // cxxomfort::algo
} // cxxomfort

// These were added in c++11

#if (CXXOMFORT_CXX_STD < 2011)
namespace std {
// [next,prev]_permutation already present in GCC >= 4.4 as an extension
#if (CXXOMFORT_COMPILER_ID == CXXO_VALUE_COMPILER_GCC && CXXOMFORT_COMPILER_VERSION < 404)
    using ::cxxomfort::algorithm::is_permutation;
    using ::cxxomfort::algorithm::prev_permutation;
    using ::cxxomfort::algorithm::next_permutation;
#endif

}
#endif // c++11


#endif







>











<
>

92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

111
112
    return prev_permutation(ini, fin, less);
}

} // cxxomfort::algo
} // cxxomfort

// These were added in c++11
#if (!defined(CXXOMFORT_NO_STD_USING))
#if (CXXOMFORT_CXX_STD < 2011)
namespace std {
// [next,prev]_permutation already present in GCC >= 4.4 as an extension
#if (CXXOMFORT_COMPILER_ID == CXXO_VALUE_COMPILER_GCC && CXXOMFORT_COMPILER_VERSION < 404)
    using ::cxxomfort::algorithm::is_permutation;
    using ::cxxomfort::algorithm::prev_permutation;
    using ::cxxomfort::algorithm::next_permutation;
#endif

}
#endif // c++11

#endif // std using
#endif

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

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

#include <cxxomfort/base.hpp>
#include <type_traits>
#include "../algorithms.hpp"
// <algorithm> should have been included already

namespace cxxomfort {

//
// explicit sized ranges for equal, from C++14
//





|







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

#include <cxxomfort/base.hpp>
#include <type_traits>
#include "../algorithm.hpp"
// <algorithm> should have been included already

namespace cxxomfort {

//
// explicit sized ranges for equal, from C++14
//

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

87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

102
103
104
105
106
107
108

/**
 * @}
 */

} // cxxomfort::


namespace std {
    using cxxomfort::integer_sequence;
    using cxxomfort::index_sequence;
    using cxxomfort::make_integer_sequence;
    using cxxomfort::make_index_sequence;

} // namespace std


#endif // c++11

#endif // support
#endif









|







>







87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

/**
 * @}
 */

} // cxxomfort::

#if (!defined(CXXOMFORT_NO_STD_USING))
namespace std {
    using cxxomfort::integer_sequence;
    using cxxomfort::index_sequence;
    using cxxomfort::make_integer_sequence;
    using cxxomfort::make_index_sequence;

} // namespace std
#endif // std using

#endif // c++11

#endif // support
#endif


Deleted cxxomfort/cxxomfort/impl/14-tuple_apply.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
#ifndef CXXOMFORT_IMPL_TUPLEAPPLY_HPP
#define CXXOMFORT_IMPL_TUPLEAPPLY_HPP
/*
 * Support for applying a tuple as arguments to a function
 * (C++14 proposals n3829 and n3915)
 * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3829.pdf
 * 
 * Interfaces defined in this header:
 * 
 * * std::apply (function_type, tuple<...>)
 * 
 */

#if (defined(CXXOMFORT_NOTICES))
    #if (CXXOMFORT_NOTICES > 1)
    #pragma message CXXO_NOTICE("enabled tuple apply(fn,tuple) implementation")
    #endif
#endif

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

namespace cxxomfort {
namespace tuple {


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

#if (CXXOMFORT_CXX_STD >= 2011) || \
    (CXXOMFORT_CXX_EMULATION == 2011 && CXXO_EMULATION_rvref && CXXO_EMULATION_variadic)

// http://stackoverflow.com/questions/687490/how-do-i-expand-a-tuple-into-variadic-template-functions-arguments/12650100#12650100

//
// tuple unpack
// (solution presented in n3658 "Integer Sequences")
//
template<typename F, typename Tuple, size_t... I>
  auto
  apply_(F&& f, Tuple&& args, std::index_sequence<I...>)
  -> decltype(std::forward<F>(f)(std::get<I>(std::forward<Tuple>(args))...))
  {
    return std::forward<F>(f)(std::get<I>(std::forward<Tuple>(args))...);
  }

template<typename F, typename Tuple,
    typename Dec= typename std::decay<Tuple>::type, 
    typename Indices = std::make_index_sequence<std::tuple_size<Dec>::value>>
  auto
  apply(F&& f, Tuple&& args)
  -> decltype(apply_(std::forward<F>(f), std::forward<Tuple>(args), Indices()))
  {
    return apply_(std::forward<F>(f), std::forward<Tuple>(args), Indices());
  }


#else
//implementation for c++03 for up to 10 elements

template <typename Sig> struct FnReturnType { typedef typename Sig::result_type type; };
template <typename R, typename A0> struct FnReturnType<R(A0)> {
    typedef R type;
};
template <typename R, typename A0> struct FnReturnType<R(*)(A0)> {
    typedef R type;
};
template <typename R, typename A0, typename A1> struct FnReturnType<R(A0,A1)> 
: FnReturnType<R(A0)> {};
template <typename R, typename A0, typename A1> struct FnReturnType<R(*)(A0,A1)> 
: FnReturnType<R(A0)> {};

template <typename R, typename A0, typename A1, typename A2> struct FnReturnType<R(A0,A1,A2)> 
: FnReturnType<R(A0)> {};
template <typename R, typename A0, typename A1, typename A2> struct FnReturnType<R(*)(A0,A1,A2)> 
: FnReturnType<R(A0)> {};

template <typename R, typename A0, typename A1, typename A2
    , typename A3> struct FnReturnType<R(A0,A1,A2,A3)> 
: FnReturnType<R(A0)> {};
template <typename R, typename A0, typename A1, typename A2
    , typename A3> struct FnReturnType<R(*)(A0,A1,A2,A3)> 
: FnReturnType<R(A0)> {};

template <typename R, typename A0, typename A1, typename A2
    , typename A3, typename A4> 
struct FnReturnType<R(A0,A1,A2,A3,A4)> 
: FnReturnType<R(A0)> {};
template <typename R, typename A0, typename A1, typename A2
    , typename A3, typename A4> 
struct FnReturnType<R(*)(A0,A1,A2,A3,A4)> 
: FnReturnType<R(A0)> {};

template <typename R, typename A0, typename A1, typename A2
    , typename A3, typename A4, typename A5> 
struct FnReturnType<R(A0,A1,A2,A3,A4,A5)> 
: FnReturnType<R(A0)> {};
template <typename R, typename A0, typename A1, typename A2
    , typename A3, typename A4, typename A5> 
struct FnReturnType<R(*)(A0,A1,A2,A3,A4,A5)> 
: FnReturnType<R(A0)> {};


template <typename R, typename A0, typename A1, typename A2
    , typename A3, typename A4, typename A5> 
struct FnReturnType<R(A0,A1,A2,A3,A4,A5,...)> 
: FnReturnType<R(A0)> {};
template <typename R, typename A0, typename A1, typename A2
    , typename A3, typename A4, typename A5> 
struct FnReturnType<R(*)(A0,A1,A2,A3,A4,A5,...)> 
: FnReturnType<R(A0)> {};



template <typename F, typename Tuple, unsigned int S= std::tuple_size< typename std::remove_cv<Tuple>::type>::value> 
struct call_impl {
};

#define GET_(x) get<x>(t)

template <typename F, typename Tuple> struct call_impl<F, Tuple,1> {
    static void call (F& f, Tuple& t) {
        using std::get;
        f(GET_(0));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,2> {
    template <typename R>
    static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,3> {
    template <typename R> static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,4> {
    template <typename R> static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2), GET_(3));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,5> {
    template <typename R>
    static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2), GET_(3), GET_(4));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,6> {
    template <typename R>
    static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2), GET_(3), GET_(4), GET_(5));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,7> {
    template <typename R>
    static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2), GET_(3), GET_(4), GET_(5), GET_(6));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,8> {
    template <typename R>
    static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2), GET_(3), GET_(4), GET_(5), GET_(6), GET_(7));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,9> {
    template <typename R>
    static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2), GET_(3), GET_(4), GET_(5), GET_(6), GET_(7), GET_(8));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,10> {
    template <typename R>
    static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2), GET_(3), GET_(4), GET_(5), GET_(6), GET_(7), GET_(8), GET_(9));
    }
};

#undef GET_

template <typename F, typename Tuple>
typename FnReturnType<F>::type
apply (F f, Tuple& t) {
    //typedef typename FnReturnType< typename std::remove_pointer<F>::type >::type ret_type;
    typedef typename FnReturnType<F>::type R;
    //std::cerr<< "[call (Tuple const&) [return_type= "<< cxxomfort::typeid_demangle(typeid(ret_type))<< "] ]"<< std::endl;
    //std::cerr<< "[call (Tuple const&) [Tuple="<< cxxomfort::typeid_demangle(typeid(Tuple))<< "] ]"<< std::endl;
    return call_impl<F,Tuple>::template call<R>( f, t );
}

template <typename F, typename Tuple>
typename FnReturnType<F>::type
apply (F f, Tuple const& t) {
    typedef typename FnReturnType<F>::type R;
    return call_impl<F,Tuple const>::template call<R>( f, t );
}



#endif

//
// tuple_visit
// (apply a function to all members of a tuple)
//

#if 0
template <typename F, typename Tuple, int I= 0, int S = std::tuple_size< typename std::remove_const<Tuple>::type >::value>
struct tuple_apply_t {
    static_assert (cxxomfort::is_tuple<Tuple>::value, "tuple_apply: passed type must be a tuple<...>");
    public:
    //typedef typename F::result_type result_type;
    tuple_apply_t (F& f, Tuple& t) : _f(f), _tuple(t) {
        using std::get;
        _f (get<I>(_tuple));
        tuple_apply_t<F,Tuple,I+1,S>(_f,_tuple);
    }

    private:
    F& _f;
    Tuple& _tuple;
    tuple_apply_t& operator= (tuple_apply_t const&);
};

template <typename F, typename Tuple, int S>
struct tuple_apply_t<F,Tuple,S,S> {
    public:
    //typedef typename F::result_type result_type;
    tuple_apply_t (F const&, Tuple const&) {
        // intentionally empty
    }

    private:
    tuple_apply_t& operator= (tuple_apply_t const&);
};

//! apply function @p f  to all members of tuple @p t .
template <typename F, typename Tuple> inline 
Tuple& apply (F f, Tuple& t) {
    tuple_apply_t<F,Tuple>(f,t);
    return t;
}
#endif




} //detail_tuple::
}

namespace std {
    using cxxomfort::tuple::apply;
}



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
















































































































































































































































































































































































































































































































































































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

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46


//#define CXXO_TI_STRI0(x) #x
//#define CXXO_TI_STRI(x) CXXO_TI_STRI0(x)

namespace cxxomfort {
namespace tuple {

namespace detail {

/*
 * Check if an element of type T is already in Tuple, 
 * if so, returns its index
 */
template <typename C, int N, int M, typename Tuple>
struct tuple_element2index_helper {
    enum { rec = (0 <= N && N < M) };
    typedef typename std::enable_if<rec, bool>::type still_has_arguments_t;
    enum { value = 
    (std::is_same<C, typename std::tuple_element<N,Tuple>::type>::value







<




|







27
28
29
30
31
32
33

34
35
36
37
38
39
40
41
42
43
44
45


//#define CXXO_TI_STRI0(x) #x
//#define CXXO_TI_STRI(x) CXXO_TI_STRI0(x)

namespace cxxomfort {
namespace tuple {

namespace detail {

/*
 * Check if an element of type T is already in Tuple, 
 * if so, returns its index (0...N-1)
 */
template <typename C, int N, int M, typename Tuple>
struct tuple_element2index_helper {
    enum { rec = (0 <= N && N < M) };
    typedef typename std::enable_if<rec, bool>::type still_has_arguments_t;
    enum { value = 
    (std::is_same<C, typename std::tuple_element<N,Tuple>::type>::value

Added cxxomfort/cxxomfort/impl/17-byte.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
#ifndef CXXOMFORT_IMPL_CSTDDEF_BYTE_HPP
#define CXXOMFORT_IMPL_CSTDDEF_BYTE_HPP

/**
 * 
 * 
 * byte accepts the follosing operations:
 * 
 * * to_byte (Integral) -> byte
 * * to_integral<Integral>(byte) -> Integral
 * byte == byte and all other comparisons
 * byte &= , |= , ^=  byte
 * byte <<= integer, byte >>= integer
 * byte |, &, ^ byte
 * byte << integer, byte >> integer
 * 
 * byte byte(char) <-- explicit
 * 
 */

#if (CXXOMFORT_CXX_STD < 2017)
    #define CXXOMFORT_USING_stdbyte
#endif

// -----

#if (defined(CXXOMFORT_USING_stdbyte))

#include "../library/typesafe_enum.hpp"

namespace cxxomfort {
namespace stdbyte {
    
struct mybyte_def { /* typedef unsigned char type; */ enum type {}; };
typedef typesafe_enum<mybyte_def,unsigned char> byteimpl;
// quick and easy encapsulation

struct byte: private byteimpl  {
    byte (byte const& b) : byteimpl((byteimpl const&)b) {}
    explicit byte (unsigned char c) : byteimpl( from_underlying<byteimpl>(c) ) {}
/*
    byte (unsigned char c) : byteimpl(c) {}
    byte (signed char c) : byteimpl(static_cast<unsigned char>(c)) {}
    byte (char c) : byteimpl(static_cast<unsigned char>(c)) {}
*/
    using byteimpl::byteimpl;
    using byteimpl::underlying;
    using byteimpl::operator=;
    using byteimpl::equals;

/*
    byte& operator= (byte const& b) CXXO_NOEXCEPT {
        (unsigned char&)(*this)= b.underlying();
        return *this;
    }

*/

    byte& operator&= (byte const& b) CXXO_NOEXCEPT {
        (unsigned char&)(*this)&= b.underlying();
        return *this;
    }

    byte& operator|= (byte const& b) CXXO_NOEXCEPT {
        (unsigned char&)(*this)|= b.underlying();
        return *this;
    }

    byte& operator^= (byte const& b) CXXO_NOEXCEPT {
        (unsigned char&)(*this)^= b.underlying();
        return *this;
    }
    
    byte& operator<<= (size_t x) CXXO_NOEXCEPT {
        (unsigned char&)(*this)<<= x;
        return *this;
    }
    
    byte& operator>>= (size_t x) CXXO_NOEXCEPT {
        (unsigned char&)(*this)>>= x;
        return *this;
    }

    friend bool operator== (byte, byte) CXXO_NOEXCEPT;

    template <typename T>
    friend T to_integer (byte) CXXO_NOEXCEPT;

    private:
    typedef byteimpl this_base;
};


byte operator& (byte b1, byte b2) CXXO_NOEXCEPT {
    return byte (b1&= b2);
}

byte operator| (byte b1, byte b2) CXXO_NOEXCEPT {
    return byte (b1|= b2);
}

byte operator^ (byte b1, byte b2) CXXO_NOEXCEPT {
    return byte (b1^= b2);
}

inline bool operator== (byte b1, byte b2) CXXO_NOEXCEPT {
    return b1.underlying()==b2.underlying();
}

inline bool operator!= (byte const& b1, byte const& b2) CXXO_NOEXCEPT {
    return !(b1==b2);
}


template <typename TI CXXOMFORT_CXX11_CODE(=int,) >
TI to_integer (byte b) CXXO_NOEXCEPT {
    static_assert (std::is_integral<TI>::value, "is_integral");
    return static_cast<TI>(b.underlying());
}

template <typename TI> 
byte to_byte (TI i) {
    static_assert (std::is_integral<TI>::value, "is_integral");
    return byte( static_cast<unsigned char>(i) );
}

template <typename Stream>
Stream& operator<< (Stream& os, byte const& b) CXXO_NOEXCEPT {
    os<< to_integer<unsigned char>(b);
    return os;
}


// stdbyte
}
// cxxomfort
}

#if (!defined(CXXOMFORT_NO_STD_USING))
namespace std {
    using namespace cxxomfort::stdbyte;
}
#endif

#endif // stdbyte

#endif

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

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

























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
#ifndef CXXOMFORT_IMPL_MAKE_FROM_TUPLE_HPP
#define CXXOMFORT_IMPL_MAKE_FROM_TUPLE_HPP
/*
 * 
 */

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

namespace cxxomfort {
namespace tuple {

// 
// make_from_tuple
//
#if (CXXOMFORT_CXX_STD >= 2014)
namespace detail {
template <class T, class Tuple, std::size_t... I>
constexpr T make_from_tuple_impl( Tuple&& t, std::index_sequence<I...> )
{
  return T(std::get<I>(std::forward<Tuple>(t))...);
}
} // namespace detail
 
template <class T, class Tuple>
constexpr T make_from_tuple( Tuple&& t )
{
    return detail::make_from_tuple_impl<T>(std::forward<Tuple>(t),
        std::make_index_sequence<std::tuple_size_v<std::remove_reference_t<Tuple>>>{});
}
#else 

namespace detail {
template <typename R> struct maker_from_tuple_t {
    template <typename T0>
    R operator() (std::tuple<T0> const& tt) const {
        using std::get;
        return R( get<0>(tt) );
    }

    template <typename T0, typename T1>
    R operator() (std::tuple<T0,T1> const& tt) const {
        using std::get;
        return R( get<0>(tt), get<1>(tt) );
    }

    template <typename T0, typename T1, typename T2>
    R operator() (std::tuple<T0,T1,T2> const& tt) const {
        using std::get;
        return R( get<0>(tt), get<1>(tt), get<2>(tt) );
    }

    template <typename T0, typename T1, typename T2, typename T3>
    R operator() (std::tuple<T0,T1,T2,T3> const& tt) const {
        using std::get;
        return R( get<0>(tt), get<1>(tt), get<2>(tt), get<3>(tt) );
    }

    template <typename T0, typename T1, typename T2, typename T3, typename T4>
    R operator() (std::tuple<T0,T1,T2,T3,T4> const& tt) const {
        using std::get;
        return R( get<0>(tt), get<1>(tt), get<2>(tt), get<3>(tt), get<4>(tt) );
    }
    
};
    

}

template <typename T, typename Tuple>
T make_from_tuple (Tuple const& t) {
    detail::maker_from_tuple_t<T> M;
    return M(t);
}

#endif

} // tuple
} // cxxomfort

#if (CXXOMFORT_CXX_STD < 2017)
#if (!defined(CXXOMFORT_NO_STD_USING))
namespace std {
    using cxxomfort::tuple::make_from_tuple;
}
#endif
#endif



#endif

Added cxxomfort/cxxomfort/impl/17-tuple_apply.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
#ifndef CXXOMFORT_IMPL_TUPLEAPPLY_HPP
#define CXXOMFORT_IMPL_TUPLEAPPLY_HPP
/*
 * Support for applying a tuple as arguments to a function
 * (C++14 proposals n3829 and n3915)
 * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3829.pdf
 * 
 * Interfaces defined in this header:
 * 
 * * std::apply (function_type, tuple<...>)
 * 
 */

#if (defined(CXXOMFORT_NOTICES))
    #if (CXXOMFORT_NOTICES > 1)
    #pragma message CXXO_NOTICE("enabled tuple apply(fn,tuple) implementation")
    #endif
#endif

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

namespace cxxomfort {
namespace tuple {

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

#if (CXXOMFORT_CXX_STD >= 2011) || \
    (CXXOMFORT_CXX_EMULATION == 2011 && CXXO_EMULATION_rvref && CXXO_EMULATION_variadic)

// http://stackoverflow.com/questions/687490/how-do-i-expand-a-tuple-into-variadic-template-functions-arguments/12650100#12650100

//
// tuple unpack
// (solution presented in n3658 "Integer Sequences")
//
template<typename F, typename Tuple, size_t... I>
  auto
  apply_(F&& f, Tuple&& args, std::index_sequence<I...>)
  -> decltype(std::forward<F>(f)(std::get<I>(std::forward<Tuple>(args))...))
  {
    return std::forward<F>(f)(std::get<I>(std::forward<Tuple>(args))...);
  }

template<typename F, typename Tuple,
    typename Dec= typename std::decay<Tuple>::type, 
    typename Indices = std::make_index_sequence<std::tuple_size<Dec>::value>>
  auto
  apply(F&& f, Tuple&& args)
  -> decltype(apply_(std::forward<F>(f), std::forward<Tuple>(args), Indices()))
  {
    return apply_(std::forward<F>(f), std::forward<Tuple>(args), Indices());
  }


#else
//implementation for c++03 for up to 10 elements

template <typename Sig> struct FnReturnType { typedef typename Sig::result_type type; };
template <typename R, typename A0> struct FnReturnType<R(A0)> {
    typedef R type;
};
template <typename R, typename A0> struct FnReturnType<R(*)(A0)> {
    typedef R type;
};
template <typename R, typename A0, typename A1> struct FnReturnType<R(A0,A1)> 
: FnReturnType<R(A0)> {};
template <typename R, typename A0, typename A1> struct FnReturnType<R(*)(A0,A1)> 
: FnReturnType<R(A0)> {};

template <typename R, typename A0, typename A1, typename A2> struct FnReturnType<R(A0,A1,A2)> 
: FnReturnType<R(A0)> {};
template <typename R, typename A0, typename A1, typename A2> struct FnReturnType<R(*)(A0,A1,A2)> 
: FnReturnType<R(A0)> {};

template <typename R, typename A0, typename A1, typename A2
    , typename A3> struct FnReturnType<R(A0,A1,A2,A3)> 
: FnReturnType<R(A0)> {};
template <typename R, typename A0, typename A1, typename A2
    , typename A3> struct FnReturnType<R(*)(A0,A1,A2,A3)> 
: FnReturnType<R(A0)> {};

template <typename R, typename A0, typename A1, typename A2
    , typename A3, typename A4> 
struct FnReturnType<R(A0,A1,A2,A3,A4)> 
: FnReturnType<R(A0)> {};
template <typename R, typename A0, typename A1, typename A2
    , typename A3, typename A4> 
struct FnReturnType<R(*)(A0,A1,A2,A3,A4)> 
: FnReturnType<R(A0)> {};

template <typename R, typename A0, typename A1, typename A2
    , typename A3, typename A4, typename A5> 
struct FnReturnType<R(A0,A1,A2,A3,A4,A5)> 
: FnReturnType<R(A0)> {};
template <typename R, typename A0, typename A1, typename A2
    , typename A3, typename A4, typename A5> 
struct FnReturnType<R(*)(A0,A1,A2,A3,A4,A5)> 
: FnReturnType<R(A0)> {};


template <typename R, typename A0, typename A1, typename A2
    , typename A3, typename A4, typename A5> 
struct FnReturnType<R(A0,A1,A2,A3,A4,A5,...)> 
: FnReturnType<R(A0)> {};
template <typename R, typename A0, typename A1, typename A2
    , typename A3, typename A4, typename A5> 
struct FnReturnType<R(*)(A0,A1,A2,A3,A4,A5,...)> 
: FnReturnType<R(A0)> {};



template <typename F, typename Tuple, unsigned int S= std::tuple_size< typename std::remove_cv<Tuple>::type>::value> 
struct call_impl {
};

#define GET_(x) get<x>(t)

template <typename F, typename Tuple> struct call_impl<F, Tuple,1> {
    static void call (F& f, Tuple& t) {
        using std::get;
        f(GET_(0));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,2> {
    template <typename R>
    static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,3> {
    template <typename R> static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,4> {
    template <typename R> static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2), GET_(3));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,5> {
    template <typename R>
    static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2), GET_(3), GET_(4));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,6> {
    template <typename R>
    static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2), GET_(3), GET_(4), GET_(5));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,7> {
    template <typename R>
    static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2), GET_(3), GET_(4), GET_(5), GET_(6));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,8> {
    template <typename R>
    static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2), GET_(3), GET_(4), GET_(5), GET_(6), GET_(7));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,9> {
    template <typename R>
    static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2), GET_(3), GET_(4), GET_(5), GET_(6), GET_(7), GET_(8));
    }
};

template <typename F, typename Tuple> struct call_impl<F,Tuple,10> {
    template <typename R>
    static R call (F& f, Tuple& t) {
        using std::get;
        return f(GET_(0), GET_(1), GET_(2), GET_(3), GET_(4), GET_(5), GET_(6), GET_(7), GET_(8), GET_(9));
    }
};

#undef GET_

template <typename F, typename Tuple>
typename FnReturnType<F>::type
apply (F f, Tuple& t) {
    //typedef typename FnReturnType< typename std::remove_pointer<F>::type >::type ret_type;
    typedef typename FnReturnType<F>::type R;
    //std::cerr<< "[call (Tuple const&) [return_type= "<< cxxomfort::typeid_demangle(typeid(ret_type))<< "] ]"<< std::endl;
    //std::cerr<< "[call (Tuple const&) [Tuple="<< cxxomfort::typeid_demangle(typeid(Tuple))<< "] ]"<< std::endl;
    return call_impl<F,Tuple>::template call<R>( f, t );
}

template <typename F, typename Tuple>
typename FnReturnType<F>::type
apply (F f, Tuple const& t) {
    typedef typename FnReturnType<F>::type R;
    return call_impl<F,Tuple const>::template call<R>( f, t );
}



#endif

//
// tuple_visit
// (apply a function to all members of a tuple)
//

#if 0
template <typename F, typename Tuple, int I= 0, int S = std::tuple_size< typename std::remove_const<Tuple>::type >::value>
struct tuple_apply_t {
    static_assert (cxxomfort::is_tuple<Tuple>::value, "tuple_apply: passed type must be a tuple<...>");
    public:
    //typedef typename F::result_type result_type;
    tuple_apply_t (F& f, Tuple& t) : _f(f), _tuple(t) {
        using std::get;
        _f (get<I>(_tuple));
        tuple_apply_t<F,Tuple,I+1,S>(_f,_tuple);
    }

    private:
    F& _f;
    Tuple& _tuple;
    tuple_apply_t& operator= (tuple_apply_t const&);
};

template <typename F, typename Tuple, int S>
struct tuple_apply_t<F,Tuple,S,S> {
    public:
    //typedef typename F::result_type result_type;
    tuple_apply_t (F const&, Tuple const&) {
        // intentionally empty
    }

    private:
    tuple_apply_t& operator= (tuple_apply_t const&);
};

//! apply function @p f  to all members of tuple @p t .
template <typename F, typename Tuple> inline 
Tuple& apply (F f, Tuple& t) {
    tuple_apply_t<F,Tuple>(f,t);
    return t;
}
#endif




} //detail_tuple::
}

namespace std {
    using cxxomfort::tuple::apply;
}



#endif

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

112
113
114
115
116
117
118

119
120
121
122
123
124
125
126

127
128
129
130
131
132
133
...
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
template <typename I>
forward_list<T,A>::forward_list (I ini, I fin, A const& a)
: alloc(a), _p_bb(nullptr), _p_last(nullptr) {
    if (ini==fin) return;
    this->in_uninitialized_copy(ini,fin);    
}


// move constructor
template <typename T, typename A>
forward_list<T,A>::forward_list (CXXO_RV_REF(forward_list) p) 
: alloc (std::move(p.alloc)), _p_bb(p._p_bb), _p_last(p._p_last) {
    // relink the list's nodes to this _head
    p._p_last.next = 0;
    p._p_bb= 0;
}


template <typename T, typename A>
forward_list<T,A>::~forward_list () {
    this->clear();
    _p_last=0;
}

................................................................................
    this->in_link_after(p, n);
    return iterator(n);
}

#endif

#else


template <typename T, typename A>
template <typename... Args>
typename forward_list<T,A>::iterator forward_list<T,A>::emplace_after (const_iterator pos, Args&&... a) {
    node_t *p = pos.N;
    //assert (p != &_head && "list::insert_after can not use _head node");
    nodeT_t *n= std::allocator_traits<node_alloc_t>::allocate(alloc,1) /*new nodeT_t(t)*/;
    ::new (&n->value) T(std::forward<Args>(a)...);
    this->in_link_after(p, n);
    return iterator(n);
}

template <typename T, typename A>
template <typename... Args>
typename forward_list<T,A>::iterator forward_list<T,A>::emplace_back (Args&&... a) {
    nodeT_t *n= std::allocator_traits<node_alloc_t>::allocate(alloc,1) /*new nodeT_t(t)*/;
    ::new (&n->value) T(std::forward<Args>(a)...);
    this->in_link_after(_end, n);
    return iterator(n);
}

template <typename T, typename A>
template <typename... Args>
typename forward_list<T,A>::iterator forward_list<T,A>::emplace_front (Args&&... a) {
    nodeT_t *n= std::allocator_traits<node_alloc_t>::allocate(alloc,1) /*new nodeT_t(t)*/;
    ::new (&n->value) T(std::forward<Args>(a)...);
    this->in_link_after(0, n);
    return iterator(n);
}



#endif

//
// erase_after
//








>








>







 







>
>





|








|








|




>
>







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
...
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
template <typename I>
forward_list<T,A>::forward_list (I ini, I fin, A const& a)
: alloc(a), _p_bb(nullptr), _p_last(nullptr) {
    if (ini==fin) return;
    this->in_uninitialized_copy(ini,fin);    
}

/*
// move constructor
template <typename T, typename A>
forward_list<T,A>::forward_list (CXXO_RV_REF(forward_list) p) 
: alloc (std::move(p.alloc)), _p_bb(p._p_bb), _p_last(p._p_last) {
    // relink the list's nodes to this _head
    p._p_last.next = 0;
    p._p_bb= 0;
}
*/

template <typename T, typename A>
forward_list<T,A>::~forward_list () {
    this->clear();
    _p_last=0;
}

................................................................................
    this->in_link_after(p, n);
    return iterator(n);
}

#endif

#else

/*
template <typename T, typename A>
template <typename... Args>
typename forward_list<T,A>::iterator forward_list<T,A>::emplace_after (const_iterator pos, Args&&... a) {
    node_t *p = pos.N;
    //assert (p != &_head && "list::insert_after can not use _head node");
    nodeT_t *n= std::allocator_traits<node_alloc_t>::allocate(alloc,1) //new nodeT_t(t) 
    ::new (&n->value) T(std::forward<Args>(a)...);
    this->in_link_after(p, n);
    return iterator(n);
}

template <typename T, typename A>
template <typename... Args>
typename forward_list<T,A>::iterator forward_list<T,A>::emplace_back (Args&&... a) {
    nodeT_t *n= std::allocator_traits<node_alloc_t>::allocate(alloc,1) // new nodeT_t(t)
    ::new (&n->value) T(std::forward<Args>(a)...);
    this->in_link_after(_end, n);
    return iterator(n);
}

template <typename T, typename A>
template <typename... Args>
typename forward_list<T,A>::iterator forward_list<T,A>::emplace_front (Args&&... a) {
    nodeT_t *n= std::allocator_traits<node_alloc_t>::allocate(alloc,1) //new nodeT_t(t);
    ::new (&n->value) T(std::forward<Args>(a)...);
    this->in_link_after(0, n);
    return iterator(n);
}

*/

#endif

//
// erase_after
//

Changes to cxxomfort/cxxomfort/impl/n3668_exchange.hpp.

43
44
45
46
47
48
49

50
51
52
53

54
55
56
57
58
    T oval = std::move(obj);
    obj= std::forward<T>(nval);
    return oval;
}

} //cxxomfort::


namespace std {
    //! @ingroup utility
    using ::cxxomfort::exchange;
} // std::


#endif


#endif







>




>





43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
    T oval = std::move(obj);
    obj= std::forward<T>(nval);
    return oval;
}

} //cxxomfort::

#if (!defined(CXXOMFORT_NO_STD_USING))
namespace std {
    //! @ingroup utility
    using ::cxxomfort::exchange;
} // std::
#endif // std using

#endif


#endif

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

83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
...
279
280
281
282
283
284
285
























286
287
288
289
290
291
292
...
308
309
310
311
312
313
314







315
316
317
// 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, 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> 
................................................................................

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

























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

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








} // string
} // cxxomfort







|







 







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







 







>
>
>
>
>
>
>



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
...
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
...
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
// 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> 
................................................................................

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

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

Added cxxomfort/cxxomfort/impl/tuple_call.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
#ifndef CXXOMFORT_IMPL_tuple_visit_HPP
#define CXXOMFORT_IMPL_tuple_visit_HPP
/*
 * Support for tuple_visit / tuple_foreach
 */

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

namespace cxxomfort {
namespace tuple {

/*
 * returns 1 + the index of the first element of tt
 * for which p(get<>...) returns true
 */
template <typename P, typename Tuple>
int tuple_if (P p, Tuple const& tt) {
    return 0;
}

namespace detail {

template <typename F, typename Tuple, int I= 0, int S = std::tuple_size< typename std::remove_const<Tuple>::type >::value>
struct tuple_visit_each_t {
    public:
    //typedef typename F::result_type result_type;
    tuple_visit_each_t (F& f, Tuple& t) : _f(f), _tuple(t) {
        using std::get;
        _f (get<I>(_tuple));
        tuple_visit_each_t<F,Tuple,I+1,S>(_f,_tuple);
    }

    private:
    F& _f;
    Tuple& _tuple;
    tuple_visit_each_t& operator= (tuple_visit_each_t const&);
};

template <typename F, typename Tuple, int S>
struct tuple_visit_each_t<F,Tuple,S,S> {
    public:
    //typedef typename F::result_type result_type;
    tuple_visit_each_t (F const&, Tuple const&) {
        // intentionally empty
    }

    private:
    tuple_visit_each_t& operator= (tuple_visit_each_t const&);
};

} // detail

/*
 * Call function f for each member of tuple tt
 * Could also be called foreach_tuple
 */

template <typename F, typename Tuple> inline 
Tuple& tuple_visit (F f, Tuple& t) {
    detail::tuple_visit_each_t<F,Tuple>(f,t);
    return t;
}

template <typename F, typename Tuple> inline 
Tuple tuple_visit (F f, Tuple t) {
    detail::tuple_visit_each_t<F,Tuple>(f,t);
    return t;
}


} // namespace tuple
} // namespace cxxomfort


#endif // CXXOMFORT_EXTRAS_LOCALFN_HPP



Changes to cxxomfort/cxxomfort/library.hpp.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 * Implementations included from here:
 * 
 * * CXXO_FOREACH
 * * i12n
 * * fixed_vector
 * * pair03
 * * type_name
 * * <sequences.hpp>
 * 
 */

#include <cxxomfort/utility.hpp>

// extra algorithm variants (find_last_if, count_while, etc)
#include "library/algorithmfn.hpp"







<







9
10
11
12
13
14
15

16
17
18
19
20
21
22
 * Implementations included from here:
 * 
 * * CXXO_FOREACH
 * * i12n
 * * fixed_vector
 * * pair03
 * * type_name

 * 
 */

#include <cxxomfort/utility.hpp>

// extra algorithm variants (find_last_if, count_while, etc)
#include "library/algorithmfn.hpp"

Changes to cxxomfort/cxxomfort/library/algorithmfn.hpp.

72
73
74
75
76
77
78
79




80

















81
82
83
84
85
inline OIterator transform_n (IIterator ini, Integer n, OIterator dest, TF tf) {
    for (Integer i(0); i < n; ++i) { *dest= tf(*ini); }
    return dest;
}


/**
 * count_frequencies




 * */


















} // .algorithm::
}

#endif







|
>
>
>
>

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





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
inline OIterator transform_n (IIterator ini, Integer n, OIterator dest, TF tf) {
    for (Integer i(0); i < n; ++i) { *dest= tf(*ini); }
    return dest;
}


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



} // .algorithm::
}

#endif

Added cxxomfort/cxxomfort/library/functionalfn.hpp.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef CXXOMFORT_CXXO_FUNCTIONALFN_HPP
#define CXXOMFORT_CXXO_FUNCTIONALFN_HPP
#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
#include <functional>
#include <iterator>

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

namespace cxxomfort {
namespace functional {


} // .functional:
}

#endif

Changes to cxxomfort/cxxomfort/library/iteratorfn.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
#include <functional>
//#include <type_traits>

namespace cxxomfort {
namespace iterator {

/**
 * constant_iterator
 * iterates over nothing, it just stays "pointing" to the same place
 */
template <typename T>
struct constant_iterator {
    typedef std::reference_wrapper<T const> V;
    typedef std::bidirectional_iterator_tag iterator_category;
    typedef T value_type;
    typedef size_t difference_type;
    typedef T* pointer;
    typedef T& reference;
    
    // "end" state
    constant_iterator () CXXO_NOEXCEPT : v(), b(false) {}
    explicit constant_iterator CXXO_NOEXCEPT (T const& t): v(t), b(true) {}
    T const& operator* () const {
        return v.get();
    }
    
    constant_iterator& operator++() CXXO_NOEXCEPT { return *this; }
    constant_iterator operator++(int) CXXO_NOEXCEPT { return *this; }

    constant_iterator& operator--() CXXO_NOEXCEPT { return *this; }
    constant_iterator operator--(int) CXXO_NOEXCEPT { return *this; }

    friend bool operator== (constant_iterator const& c1, constant_iterator const& c2) CXXO_NOEXCEPT {
        return (c1.b==false and c2.b==false) or (c1.b==true and c2.b==true and c1.v==c2.v);
    }

    friend bool operator!= (constant_iterator const& c1, constant_iterator const& c2) CXXO_NOEXCEPT {
        return !(c1==c2);
    }

    private:
    V const v;
    bool b;
};







|



|








|
|




|
|

|
|

|



|







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
#include <functional>
//#include <type_traits>

namespace cxxomfort {
namespace iterator {

/**
 * fake_iterator
 * iterates over nothing, it just stays "pointing" to the same place
 */
template <typename T>
struct fake_iterator {
    typedef std::reference_wrapper<T const> V;
    typedef std::bidirectional_iterator_tag iterator_category;
    typedef T value_type;
    typedef size_t difference_type;
    typedef T* pointer;
    typedef T& reference;
    
    // "end" state
    fake_iterator () CXXO_NOEXCEPT : v(), b(false) {}
    explicit fake_iterator (T const& t) CXXO_NOEXCEPT : v(t), b(true) {}
    T const& operator* () const {
        return v.get();
    }
    
    fake_iterator& operator++() CXXO_NOEXCEPT { return *this; }
    fake_iterator operator++(int) CXXO_NOEXCEPT { return *this; }

    fake_iterator& operator--() CXXO_NOEXCEPT { return *this; }
    fake_iterator operator--(int) CXXO_NOEXCEPT { return *this; }

    friend bool operator== (fake_iterator const& c1, fake_iterator const& c2) CXXO_NOEXCEPT {
        return (c1.b==false and c2.b==false) or (c1.b==true and c2.b==true and c1.v==c2.v);
    }

    friend bool operator!= (fake_iterator const& c1, fake_iterator const& c2) CXXO_NOEXCEPT {
        return !(c1==c2);
    }

    private:
    V const v;
    bool b;
};

Changes to cxxomfort/cxxomfort/library/stringfn.hpp.

21
22
23
24
25
26
27



28
29
30
31
32
33
34
 * 
 */

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




namespace cxxomfort {
namespace string {

/**
 * Joins all contents from [ini,fin) into a string.
 * @ingroup independent-features







>
>
>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 * 
 */

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

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


namespace cxxomfort {
namespace string {

/**
 * Joins all contents from [ini,fin) into a string.
 * @ingroup independent-features

Changes to cxxomfort/cxxomfort/library/tuplefn.hpp.

4
5
6
7
8
9
10



11
12
13
14
15
16
17
18
19
20
21
22
23


24
25
26
27
28
29
30
..
65
66
67
68
69
70
71









































































72
73























































74
75






76
77
78
79
80
81
82
...
110
111
112
113
114
115
116






117
118
119
120






121
122
123
124
125
126
127
...
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
 * @file library/tuplefn.hpp
 * @brief cxxomfort's tuple-related functions
 * @ingroup independent-features
 *
 * Interfaces defined:
 * 
 * * is_tuple



 * * tuple_shift
 * * tuple_pop
 */

#include <tuple>
#include "../impl/14-integer_sequence.hpp"

namespace cxxomfort {
namespace tuple {


//
// is_tuple -- for specializations of calls based on tuples in C++03


//

//! @addtogroup independent-features
template <typename T> struct is_tuple: traits::false_type {};

#if (CXXOMFORT_CXX_STD >= 2011) || \
 (CXXOMFORT_COMPILER_ID == CXXO_VALUE_COMPILER_GCC && CXXOMFORT_CXX_EMULATION == 2011)
................................................................................

// if compiler supports variadics, we can extend this
#if (CXXO_EMULATION_variadic==1)
template <typename T0, typename T1, typename T2, typename T3, typename T4
        , typename T5, typename T6, typename T7, typename T8, typename T9, typename... TArgs> 
struct is_tuple <std::tr1::tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,TArgs...> >
: traits::true_type {};









































































#endif
























































#endif








/*
 * tuple_pop: removes the last type from a tuple
 */
#if (0 && CXXOMFORT_CXX_STD >= 2011)

//! Pops (discards) the rightmost type in a tuple.
................................................................................
}
template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
std::tuple<A0,A1,A2,A3,A4> 
tuple_pop (std::tuple<A0,A1,A2,A3,A4,A5> const& t) {
    using std::get;
    return std::make_tuple( get<0>(t), get<1>(t), get<2>(t), get<3>(t), get<4>(t) );
}







// c++03 impl
#endif







/*
 * tuple_shift: removes the first type from a tuple
 */

#if (0 && CXXOMFORT_CXX_STD >= 2011)

//! Shifts a tuple one type to the left, discarding the leftmost type.
................................................................................
    return std::make_tuple( get<1>(t), get<2>(t) );
}
template <typename A0, typename A1, typename A2, typename A3>
std::tuple<A1,A2,A3> tuple_shift (std::tuple<A0,A1,A2,A3> const& t) {
    using std::get;
    return std::make_tuple( get<1>(t), get<2>(t), get<3>(t) );
}











#endif





//
// tuple_call (f, Tuple)
// calls f for each member of Tuple
//
#if (CXXOMFORT_CXX_STD >= 2011)
template <typename F, typename Tuple, typename std::enable_if< cxxomfort::tuple::is_tuple<Tuple>::value, F>::type>
F
#else
template <typename F, typename Tuple>
typename std::enable_if< cxxomfort::tuple::is_tuple<Tuple>::value, F>::type // F
#endif
tuple_call (F& f, Tuple& t) {
    return f;
}

}
} // cxxomfort::

#endif







>
>
>

|





<
<
<
<


>
>







 







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


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


>
>
>
>
>
>







 







>
>
>
>
>
>




>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>



>
>






|
<
|
<
<
<

<
<
<
<
<
<
<
<
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20




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








 * @file library/tuplefn.hpp
 * @brief cxxomfort's tuple-related functions
 * @ingroup independent-features
 *
 * Interfaces defined:
 * 
 * * is_tuple
 * * tuple2function_t
 * * function2tuple_t
 * * tuple_pop
 * * tuple_shift
 * * tuple_foreach
 */

#include <tuple>
#include "../impl/14-integer_sequence.hpp"





//
// is_tuple -- for specializations of calls based on tuples in C++03
namespace cxxomfort {
namespace tuple {
//

//! @addtogroup independent-features
template <typename T> struct is_tuple: traits::false_type {};

#if (CXXOMFORT_CXX_STD >= 2011) || \
 (CXXOMFORT_COMPILER_ID == CXXO_VALUE_COMPILER_GCC && CXXOMFORT_CXX_EMULATION == 2011)
................................................................................

// if compiler supports variadics, we can extend this
#if (CXXO_EMULATION_variadic==1)
template <typename T0, typename T1, typename T2, typename T3, typename T4
        , typename T5, typename T6, typename T7, typename T8, typename T9, typename... TArgs> 
struct is_tuple <std::tr1::tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,TArgs...> >
: traits::true_type {};
#endif // variadic

#endif // c++ standard

}
} // cxxomfort


namespace cxxomfort {
namespace tuple {

/*
 * @brief Convert from tuple type to function signature.
 * 
 * Given a tuple of the form T<T1,T2,...>,
 * obtain a function signature R(T1,T2,...) 
 */

template <typename Ret, typename Tuple> struct tuple2function_t {};

#if (CXXOMFORT_CXX_STD >= 2011)
template <typename R, typename... Args>
struct tuple2function_t< R, std::tuple<Args...> > {
    typedef R(type)(Args...);
};

#else // c++03

template <typename R, typename T0> struct tuple2function_t< R,std::tuple<T0> > {
    typedef R(type)(T0);
};

template <typename R, typename T0, typename T1> struct tuple2function_t< R,std::tuple<T0,T1> > {
    typedef R(type)(T0,T1);
};
template <typename R, typename T0, typename T1, typename T2> 
struct tuple2function_t< R,std::tuple<T0,T1,T2> > {
    typedef R(type)(T0,T1,T2);
};
template <typename R, typename T0, typename T1, typename T2, typename T3> 
struct tuple2function_t< R,std::tuple<T0,T1,T2,T3> > { typedef R(type)(T0,T1,T2,T3); 
};
template <typename R, typename T0, typename T1, typename T2, typename T3, typename T4> 
struct tuple2function_t< R,std::tuple<T0,T1,T2,T3,T4> > { typedef R(type)(T0,T1,T2,T3,T4); 
};
template <typename R, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5> 
struct tuple2function_t< R,std::tuple<T0,T1,T2,T3,T4,T5> > { typedef R(type)(T0,T1,T2,T3,T4,T5); 
};
template <typename R, 
    typename T0, typename T1, typename T2, typename T3, typename T4, 
    typename T5, typename T6> 
struct tuple2function_t< R,std::tuple<T0,T1,T2,T3,T4,T5,T6> > { 
    typedef R(type)(T0,T1,T2,T3,T4,T5,T6); 
};
template <typename R, 
    typename T0, typename T1, typename T2, typename T3, typename T4, 
    typename T5, typename T6, typename T7> 
struct tuple2function_t< R,std::tuple<T0,T1,T2,T3,T4,T5,T6,T7> > { 
    typedef R(type)(T0,T1,T2,T3,T4,T5,T6,T7); 
};
template <typename R, 
    typename T0, typename T1, typename T2, typename T3, typename T4, 
    typename T5, typename T6, typename T7, typename T8> 
struct tuple2function_t< R,std::tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8> > { 
    typedef R(type)(T0,T1,T2,T3,T4,T5,T6,T7,T8); 
};
template <typename R, 
    typename T0, typename T1, typename T2, typename T3, typename T4, 
    typename T5, typename T6, typename T7, typename T8, typename T9> 
struct tuple2function_t< R,std::tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> > { 
    typedef R(type)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9); 
};

#endif

}
} // cxxomfort


namespace cxxomfort {
namespace tuple {

/**
 * @brief Convert from function signature type to tuple type.
 * 
 * Given a function signature R(T1,T2,...), 
 * obtain a tuple of the form T<T1,T2,...>
 */
template <typename FnSig> struct function2tuple_t {};

#if (CXXOMFORT_CXX_STD >= 2011) 

    template <typename... Args, typename R>
    struct function2tuple_t<R(Args...)> {
        typedef std::tuple<Args...> type;
    };

#else // c++03

    template <typename T0, typename R>
    struct function2tuple_t<R(T0)> {
        typedef std::tuple<T0> type;
    };
    template <typename T0, typename T1, typename R>
    struct function2tuple_t<R(T0,T1)> {
        typedef std::tuple<T0,T1> type;
    };
    template <typename T0, typename T1, typename T2, typename R>
    struct function2tuple_t<R(T0,T1,T2)> {
        typedef std::tuple<T0,T1,T2> type;
    };
    template <typename T0, typename T1, typename T2, typename T3, typename R>
    struct function2tuple_t<R(T0,T1,T2,T3)> {
        typedef std::tuple<T0,T1,T2,T3> type;
    };
    template <typename T0, typename T1, typename T2, typename T3, typename T4, typename R>
    struct function2tuple_t<R(T0,T1,T2,T3,T4)> {
        typedef std::tuple<T0,T1,T2,T3,T4> type;
    };
    template <typename T0, typename T1, typename T2, typename T3, typename T4, 
        typename T5, typename R>
    struct function2tuple_t<R(T0,T1,T2,T3,T4,T5)> {
        typedef std::tuple<T0,T1,T2,T3,T4,T5> type;
    };
    template <typename T0, typename T1, typename T2, typename T3, typename T4, 
        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

}
} // cxxomfort


namespace cxxomfort {
namespace tuple {

/*
 * tuple_pop: removes the last type from a tuple
 */
#if (0 && CXXOMFORT_CXX_STD >= 2011)

//! Pops (discards) the rightmost type in a tuple.
................................................................................
}
template <typename A0, typename A1, typename A2, typename A3, typename A4, typename A5>
std::tuple<A0,A1,A2,A3,A4> 
tuple_pop (std::tuple<A0,A1,A2,A3,A4,A5> const& t) {
    using std::get;
    return std::make_tuple( get<0>(t), 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, typename A6>
std::tuple<A0,A1,A2,A3,A4,A5> 
tuple_pop (std::tuple<A0,A1,A2,A3,A4,A5,A6> const& t) {
    using std::get;
    return std::make_tuple( get<0>(t), get<1>(t), get<2>(t), get<3>(t), get<4>(t), get<5>(t) );
}

// c++03 impl
#endif

}
} // cxxomfort

namespace cxxomfort {
namespace tuple {

/*
 * tuple_shift: removes the first type from a tuple
 */

#if (0 && CXXOMFORT_CXX_STD >= 2011)

//! Shifts a tuple one type to the left, discarding the leftmost type.
................................................................................
    return std::make_tuple( get<1>(t), get<2>(t) );
}
template <typename A0, typename A1, typename A2, typename A3>
std::tuple<A1,A2,A3> tuple_shift (std::tuple<A0,A1,A2,A3> const& t) {
    using std::get;
    return std::make_tuple( get<1>(t), get<2>(t), get<3>(t) );
}
template <typename A0, typename A1, typename A2, typename A3, typename A4>
std::tuple<A1,A2,A3,A4> tuple_shift (std::tuple<A0,A1,A2,A3,A4> const& t) {
    using std::get;
    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)
// calls f for each member of Tuple
//
#include "../impl/tuple_call.hpp"





#endif








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

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


15
16
17
18

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

39
40

41
42
43
44




45

46
47
48




49

50

51
52
53
54
55
56
57

58
59
60




61













62
63
64
65
66
67
68
/**
 @file cxxomfort/library/safeenum.hpp
 @author Luis Machuca Bezzaza
 @see http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Type_Safe_Enum
 @see http://stackoverflow.com/questions/217549/which-typesafe-enum-in-c-are-you-using/11856721#11856721
**/
#include <cxxomfort/base.hpp>
//#include <type_traits>

/*
 * Usage is as follows:
 */


#if 0 // example
struct myenum_def { enum type { member1, member2, member3 }; };
typedef safe_enum<myenum_def> myenum;
// quick and easy encapsulation

#endif

/* Section: declaration of safe_enum */

namespace cxxomfort {

namespace detail_enum {
struct safe_enum_tag {};
} // detail_enum


template<typename def, typename inner = typename def::type>
class typesafe_enum : public def /*, public detail_enum::safe_enum_tag*/ {
    inner val;
    public: 
    typedef typename def::type enum_type;
    typedef inner underlying_type;
 
    public:
    CXXO_CONSTEXPR typesafe_enum () CXXO_NOEXCEPT {}

    CXXO_CONSTEXPR typesafe_enum(underlying_type v) : val(v) {}
    CXXO_CONSTEXPR inner underlying() const CXXO_NOEXCEPT { return val; }

    CXXO_EXPLICIT_OPERATOR(underlying_type)() const CXXO_NOEXCEPT { return val; }

    friend bool operator == (typesafe_enum const& L, typesafe_enum const& R) CXXO_NOEXCEPT { 
        return R.val == L.val; 




    }

    
    private:
    struct disallowed_enum_conversion {};




    

    public:

    template <typename E>
    typesafe_enum (E e
    , typename std::enable_if<std::is_enum<E>::value && !std::is_same<E,enum_type>::value
    , disallowed_enum_conversion>::type* = nullptr) {
        enum { is_different_enum= std::is_enum<E>::value && !std::is_same<E,enum_type>::value };
        static_assert( is_different_enum==false, "typesafe_enum can not construct from different enum types");
    }


};




















/*
#if 0 && !defined( CXXOMFORT_CXX11_MODE )
// Global begin
template <typename def, typename inner> 
safe_enum<def,inner> begin (safe_enum<def,inner>) {
    typedef safe_enum<def,inner> Enum;







|




>
>
|

|

>












|







>
|
|
>


<
<
>
>
>
>
|
>



>
>
>
>

>

>







>



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







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
/**
 @file cxxomfort/library/safeenum.hpp
 @author Luis Machuca Bezzaza
 @see http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Type_Safe_Enum
 @see http://stackoverflow.com/questions/217549/which-typesafe-enum-in-c-are-you-using/11856721#11856721
**/
#include <cxxomfort/base.hpp>
#include <type_traits>

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

// example
struct myenum_def { enum type { member1, member2, member3 }; };
typedef typesafe_enum<myenum_def> myenum;
// quick and easy encapsulation

#endif

/* Section: declaration of safe_enum */

namespace cxxomfort {

namespace detail_enum {
struct safe_enum_tag {};
} // detail_enum


template<typename def, typename inner = typename def::type>
class typesafe_enum : public def , public detail_enum::safe_enum_tag {
    inner val;
    public: 
    typedef typename def::type enum_type;
    typedef inner underlying_type;
 
    public:
    CXXO_CONSTEXPR typesafe_enum () CXXO_NOEXCEPT {}
    CXXO_CONSTEXPR typesafe_enum (typename def::type v) : val(v) {}
    CXXO_CONSTEXPR explicit typesafe_enum (underlying_type v) : val(v) {}
    CXXO_CONSTEXPR enum_type value() const CXXO_NOEXCEPT { return val; }
    CXXO_CONSTEXPR underlying_type underlying() const CXXO_NOEXCEPT { return val; }
    CXXO_EXPLICIT_OPERATOR(underlying_type)() const CXXO_NOEXCEPT { return val; }



    /*{
        enum { T_is_compatible_type = std::is_same<T, enum_type>::value };
        static_assert (T_is_compatible_type, "typesafe_enum construction invalid - not the enum's tags or the underlying type");
    };*/

    bool equals (typesafe_enum const& x) const CXXO_NOEXCEPT { return val == x.val; }
    
    private:
    struct disallowed_enum_conversion {};
    // we disallow other constructors
    template <typename T> 
    typesafe_enum (T const&, struct disallowed_enum_conversion* = nullptr
    , typename std::enable_if< std::is_integral<T>::value >::type * = nullptr);
    

    public:
/*
    template <typename E>
    typesafe_enum (E e
    , typename std::enable_if<std::is_enum<E>::value && !std::is_same<E,enum_type>::value
    , disallowed_enum_conversion>::type* = nullptr) {
        enum { is_different_enum= std::is_enum<E>::value && !std::is_same<E,enum_type>::value };
        static_assert( is_different_enum==false, "typesafe_enum can not construct from different enum types");
    }
*/

};

// equality
template<typename def, typename inner>
inline bool operator== (typesafe_enum<def,inner> const& e1, typesafe_enum<def,inner> const& e2) {
    return e1.equals(e2);
}

// inequality (uses friend version of equality)
template<typename def, typename inner>
inline bool operator!= (typesafe_enum<def,inner> const& e1, typesafe_enum<def,inner> const& e2) {
    return !(e1==e2);
}

// construct typesafe_enum from the underlying type (useful for "to-byte"-style helpers)
// usage: TSE e = from_underlying<TSE>(u)
template <typename TSE>
TSE from_underlying ( typename TSE::underlying_type c ) {
    return static_cast<typename TSE::enum_type>(c);
}

/*
#if 0 && !defined( CXXOMFORT_CXX11_MODE )
// Global begin
template <typename def, typename inner> 
safe_enum<def,inner> begin (safe_enum<def,inner>) {
    typedef safe_enum<def,inner> Enum;

Changes to cxxomfort/cxxomfort/random.hpp.

20
21
22
23
24
25
26























27
28
29
#pragma message CXXO_NOTICE("enabled <random> support.")
#endif

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

























#endif







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



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
#pragma message CXXO_NOTICE("enabled <random> support.")
#endif

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

namespace cxxomfort {

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

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

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

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


}


#endif

Changes to cxxomfort/cxxomfort/string.hpp.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 */

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

#include "impl/11-to_string.hpp"
#include "impl/to_basic_string_variadic.hpp"
// #include "impl/string.hpp" // custom string functions

/**
 * @}
 */

#endif







<







16
17
18
19
20
21
22

23
24
25
26
27
28
29
 */

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

#include "impl/11-to_string.hpp"

// #include "impl/string.hpp" // custom string functions

/**
 * @}
 */

#endif

Changes to cxxomfort/cxxomfort/tuple.hpp.

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

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


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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
...
346
347
348
349
350
351
352
353
354
355
356
357
 * @file cxxomfort/tuple.hpp
 * @brief Implementations for <tuple> in C++
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 *
 * Interfaces defined in this header:
 *
 * * cxxomfort::is_tuple
 * * tuple2function_t
 * * function2tuple_t
 * * tuple2array
 * * get<T> for std::tuple
 * * cxxomfort::apply(tuple,function)

 *
 */

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

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



/*
 * Given a tuple T<T1,T2,...>, obtain the function signature R(T1,T2,...)
 */


/**
 * @brief Convert from tuple type to function signature.
 * 
 * Given a tuple of the form T<T1,T2,...>,
 * obtain a function signature R(T1,T2,...) 
 */

namespace cxxomfort {

    template <typename Ret, typename Tuple> struct tuple2function_t {};



#if (CXXOMFORT_CXX_STD >= 2011)
    template <typename R, typename... Args>
    struct tuple2function_t< R, std::tuple<Args...> > {
        typedef R(type)(Args...);
    };

#else // c++03

    template <typename R, typename T0> struct tuple2function_t< R,std::tuple<T0> > {
        typedef R(type)(T0);
    };

    template <typename R, typename T0, typename T1> struct tuple2function_t< R,std::tuple<T0,T1> > {
        typedef R(type)(T0,T1);
    };
    template <typename R, typename T0, typename T1, typename T2> 
    struct tuple2function_t< R,std::tuple<T0,T1,T2> > {
        typedef R(type)(T0,T1,T2);
    };
    template <typename R, typename T0, typename T1, typename T2, typename T3> 
    struct tuple2function_t< R,std::tuple<T0,T1,T2,T3> > { typedef R(type)(T0,T1,T2,T3); 
    };
    template <typename R, typename T0, typename T1, typename T2, typename T3, typename T4> 
    struct tuple2function_t< R,std::tuple<T0,T1,T2,T3,T4> > { typedef R(type)(T0,T1,T2,T3,T4); 
    };
    template <typename R, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5> 
    struct tuple2function_t< R,std::tuple<T0,T1,T2,T3,T4,T5> > { typedef R(type)(T0,T1,T2,T3,T4,T5); 
    };
    template <typename R, 
        typename T0, typename T1, typename T2, typename T3, typename T4, 
        typename T5, typename T6> 
    struct tuple2function_t< R,std::tuple<T0,T1,T2,T3,T4,T5,T6> > { 
        typedef R(type)(T0,T1,T2,T3,T4,T5,T6); 
    };
    template <typename R, 
        typename T0, typename T1, typename T2, typename T3, typename T4, 
        typename T5, typename T6, typename T7> 
    struct tuple2function_t< R,std::tuple<T0,T1,T2,T3,T4,T5,T6,T7> > { 
        typedef R(type)(T0,T1,T2,T3,T4,T5,T6,T7); 
    };
    template <typename R, 
        typename T0, typename T1, typename T2, typename T3, typename T4, 
        typename T5, typename T6, typename T7, typename T8> 
    struct tuple2function_t< R,std::tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8> > { 
        typedef R(type)(T0,T1,T2,T3,T4,T5,T6,T7,T8); 
    };
    template <typename R, 
        typename T0, typename T1, typename T2, typename T3, typename T4, 
        typename T5, typename T6, typename T7, typename T8, typename T9> 
    struct tuple2function_t< R,std::tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> > { 
        typedef R(type)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9); 
    };

#endif

} // cxxomfort::


/**
 * @brief Convert from function signature type to tuple type.
 * 
 * Given a function signature R(T1,T2,...), 
 * obtain a tuple of the form T<T1,T2,...>
 */

namespace cxxomfort {

    template <typename FnSig> struct function2tuple_t {};

#if (CXXOMFORT_CXX_STD >= 2011) 

    template <typename... Args, typename R>
    struct function2tuple_t<R(Args...)> {
        typedef std::tuple<Args...> type;
    };

#else // c++03

    template <typename T0, typename R>
    struct function2tuple_t<R(T0)> {
        typedef std::tuple<T0> type;
    };
    template <typename T0, typename T1, typename R>
    struct function2tuple_t<R(T0,T1)> {
        typedef std::tuple<T0,T1> type;
    };
    template <typename T0, typename T1, typename T2, typename R>
    struct function2tuple_t<R(T0,T1,T2)> {
        typedef std::tuple<T0,T1,T2> type;
    };
    template <typename T0, typename T1, typename T2, typename T3, typename R>
    struct function2tuple_t<R(T0,T1,T2,T3)> {
        typedef std::tuple<T0,T1,T2,T3> type;
    };
    template <typename T0, typename T1, typename T2, typename T3, typename T4, typename R>
    struct function2tuple_t<R(T0,T1,T2,T3,T4)> {
        typedef std::tuple<T0,T1,T2,T3,T4> type;
    };
    template <typename T0, typename T1, typename T2, typename T3, typename T4, 
        typename T5, typename R>
    struct function2tuple_t<R(T0,T1,T2,T3,T4,T5)> {
        typedef std::tuple<T0,T1,T2,T3,T4,T5> type;
    };
    template <typename T0, typename T1, typename T2, typename T3, typename T4, 
        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


} // cxxomfort::

//
// tuple to array
//

namespace cxxomfort {
namespace tuple {

template <typename Tuple>
struct _tuple2array_cnv_t {
    // Tuple is a tuple
................................................................................
    return _array2tuple_cnv_t< std::array<T,N> >(a);
}

} //cxxomfort::tuple
} //


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

#endif








<
<

|
<
>













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







 







<
<



4
5
6
7
8
9
10


11
12

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






































































































































30
31
32
33
34
35
36
...
212
213
214
215
216
217
218


219
220
221
 * @file cxxomfort/tuple.hpp
 * @brief Implementations for <tuple> in C++
 * @author Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl>
 *
 * Interfaces defined in this header:
 *
 * * cxxomfort::is_tuple


 * * tuple2array
 * * get<T> for std::tuple (c++14)

 * * apply(function,tuple) (c++17)
 *
 */

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

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

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







































































































































namespace cxxomfort {
namespace tuple {

template <typename Tuple>
struct _tuple2array_cnv_t {
    // Tuple is a tuple
................................................................................
    return _array2tuple_cnv_t< std::array<T,N> >(a);
}

} //cxxomfort::tuple
} //





#endif

Changes to cxxomfort/cxxomfort/utility.hpp.

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <type_traits>

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


namespace cxxomfort {
/**
 * @addtogroup utility 
 * @{
 */


/**
 * @}
 */
}

namespace cxxomfort {
    //! @ingroup utility
    //! @ingroup cxx03-backports
    template <typename T> typename cxxomfort::traits::add_reference<T>::type declval();
}

#if (CXXOMFORT_CXX_STD < 2011)







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







26
27
28
29
30
31
32












33
34
35
36
37
38
39
#include <type_traits>

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














namespace cxxomfort {
    //! @ingroup utility
    //! @ingroup cxx03-backports
    template <typename T> typename cxxomfort::traits::add_reference<T>::type declval();
}

#if (CXXOMFORT_CXX_STD < 2011)