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

Overview
Comment:Commit 2019-08-14 - Myriad memory and mangling maintenance minuscule fixes.
  • cxxomfort: output_info now takes a FILE* stream.
  • cxxomfort: Fixed month detection in CXXOMFORT_ISODATE().
  • cxxomfort: Fixed wrong usage of explicit_cast when in GCC "C++0x" mode.
  • cxxomfort: Fixed "do-nothing" move emulation in pre-C++03.
  • cxxomfort: Minimum improvements to move emulation in CXX_STD<1997 (enhances: [b8ea55b791]).
  • config: Added detection for _Pragma in some compilers.
  • config: Fixed missing nullptr_t (not nullptr) in Clang 2.8-3.2 for C++11 mode (enhances: [1cbdc0b48d]).
  • memory: Fixed namespace std for make_unique (C++14).
  • memory: Added default_delete to backports (previously internal) (C++11).
  • memory: Added fix:to_bool now also works with shared_ptr.
  • memory: Added fix:malloc_deleter component.
  • memory: destroy and uninitialized_default families moved to their own PR header.
  • random: Added fix:randmo for rand() bias (randmo()).
  • string_view: Made pointers in constructors const.
  • string_view: Added fix:make_string_view.
  • typeindex: Fixed inclusion of TR1 headers.
  • type_traits: Added missing reference to is_convertible from TR1.
  • library:type_name: Fixed [e59985dfdf] (stack buffer realloc with __cxa_demangle).
  • library:type_name: Changed implementation to typeid_demangle() so that user needs to include <typeinfo> explicitly.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:17ed6f42147a3168366a86811bf5d99099c02d57b7dd9e3b1693e33f0f67285b
User & Date: luismachuca 2019-08-17 04:28:14
References
2019-08-17
05:05 Fixed ticket [e59985df]: type_name:job allocates on the stack plus 6 other changes artifact: ad7a55c1 user: luismachuca
Context
2019-08-17
04:29
Commit 2019-08-14 - Myriad memory and mangling maintenance minuscule fixes.
  • cxxomfort: output_info now takes a FILE* stream.
  • cxxomfort: Fixed month detection in CXXOMFORT_ISODATE().
  • cxxomfort: Fixed wrong usage of explicit_cast when in GCC "C++0x" mode.
  • cxxomfort: Fixed "do-nothing" move emulation in pre-C++03.
  • cxxomfort: Minimum improvements to move emulation in CXX_STD<1997 (enhances: [b8ea55b791]).
  • config: Added detection for _Pragma in some compilers.
  • config: Fixed missing nullptr_t (not nullptr) in Clang 2.8-3.2 for C++11 mode (enhances: [1cbdc0b48d]).
  • memory: Fixed namespace std for make_unique (C++14).
  • memory: Added default_delete to backports (previously internal) (C++11).
  • memory: Added fix:to_bool now also works with shared_ptr.
  • memory: Added fix:malloc_deleter component.
  • memory: destroy and uninitialized_default families moved to their own PR header.
  • random: Added fix:randmo for rand() bias (randmo()).
  • string_view: Made pointers in constructors const.
  • string_view: Added fix:make_string_view.
  • typeindex: Fixed inclusion of TR1 headers.
  • type_traits: Added missing reference to is_convertible from TR1.
  • library:type_name: Fixed [e59985dfdf] (stack buffer realloc with __cxa_demangle).
  • library:type_name: Changed implementation to typeid_demangle() so that user needs to include <typeinfo> explicitly.
check-in: 7df32629 user: luismachuca tags: trunk
04:28
Commit 2019-08-14 - Myriad memory and mangling maintenance minuscule fixes.
  • cxxomfort: output_info now takes a FILE* stream.
  • cxxomfort: Fixed month detection in CXXOMFORT_ISODATE().
  • cxxomfort: Fixed wrong usage of explicit_cast when in GCC "C++0x" mode.
  • cxxomfort: Fixed "do-nothing" move emulation in pre-C++03.
  • cxxomfort: Minimum improvements to move emulation in CXX_STD<1997 (enhances: [b8ea55b791]).
  • config: Added detection for _Pragma in some compilers.
  • config: Fixed missing nullptr_t (not nullptr) in Clang 2.8-3.2 for C++11 mode (enhances: [1cbdc0b48d]).
  • memory: Fixed namespace std for make_unique (C++14).
  • memory: Added default_delete to backports (previously internal) (C++11).
  • memory: Added fix:to_bool now also works with shared_ptr.
  • memory: Added fix:malloc_deleter component.
  • memory: destroy and uninitialized_default families moved to their own PR header.
  • random: Added fix:randmo for rand() bias (randmo()).
  • string_view: Made pointers in constructors const.
  • string_view: Added fix:make_string_view.
  • typeindex: Fixed inclusion of TR1 headers.
  • type_traits: Added missing reference to is_convertible from TR1.
  • library:type_name: Fixed [e59985dfdf] (stack buffer realloc with __cxa_demangle).
  • library:type_name: Changed implementation to typeid_demangle() so that user needs to include <typeinfo> explicitly.
check-in: 17ed6f42 user: luismachuca tags: trunk
2019-02-20
13:34
Commit 2019-02-20 - Minor documentation updates.
  • cxxomfort: Updated /doc/trunk/cxxomfort/LICENSE.txt.
  • cxxomfort: Deprecated some extras/ headers.
  • cxxomfort: Removed the extras/ headers for array_ref, foreach, forward_list and optional.
check-in: 65b214ce user: luismachuca tags: trunk, y2019
Changes

Changes to cxxomfort/cxxomfort/array.hpp.

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

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


#if (CXXOMFORT_CXX_STD<1997 || CXXO_COMPILER_SUPPORT_tr1_array==0)
#include "impl/03-array.hpp"

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

#elif (CXXOMFORT_CXX_STD < 2011)







|







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

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


#if (CXXOMFORT_CXX_STD<1997 && CXXO_COMPILER_SUPPORT_tr1_array==0)
#include "impl/03-array.hpp"

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

#elif (CXXOMFORT_CXX_STD < 2011)

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

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
..
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
    typedef T& type;
};

template <typename A, typename B> struct detail_is_same { enum { value = false }; };
template <typename A> struct detail_is_same<A,A> { enum { value = true }; };


#if (CXXOMFORT_CXX_STD< 2011)
template <typename T>
struct explicit_cast {
    T value;
    
    //explicit_cast (T t) throw() 
    //: value (std::move(t)) {}

................................................................................
    explicit_cast () = delete;
    explicit_cast& operator= (explicit_cast const&) = delete;
};

	#endif
#endif

}
} // cxxomfort::



#if (CXXOMFORT_CXX_STD<2011)

    #define CXXO_EXPLICIT_OPERATOR(T) operator ::cxxomfort::detail::explicit_cast<T> 
using ::cxxomfort::detail::explicit_cast;

#else

    #define explicit_cast static_cast







|







 







<
|



|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
..
96
97
98
99
100
101
102

103
104
105
106
107
108
109
110
111
112
113
114
    typedef T& type;
};

template <typename A, typename B> struct detail_is_same { enum { value = false }; };
template <typename A> struct detail_is_same<A,A> { enum { value = true }; };


#if (CXXOMFORT_CXX_STD< 2011 && CXXO_COMPILER_SUPPORT_explicit_operator==0)
template <typename T>
struct explicit_cast {
    T value;
    
    //explicit_cast (T t) throw() 
    //: value (std::move(t)) {}

................................................................................
    explicit_cast () = delete;
    explicit_cast& operator= (explicit_cast const&) = delete;
};

	#endif
#endif


} } // cxxomfort::detail



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

    #define CXXO_EXPLICIT_OPERATOR(T) operator ::cxxomfort::detail::explicit_cast<T> 
using ::cxxomfort::detail::explicit_cast;

#else

    #define explicit_cast static_cast

Changes to cxxomfort/cxxomfort/base/move-00.hpp.

8
9
10
11
12
13
14

15
16
17
18

19
20
21
22
23
24

25
















26
27

28
29
30
31







32
33

34
35
36




37
38
39
40
41
42
43
44
45
46
47
48
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
//#include "../util/meta.hpp"
#if (CXXOMFORT_CXX_STD >= 2011)
    #error "Library error - this file should only be invoked with c++03"
#endif

namespace cxxomfort{



//
//                            move()
//


template <typename T>
inline T& move (T& t) {
  return x;
}



















//
//                            forward()

//

template <typename T> inline
T const& forward (T const& v) CXXO_NOEXCEPTNOTHROW {







    return v;
}



} //::cxxomfort::






#define CXXO_NONCOPYABLE_MOVABLE(TYPE)\
        private:\
        TYPE(TYPE &);\
        TYPE& operator=(TYPE &);\
        public:\
        operator ::cxxomfort::rv<TYPE>&() \
        {  return *static_cast< ::cxxomfort::rv<TYPE>* >(this);  }\
        operator const ::cxxomfort::rv<TYPE>&() const \
        {  return *static_cast<const ::cxxomfort::rv<TYPE>* >(this);  }\
        private:\


#define CXXO_COPYABLE_MOVABLE(TYPE)\
        public:\
        TYPE& operator=(TYPE &t)\
        {  this->operator=(static_cast<const ::cxxomfort::rv<TYPE> &>(const_cast<const TYPE &>(t))); \
            return *this;\
        }\
        public:\
        operator ::cxxomfort::rv<TYPE>&() \
        {  return *static_cast< ::cxxomfort::rv<TYPE>* >(this);  }\
        operator const ::cxxomfort::rv<TYPE>&() const \
        {  return *static_cast<const ::cxxomfort::rv<TYPE>* >(this);  }\
        private:\

#define CXXO_COPYABLE_MOVABLE_NONASSIGNABLE(TYPE)\
        private:\
        TYPE& operator= (TYPE const&) CXXOMFORT_CXX11_CODE(=delete,);\
        public:\
        operator ::cxxomfort::rv<TYPE>&() \
        {  return *static_cast< ::cxxomfort::rv<TYPE>* >(this);  }\
        operator const ::cxxomfort::rv<TYPE>&() const \
        {  return *static_cast<const ::cxxomfort::rv<TYPE>* >(this);  }\
        private:\


#define CXXO_COPY_ASSIGN_REF(TYPE) const ::cxxomfort::rv< TYPE >&

#define CXXO_RV_REF(TYPE) ::cxxomfort::rv< TYPE >&

#define CXXO_FWD_REF(TYPE) TYPE const&

//
// Helps write a semi-variadic argument list, up to 5 arguments
#define CXXO_VARIADIC_SIGNATURE(name)                                       \
    template <typename Arg1> name ( CXXO_VARFN_ARG0 CXXO_FWD_REF(Arg1) );    \
    template <typename Arg1, typename Arg2>                                  \
    name ( CXXO_VARFN_ARG0 CXXO_FWD_REF(Arg1), CXXO_FWD_REF(Arg2) );         \
    template <typename Arg1, typename Arg2, typename Arg3>                   \
    name ( CXXO_VARFN_ARG0 CXXO_FWD_REF(Arg1), CXXO_FWD_REF(Arg2), CXXO_FWD_REF(Arg3) );      \
    template <typename Arg1, typename Arg2, typename Arg3, typename Arg4>    \
    name ( CXXO_VARFN_ARG0 CXXO_FWD_REF(Arg1), CXXO_FWD_REF(Arg2),           \
     CXXO_FWD_REF(Arg3), CXXO_FWD_REF(Arg4) );             \
    template <typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>     \
    name ( CXXO_VARFN_ARG0 CXXO_FWD_REF(Arg1), CXXO_FWD_REF(Arg2),           \
     CXXO_FWD_REF(Arg3), CXXO_FWD_REF(Arg4), CXXO_FWD_REF(Arg5) );           \


namespace std{
    using ::cxxomfort::move;
    using ::cxxomfort::forward;
}


#endif








>

<
|
<
>

|
|
<
|

>

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

<
>
|

|
<
>
>
>
>
>
>
>
|

>


|
>
>
>
>



<
<
<
<
<
<
<
<
<

<

<
<
<
<
<
<
<
<
<
<
<


<
<
<
<
<
<
<
<

<
|





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




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
//#include "../util/meta.hpp"
#if (CXXOMFORT_CXX_STD >= 2011)
    #error "Library error - this file should only be invoked with c++03"
#endif

namespace cxxomfort{

namespace move_detail {


template <bool If, typename A, typename B>

struct conditional { typedef B type; };

template <typename A, typename B>
struct conditional<true,A,B> { typedef A type; };



struct empty{};

} // move_detail

template <class T>
class rv
: public move_detail::conditional
    < (traits::is_fundamental<T>::value == false)
    , T
    , move_detail::empty
>::type {
    rv();
    ~rv();
    rv(rv const&);
    void operator=(rv const&);
} /*BOOST_MOVE_ATTRIBUTE_MAY_ALIAS*/;


//

// move 
// 

template <typename T>

inline T const& 
move (T const& x) throw() { return x; }

/*
template <class T>
inline rv<T>&
move (rv<T>& x) {
	return x;
}
*/


} // cxxomfort

namespace std {
	using cxxomfort::move;
}


#define CXXO_NONCOPYABLE_MOVABLE(TYPE)\











#define CXXO_COPYABLE_MOVABLE(TYPE)\












#define CXXO_COPYABLE_MOVABLE_NONASSIGNABLE(TYPE)\










#define CXXO_COPY_ASSIGN_REF(TYPE) const TYPE &

#define CXXO_RV_REF(TYPE) ::cxxomfort::rv< TYPE >&

#define CXXO_FWD_REF(TYPE) TYPE const&























#endif

Changes to cxxomfort/cxxomfort/base/move-03.hpp.

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
...
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
//
//                            move()
//

template <typename T>
inline typename
move_detail::enable_if<!has_move_emulation_enabled_aux<T>::value, T&>::type 
move(T& x) {
  return x;
}

template <typename T>
inline typename
move_detail::enable_if<has_move_emulation_enabled<T>::value, rv<T>&>::type 
move(T& x) {
  return *static_cast<rv<T>* >(move_detail::addressof(x));
}

template <class T>
inline typename
move_detail::enable_if<has_move_emulation_enabled<T>::value, rv<T>&>::type 
move(rv<T>& x) {
  return x;
}

//
//                            forward()
//

template <typename T> inline 
................................................................................
        operator ::cxxomfort::rv<TYPE>&() \
        {  return *static_cast< ::cxxomfort::rv<TYPE>* >(this);  }\
        operator const ::cxxomfort::rv<TYPE>&() const \
        {  return *static_cast<const ::cxxomfort::rv<TYPE>* >(this);  }\
        private:\


#define CXXO_COPYABLE_MOVABLE(TYPE)\
        public:\
        TYPE& operator=(TYPE &t)\
        {  this->operator=(static_cast<const ::cxxomfort::rv<TYPE> &>(const_cast<const TYPE &>(t))); \
            return *this;\
        }\
        public:\
        operator ::cxxomfort::rv<TYPE>&() \







|
|





|
|





|
|







 







|







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
...
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
//
//                            move()
//

template <typename T>
inline typename
move_detail::enable_if<!has_move_emulation_enabled_aux<T>::value, T&>::type 
move (T& x) {
	return x;
}

template <typename T>
inline typename
move_detail::enable_if<has_move_emulation_enabled<T>::value, rv<T>&>::type 
move (T& x) {
	return *static_cast<rv<T>* >(move_detail::addressof(x));
}

template <class T>
inline typename
move_detail::enable_if<has_move_emulation_enabled<T>::value, rv<T>&>::type 
move (rv<T>& x) {
	return x;
}

//
//                            forward()
//

template <typename T> inline 
................................................................................
        operator ::cxxomfort::rv<TYPE>&() \
        {  return *static_cast< ::cxxomfort::rv<TYPE>* >(this);  }\
        operator const ::cxxomfort::rv<TYPE>&() const \
        {  return *static_cast<const ::cxxomfort::rv<TYPE>* >(this);  }\
        private:\


#define CXXO_COPYABLE_MOVABLE(TYPE) \
        public:\
        TYPE& operator=(TYPE &t)\
        {  this->operator=(static_cast<const ::cxxomfort::rv<TYPE> &>(const_cast<const TYPE &>(t))); \
            return *this;\
        }\
        public:\
        operator ::cxxomfort::rv<TYPE>&() \

Changes to cxxomfort/cxxomfort/base/move.hpp.

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#endif

#if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 2)
#pragma message CXXO_NOTICE("enabled rvref and movable object emulation.")
#endif

#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_OW,<9999))
    //#include "move-00.hpp" // basically "does-nothing" move
    //#include "move-03.hpp"

#elif !defined (CXXOMFORT_USING_MOVE_EMULATION)
    #include "move-11.hpp"
    // end c++11
#else
    #include "move-03.hpp"
// end c++11 / c++03







|
<







59
60
61
62
63
64
65
66

67
68
69
70
71
72
73
#endif

#if defined(CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 2)
#pragma message CXXO_NOTICE("enabled rvref and movable object emulation.")
#endif

#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_OW,<9999))
    #include "move-00.hpp" // basically "does-nothing" move


#elif !defined (CXXOMFORT_USING_MOVE_EMULATION)
    #include "move-11.hpp"
    // end c++11
#else
    #include "move-03.hpp"
// end c++11 / c++03

Changes to cxxomfort/cxxomfort/base/nullptr.hpp.

15
16
17
18
19
20
21





22
23
24
25
26
27
28

#if (CXXOMFORT_CXX_STD < 2011 && CXXO_COMPILER_SUPPORT_nullptr==0)
    #define CXXOMFORT_USING_nullptr
#endif
#if (defined(CXXOMFORT_USING_nullptr) && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_OW, < 1400))
    #include "../config/ow.hpp" // needs a simpler definition for nullptr
    #undef CXXOMFORT_USING_nullptr





#endif

#if defined (CXXOMFORT_USING_nullptr)
    #if defined (CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 2)
    #pragma message CXXO_NOTICE("enabled 'nullptr' backport.")
    #endif








>
>
>
>
>







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

#if (CXXOMFORT_CXX_STD < 2011 && CXXO_COMPILER_SUPPORT_nullptr==0)
    #define CXXOMFORT_USING_nullptr
#endif
#if (defined(CXXOMFORT_USING_nullptr) && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_OW, < 1400))
    #include "../config/ow.hpp" // needs a simpler definition for nullptr
    #undef CXXOMFORT_USING_nullptr
#endif
#if (0 && !defined(CXXOMFORT_USING_nullptr) && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_CLANG,>=300) && CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_CLANG,<302))
	#if (!defined(_LIBCPP))
		#define CXXOMFORT_USING_nullptr
	#endif
#endif

#if defined (CXXOMFORT_USING_nullptr)
    #if defined (CXXOMFORT_NOTICES) && (CXXOMFORT_NOTICES > 2)
    #pragma message CXXO_NOTICE("enabled 'nullptr' backport.")
    #endif

Changes to cxxomfort/cxxomfort/config.hpp.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
95
96
97
98
99
100
101


102
103
104
105
106
107
108
...
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
...
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
...
445
446
447
448
449
450
451

452
453
454
455
456
457
458
459
460

461
462
463
464
465
466
467
468
469
470
471
472
 * @ingroup cxxomfort-config
 *
 * This file contains configuration macros used by the cxxomfort library
 * and it is not intended to be directly used.
 */

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

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


/*
 * Behaviour macros
................................................................................
 * Detect compilers and apply specific configurations.
 */
#if 0
#elif defined(__clang__)
    #include "./config/clang.hpp"
#elif defined(__GNUC__)
    #include "./config/gcc.hpp"


#elif defined(_MSC_VER)
    #include "./config/msc.hpp"
#elif defined(__DMC__)
    #include "./config/dmc.hpp"
#elif defined(__WATCOMC__)
    #include "./config/ow.hpp"
#else
................................................................................
 * Set up more friendly messages
 */
    #if (CXXOMFORT_NOTICES > 1)

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

        #if 0
................................................................................
 * Namespace that holds the library's own implementations, emulations and supplements.
 * @ingroup cxxo-sup
 * */
namespace library {}

//! Information about the library support
//! @ingroup cxxomfort-config
#if defined(CXXOFLAG_NO_INITIALIZERS)
struct info {
#else
const struct info { 
#endif
    enum {
    //! library version
    version = CXXOMFORT_VERSION , 
    date = CXXOMFORT_DATE, 
    //! compiler identification code
    compilerid = CXXOMFORT_COMPILER_ID ,
    //! compiler version code (usually <code>100*major+minor</code>)
................................................................................
    cxx_std = static_cast<unsigned>(CXXOMFORT_CXX_STD) ,
    //! level of support of C++11 features in C++11 emulation / c++0x mode
    cxx_emulation = static_cast<unsigned>(CXXOMFORT_CXX_EMULATION) , 
    cplusplus = __cplusplus
    };
    
    /* struct */ 

}  
// some old compilers don't grok initializers for empty structs it seems.
#if defined(CXXOFLAG_NO_INITIALIZERS)
_ ;
#else
_ = {};
#endif

template <typename SS> 

static void output_info (SS&) {
    using namespace std;
    printf( "(cxxomfort:%u:%u ", _.date, _.version);
    printf( "compiler:%u:%u:%lu ", _.compilerid, _.compilerversion, static_cast<unsigned long>(_.compilerversionfull) );
    printf( "mode:%u:%u cpp:%lu)\n", _.cxx_std, _.cxx_emulation
    , static_cast<unsigned long>(__cplusplus));
    //return os;
}

// ~::cxxomfort
}








|


|







 







>
>







 







<




|







 







<
|
<
<
<







 







>
|
<
<
<
<
|
<

<
>
|

|
|
|







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
...
133
134
135
136
137
138
139

140
141
142
143
144
145
146
147
148
149
150
151
...
424
425
426
427
428
429
430

431



432
433
434
435
436
437
438
...
442
443
444
445
446
447
448
449
450




451

452

453
454
455
456
457
458
459
460
461
462
463
464
465
 * @ingroup cxxomfort-config
 *
 * This file contains configuration macros used by the cxxomfort library
 * and it is not intended to be directly used.
 */

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

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


/*
 * Behaviour macros
................................................................................
 * Detect compilers and apply specific configurations.
 */
#if 0
#elif defined(__clang__)
    #include "./config/clang.hpp"
#elif defined(__GNUC__)
    #include "./config/gcc.hpp"
#elif defined(__DJGPP__)
	#include "./config/djgpp.hpp"
#elif defined(_MSC_VER)
    #include "./config/msc.hpp"
#elif defined(__DMC__)
    #include "./config/dmc.hpp"
#elif defined(__WATCOMC__)
    #include "./config/ow.hpp"
#else
................................................................................
 * Set up more friendly messages
 */
    #if (CXXOMFORT_NOTICES > 1)

        #if 0
        #elif (CXXOMFORT_CXX_STD >= 2017)
            #pragma message( CXXO_NOTICE("detected C++17 or above mode") );

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

        #if 0
................................................................................
 * Namespace that holds the library's own implementations, emulations and supplements.
 * @ingroup cxxo-sup
 * */
namespace library {}

//! Information about the library support
//! @ingroup cxxomfort-config

struct info { 



    enum {
    //! library version
    version = CXXOMFORT_VERSION , 
    date = CXXOMFORT_DATE, 
    //! compiler identification code
    compilerid = CXXOMFORT_COMPILER_ID ,
    //! compiler version code (usually <code>100*major+minor</code>)
................................................................................
    cxx_std = static_cast<unsigned>(CXXOMFORT_CXX_STD) ,
    //! level of support of C++11 features in C++11 emulation / c++0x mode
    cxx_emulation = static_cast<unsigned>(CXXOMFORT_CXX_EMULATION) , 
    cplusplus = __cplusplus
    };
    
    /* struct */ 
}  ;





const struct info _ = {};



static inline 
void output_info (std::FILE * const ff= stdout) {
    using namespace std;
    fprintf( ff, "(cxxomfort:%u:%u ", _.date, _.version);
    fprintf( ff, "compiler:%u:%u:%lu ", _.compilerid, _.compilerversion, static_cast<unsigned long>(_.compilerversionfull) );
    fprintf( ff, "mode:%u:%u cpp:%lu)\n", _.cxx_std, _.cxx_emulation
    , static_cast<unsigned long>(__cplusplus));
    //return os;
}

// ~::cxxomfort
}

Changes to cxxomfort/cxxomfort/config/_pre.hpp.

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#define CXXOMFORT_ISOMONTH() 0
#define CXXOMFORT_ISODAY() (( __DATE__[4]==' ' ?  0 : __DATE__[4]-'0')*10 + (__DATE__[5]-'0'))
#define CXXOMFORT_ISODATE() \
( \
CXXOMFORT_ISOYEAR() * 10000UL \
+ ( \
 ((__DATE__[0]=='J' ? \
 (__DATE__[1]=='a' ? 1 : 6)\
 :0)) | \
 ((__DATE__[0]=='F' ? 2:0)) | \
 ((__DATE__[0]=='M' ? \
 (__DATE__[2]=='r' ? 3 : 5)\
 :0)) | \
 ((__DATE__[0]=='A' ? \
 (__DATE__[1]=='p' ? 4 : 8)\







|







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#define CXXOMFORT_ISOMONTH() 0
#define CXXOMFORT_ISODAY() (( __DATE__[4]==' ' ?  0 : __DATE__[4]-'0')*10 + (__DATE__[5]-'0'))
#define CXXOMFORT_ISODATE() \
( \
CXXOMFORT_ISOYEAR() * 10000UL \
+ ( \
 ((__DATE__[0]=='J' ? \
 (__DATE__[1]=='a' ? 1 : (__DATE__[2]=='n' ? 6 : 7)   )\
 :0)) | \
 ((__DATE__[0]=='F' ? 2:0)) | \
 ((__DATE__[0]=='M' ? \
 (__DATE__[2]=='r' ? 3 : 5)\
 :0)) | \
 ((__DATE__[0]=='A' ? \
 (__DATE__[1]=='p' ? 4 : 8)\

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

24
25
26
27
28
29
30

31
32
33
34
35
36
37


// 
// per-standard version features
// 

// c++03 or other pre-C++11 stuff


//! If compiler supports a <tt>__alignof</tt> intrinsic.
#define CXXO_COMPILER_SUPPORT___alignof 0 
//! If compiler supports the type-category intrinsics (is_enum, is_class, is_union).
#define CXXO_COMPILER_SUPPORT_type_intrinsics 0 
//! If compiler provides support for <code>\<functional\></code>'s classic binders.
#define CXXO_COMPILER_SUPPORT_functional_oldstyle (CXXOMFORT_CXX_STD<2017)







>







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


// 
// per-standard version features
// 

// c++03 or other pre-C++11 stuff
#define CXXO_COMPILER_SUPPORT__Pragma 0

//! If compiler supports a <tt>__alignof</tt> intrinsic.
#define CXXO_COMPILER_SUPPORT___alignof 0 
//! If compiler supports the type-category intrinsics (is_enum, is_class, is_union).
#define CXXO_COMPILER_SUPPORT_type_intrinsics 0 
//! If compiler provides support for <code>\<functional\></code>'s classic binders.
#define CXXO_COMPILER_SUPPORT_functional_oldstyle (CXXOMFORT_CXX_STD<2017)

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

1
2
3
4
5
6
7














8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
25
26
27
28
29
30
31













32
33
34
35
36
37
38


39
40
41
42
43
44
45
..
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
...
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
















#ifndef CXXOMFORT_CONFIG_CLANG_HPP
#define CXXOMFORT_CONFIG_CLANG_HPP
#ifndef CXXOMFORT_CONFIG_HPP
    #error "This file must not be included directly (see cxxomfort/config.hpp)"
#endif

/*














Here follows a list of C++11 features for Clang:

TODO
 */

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


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

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

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














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



// c++03

#undef  CXXO_COMPILER_SUPPORT_tr1_array
#define CXXO_COMPILER_SUPPORT_tr1_array (CXXOMFORT_CXX_STD < 2011)
#undef  CXXO_COMPILER_SUPPORT_tr1_tuple
#define CXXO_COMPILER_SUPPORT_tr1_tuple (CXXOMFORT_CXX_STD < 2011)
................................................................................
#undef  CXXO_COMPILER_SUPPORT_initializer_list
#define CXXO_COMPILER_SUPPORT_initializer_list __has_extension(cxx_inheriting_constructors)
#undef  CXXO_COMPILER_SUPPORT_local_types
#define CXXO_COMPILER_SUPPORT_local_types __has_extension(cxx_local_type_template_args)
#undef  CXXO_COMPILER_SUPPORT_noexcept
#define CXXO_COMPILER_SUPPORT_noexcept __has_extension(cxx_noexcept)
#undef  CXXO_COMPILER_SUPPORT_nsdmi
#define CXXO_COMPILER_SUPPORT_nsdmi __has_feature(cxx_nonstatic_member_init)
#undef  CXXO_COMPILER_SUPPORT_nullptr
#define CXXO_COMPILER_SUPPORT_nullptr __has_extension(cxx_nullptr)
#undef  CXXO_COMPILER_SUPPORT_rvref
#define CXXO_COMPILER_SUPPORT_rvref (__has_extension(cxx_rvalue_references) * __has_extension(cxx_implicit_moves))
#undef  CXXO_COMPILER_SUPPORT_std_is_trivially
#define CXXO_COMPILER_SUPPORT_std_is_trivially (CXXOMFORT_CXX_STD >= 2011)
#undef  CXXO_COMPILER_SUPPORT_static_assert
#define CXXO_COMPILER_SUPPORT_static_assert __has_extension(cxx_static_assert)
#undef  CXXO_COMPILER_SUPPORT_trailing_returns
#define CXXO_COMPILER_SUPPORT_trailing_returns __has_extension(cxx_trailing_return)
#undef  CXXO_COMPILER_SUPPORT_unique_ptr
#define CXXO_COMPILER_SUPPORT_unique_ptr (CXXOMFORT_CXX_STD >= 2011)
#undef  CXXO_COMPILER_SUPPORT_variadic
#define CXXO_COMPILER_SUPPORT_variadic (__has_extension(cxx_variadic_templates) * __has_extension(cxx_default_function_template_args))
#undef  CXXO_COMPILER_SUPPORT_va_args
#define CXXO_COMPILER_SUPPORT_va_args 1

// c++14

#undef  CXXO_COMPILER_SUPPORT_decltypeauto
#define CXXO_COMPILER_SUPPORT_decltypeauto __has_extension(cxx_decltype_auto)
................................................................................
	#if (CXXO_COMPILER_SUPPORT_cstd_cuchar)
		#undef  CXXO_COMPILER_SUPPORT_cstd_cuchar
		#define CXXO_COMPILER_SUPPORT_cstd_cuchar 0
	#endif
#endif

// treats ::max_align_t differently depending on stdlib or libc++
#if (CXXOMFORT_CXX_STD==2011)
	#if (defined(_LIBCPP))
	#else
	typedef long double max_align_t;
	#endif
#endif

// treats uchar differently depending on stdlib or libc++






#if (CXXOMFORT_COMPILER_VERSION >= 400)
	#undef  CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF
	#define CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF 1
#elif (!defined(_LIBCPP))
	#undef  CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF
	#define CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF 1
#endif

// we can have here both decltype and typeof












#endif























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







|







 







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







>
>







 







|













|







 







|







>
>
>
>
>











>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
..
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
...
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
...
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
#ifndef CXXOMFORT_CONFIG_CLANG_HPP
#define CXXOMFORT_CONFIG_CLANG_HPP
#ifndef CXXOMFORT_CONFIG_HPP
    #error "This file must not be included directly (see cxxomfort/config.hpp)"
#endif

/*
 * Clang version history
 * https://en.wikipedia.org/wiki/LLVM
 * 
 * 6.0  	March 8, 2018
 * 4.0  	March 13, 2017
 * 3.8  	March 8, 2016
 * 3.6.2 	July 16, 2015 
 * 3.4.2 	June 19, 2014
 * 3.2 	December 20, 2012 **preferred**
 * 3.0 	December 1, 2011
 * 2.8 	October 5, 2010
 * 2.6 	October 23, 2009 
 * * 
 * 
Here follows a list of C++11 features for Clang:

TODO
 */

#define CXXOMFORT_COMPILER_ID CXXO_COMPILERID_CLANG
#define CXXOMFORT_COMPILER_VERSION 100*__clang_major__+__clang_minor__
#define CXXOMFORT_COMPILER_VERSION_FULL 1000*__clang_major__+10*__clang_minor__+__clang_patchlevel__


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

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

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

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

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


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

// c++03

#undef  CXXO_COMPILER_SUPPORT_tr1_array
#define CXXO_COMPILER_SUPPORT_tr1_array (CXXOMFORT_CXX_STD < 2011)
#undef  CXXO_COMPILER_SUPPORT_tr1_tuple
#define CXXO_COMPILER_SUPPORT_tr1_tuple (CXXOMFORT_CXX_STD < 2011)
................................................................................
#undef  CXXO_COMPILER_SUPPORT_initializer_list
#define CXXO_COMPILER_SUPPORT_initializer_list __has_extension(cxx_inheriting_constructors)
#undef  CXXO_COMPILER_SUPPORT_local_types
#define CXXO_COMPILER_SUPPORT_local_types __has_extension(cxx_local_type_template_args)
#undef  CXXO_COMPILER_SUPPORT_noexcept
#define CXXO_COMPILER_SUPPORT_noexcept __has_extension(cxx_noexcept)
#undef  CXXO_COMPILER_SUPPORT_nsdmi
#define CXXO_COMPILER_SUPPORT_nsdmi __has_extension(cxx_nonstatic_member_init)
#undef  CXXO_COMPILER_SUPPORT_nullptr
#define CXXO_COMPILER_SUPPORT_nullptr __has_extension(cxx_nullptr)
#undef  CXXO_COMPILER_SUPPORT_rvref
#define CXXO_COMPILER_SUPPORT_rvref (__has_extension(cxx_rvalue_references) * __has_extension(cxx_implicit_moves))
#undef  CXXO_COMPILER_SUPPORT_std_is_trivially
#define CXXO_COMPILER_SUPPORT_std_is_trivially (CXXOMFORT_CXX_STD >= 2011)
#undef  CXXO_COMPILER_SUPPORT_static_assert
#define CXXO_COMPILER_SUPPORT_static_assert __has_extension(cxx_static_assert)
#undef  CXXO_COMPILER_SUPPORT_trailing_returns
#define CXXO_COMPILER_SUPPORT_trailing_returns __has_extension(cxx_trailing_return)
#undef  CXXO_COMPILER_SUPPORT_unique_ptr
#define CXXO_COMPILER_SUPPORT_unique_ptr (CXXOMFORT_CXX_STD >= 2011)
#undef  CXXO_COMPILER_SUPPORT_variadic
#define CXXO_COMPILER_SUPPORT_variadic (__has_extension(cxx_variadic_templates))
#undef  CXXO_COMPILER_SUPPORT_va_args
#define CXXO_COMPILER_SUPPORT_va_args 1

// c++14

#undef  CXXO_COMPILER_SUPPORT_decltypeauto
#define CXXO_COMPILER_SUPPORT_decltypeauto __has_extension(cxx_decltype_auto)
................................................................................
	#if (CXXO_COMPILER_SUPPORT_cstd_cuchar)
		#undef  CXXO_COMPILER_SUPPORT_cstd_cuchar
		#define CXXO_COMPILER_SUPPORT_cstd_cuchar 0
	#endif
#endif

// treats ::max_align_t differently depending on stdlib or libc++
#if (CXXOMFORT_CXX_STD<2011)
	#if (defined(_LIBCPP))
	#else
	typedef long double max_align_t;
	#endif
#endif

// treats uchar differently depending on stdlib or libc++

#if (CXXOMFORT_COMPILER_VERSION >= 306)
	#undef  CXXO_COMPILER_SUPPORT__Pragma
	#define CXXO_COMPILER_SUPPORT__Pragma 1
#endif

#if (CXXOMFORT_COMPILER_VERSION >= 400)
	#undef  CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF
	#define CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF 1
#elif (!defined(_LIBCPP))
	#undef  CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF
	#define CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF 1
#endif

// we can have here both decltype and typeof

/* 
 * BUGFIX: Clang 3.0-3.4 + libstdc++ triggers an error in the GCC 
 * headers that use the name of type_info without declaring it before.
 * https://bugzilla.redhat.com/show_bug.cgi?id=1129899
 * */

#if (CXXOMFORT_COMPILER_VERSION>=300 && CXXOMFORT_COMPILER_VERSION<306)
	#if (CXXOMFORT_CXX_STD==2011 && !defined(_LIBCPP))
namespace std {
	class type_info;
}
	#endif
#endif

// Clang 2.8, 3.0 + libstdc++ wrongly announces support for nullptr_t; 
// it still has nullptr, but not nullptr_t
// example related: https://github.com/catchorg/Catch2/issues/487
#if (CXXOMFORT_COMPILER_VERSION>=208 && CXXOMFORT_COMPILER_VERSION<302)
	#if (CXXOMFORT_CXX_STD==2011 && !defined(_LIBCPP))
namespace std {
	typedef decltype(nullptr) nullptr_t;
	//using ::nullptr_t;
}
	#endif
#endif


#endif

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

1
2
3
4
5
6
7















8
9
10
11
12
13
14
..
56
57
58
59
60
61
62




63
64
65
66
67
68
69
...
102
103
104
105
106
107
108


109
110
111
112
113
114
115
...
241
242
243
244
245
246
247


248
249
250
251
252
253
254
#ifndef CXXOMFORT_CONFIG_HPP
    #error "This file must not be included directly (see cxxomfort/config.hpp)"
#endif
#ifndef CXXOMFORT_CONFIG_GCC_HPP
#define CXXOMFORT_CONFIG_GCC_HPP

/*















Here follows a list of C++11 features for GCC:

 * static_assert - 403
 * decltype - 403
 * variadic templates - 404
 * auto with new semantics - 404
 * char16_t, char32_t - 404
................................................................................
    #undef  CXXO_WARNING
    #define CXXO_WARNING(msg) CXXO_NOTICE_IMPL_( "cxxomfort warning: " msg)
#endif

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





/** GCC old versions define __cplusplus to be 1 but still have 
 * some good C++1997 and C++2003 support.
 * */
#if (CXXOMFORT_COMPILER_VERSION >= 400 && CXXOMFORT_COMPILER_VERSION <= 406 \
&& CXXOMFORT_CXX_STD<10)
	#undef  CXXOMFORT_CXX_STD
................................................................................
#if (CXXOMFORT_CXX_STD >= 1997 && CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011)
	#undef  CXXOFLAG_namespace_tr1 
	#define CXXOFLAG_namespace_tr1 1
#endif

// set up TR1 headers
#if (CXXOFLAG_namespace_tr1>0)


    #undef  CXXO_COMPILER_SUPPORT_tr1_cstdint
    #define CXXO_COMPILER_SUPPORT_tr1_cstdint 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_random
    #define CXXO_COMPILER_SUPPORT_tr1_random 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_type_traits
    #define CXXO_COMPILER_SUPPORT_tr1_type_traits 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_tuple
................................................................................
// via usage of the __cplusplus value
#if (CXXOMFORT_CXX_STD == 2013)
    #define CXXOMFORT_CXX_EMULATION 2014
#endif


#if (CXXOMFORT_COMPILER_VERSION >= 408)


    #if (CXXOMFORT_CXX_STD< 2011) && (CXXOMFORT_CXX_EMULATION==2011)
        #undef  CXXO_COMPILER_SUPPORT_attribute
        #define CXXO_COMPILER_SUPPORT_attribute 1
        #undef  CXXO_COMPILER_SUPPORT_alignment_tools
        #define CXXO_COMPILER_SUPPORT_alignment_tools 1
        #undef  CXXO_COMPILER_SUPPORT_decltype
        #define CXXO_COMPILER_SUPPORT_decltype 2







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







 







>
>
>
>







 







>
>







 







>
>







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
..
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
...
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
...
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
#ifndef CXXOMFORT_CONFIG_HPP
    #error "This file must not be included directly (see cxxomfort/config.hpp)"
#endif
#ifndef CXXOMFORT_CONFIG_GCC_HPP
#define CXXOMFORT_CONFIG_GCC_HPP

/*
 * GCC version history:
 * https://www.gnu.org/software/gcc/releases.html
 * 
 * 4.2 - 2007-07
 * 4.4 - 2009-04
 * 4.6 - 2011-06 **preferred**
 * 4.8 - 2013-03 **preferred**
 * 5.0 - 2015-04
 * 6.0 - 2016-04
 * 5.4 - 2016-06
 * 6.4 - 2017-07
 * 7.2 - 2017-08
 * 5.5 - 2017-10
 * 
 * 
Here follows a list of C++11 features for GCC:

 * static_assert - 403
 * decltype - 403
 * variadic templates - 404
 * auto with new semantics - 404
 * char16_t, char32_t - 404
................................................................................
    #undef  CXXO_WARNING
    #define CXXO_WARNING(msg) CXXO_NOTICE_IMPL_( "cxxomfort warning: " msg)
#endif

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

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

/** GCC old versions define __cplusplus to be 1 but still have 
 * some good C++1997 and C++2003 support.
 * */
#if (CXXOMFORT_COMPILER_VERSION >= 400 && CXXOMFORT_COMPILER_VERSION <= 406 \
&& CXXOMFORT_CXX_STD<10)
	#undef  CXXOMFORT_CXX_STD
................................................................................
#if (CXXOMFORT_CXX_STD >= 1997 && CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011)
	#undef  CXXOFLAG_namespace_tr1 
	#define CXXOFLAG_namespace_tr1 1
#endif

// set up TR1 headers
#if (CXXOFLAG_namespace_tr1>0)
	#undef  CXXO_COMPILER_SUPPORT_tr1_array
	#define CXXO_COMPILER_SUPPORT_tr1_array 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_cstdint
    #define CXXO_COMPILER_SUPPORT_tr1_cstdint 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_random
    #define CXXO_COMPILER_SUPPORT_tr1_random 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_type_traits
    #define CXXO_COMPILER_SUPPORT_tr1_type_traits 1
    #undef  CXXO_COMPILER_SUPPORT_tr1_tuple
................................................................................
// via usage of the __cplusplus value
#if (CXXOMFORT_CXX_STD == 2013)
    #define CXXOMFORT_CXX_EMULATION 2014
#endif


#if (CXXOMFORT_COMPILER_VERSION >= 408)
	#undef  CXXO_COMPILER_SUPPORT__Pragma
	#define CXXO_COMPILER_SUPPORT__Pragma 1
    #if (CXXOMFORT_CXX_STD< 2011) && (CXXOMFORT_CXX_EMULATION==2011)
        #undef  CXXO_COMPILER_SUPPORT_attribute
        #define CXXO_COMPILER_SUPPORT_attribute 1
        #undef  CXXO_COMPILER_SUPPORT_alignment_tools
        #define CXXO_COMPILER_SUPPORT_alignment_tools 1
        #undef  CXXO_COMPILER_SUPPORT_decltype
        #define CXXO_COMPILER_SUPPORT_decltype 2

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

1
2
3
4
5
6
7











8
9
10
11
12
13
14
..
88
89
90
91
92
93
94


95
96
97
98
99
100
101
#ifndef CXXOMFORT_CONFIG_HPP
    #error "This file must not be included directly (see cxxomfort/config.hpp)"
#endif
#ifndef CXXOMFORT_CONFIG_MSC_HPP
#define CXXOMFORT_CONFIG_MSC_HPP

/*











 * In VC < 10, there is no such thing as C++11 emulation mode. What's more
 * important, in some versions the implementation of TR1 is broken or, in the
 * case of VC9 Express (2008) it won't install at all. 
 * Meaning that to be usable, this library needs to implement many
 * type_traits on its own.
 * 
 * In VC >= 10, the compiler works in what Microsoft calls C++11 mode, 
................................................................................
#if (CXXOMFORT_COMPILER_VERSION >= 1600) // VC10 or higher
    #if (_MSC_FULL_VER == 160040219) // SP1
        #undef  CXXOMFORT_COMPILER_VERSION
        #define CXXOMFORT_COMPILER_VERSION 1601
    #endif
    #undef  CXXOMFORT_CXX_EMULATION
    #define CXXOMFORT_CXX_EMULATION 2011


    #undef  CXXO_COMPILER_SUPPORT_cstd_system_error
    #define CXXO_COMPILER_SUPPORT_cstd_system_error 1
    #undef  CXXO_COMPILER_SUPPORT_auto
    #define CXXO_COMPILER_SUPPORT_auto 1984
    #undef  CXXO_COMPILER_SUPPORT_charn_t
    #define CXXO_COMPILER_SUPPORT_charn_t 2 // char16_t as typedef in yvals.h
    #undef  CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF







>
>
>
>
>
>
>
>
>
>
>







 







>
>







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
..
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#ifndef CXXOMFORT_CONFIG_HPP
    #error "This file must not be included directly (see cxxomfort/config.hpp)"
#endif
#ifndef CXXOMFORT_CONFIG_MSC_HPP
#define CXXOMFORT_CONFIG_MSC_HPP

/*
 * 
 * MSVC version history
 * 
 * 8.0 (2005-11)
 * 9.0 / 2008 (2007-11)
 * 10.0 / 2010 (2010-04)
 * 11.0 / 2012 (2012-08)
 * 12.0 / 2013 (2013-10)
 * 14.0 / 2015 (2015-07). Generates telemetry!
 * 
 * 
 * In VC < 10, there is no such thing as C++11 emulation mode. What's more
 * important, in some versions the implementation of TR1 is broken or, in the
 * case of VC9 Express (2008) it won't install at all. 
 * Meaning that to be usable, this library needs to implement many
 * type_traits on its own.
 * 
 * In VC >= 10, the compiler works in what Microsoft calls C++11 mode, 
................................................................................
#if (CXXOMFORT_COMPILER_VERSION >= 1600) // VC10 or higher
    #if (_MSC_FULL_VER == 160040219) // SP1
        #undef  CXXOMFORT_COMPILER_VERSION
        #define CXXOMFORT_COMPILER_VERSION 1601
    #endif
    #undef  CXXOMFORT_CXX_EMULATION
    #define CXXOMFORT_CXX_EMULATION 2011
    #undef  CXXO_COMPILER_SUPPORT__Pragma
    #define CXXO_COMPILER_SUPPORT__Pragma 1
    #undef  CXXO_COMPILER_SUPPORT_cstd_system_error
    #define CXXO_COMPILER_SUPPORT_cstd_system_error 1
    #undef  CXXO_COMPILER_SUPPORT_auto
    #define CXXO_COMPILER_SUPPORT_auto 1984
    #undef  CXXO_COMPILER_SUPPORT_charn_t
    #define CXXO_COMPILER_SUPPORT_charn_t 2 // char16_t as typedef in yvals.h
    #undef  CXXO_COMPILER_SUPPORT_charn_t_IS_TYPEDEF

Changes to cxxomfort/cxxomfort/config/ow.hpp.

28
29
30
31
32
33
34



35
36
37
38
39
40
41
42
43
 * CXXOMFORT_CXX_STD < 1997 ( == 0 or 1 ).
*/

#define CXXOMFORT_COMPILER_ID CXXO_COMPILERID_OW
#define CXXOMFORT_COMPILER_VERSION (__WATCOMC__/100)
#define CXXOMFORT_COMPILER_VERSION_FULL (__WATCOMC__)
/* Versions - __WATCOMC__ 



 * * 1290 --> Open Watcom 1.9
 * * 1300 --> Open Watcom 2.0 beta from the travis-ci
 * 
 * */


#define CXXO_PRAGMA(x) _Pragma (#x)
#undef  CXXO_NOTICE
#define CXXO_NOTICE(msg) ( msg )







>
>
>
|
|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 * CXXOMFORT_CXX_STD < 1997 ( == 0 or 1 ).
*/

#define CXXOMFORT_COMPILER_ID CXXO_COMPILERID_OW
#define CXXOMFORT_COMPILER_VERSION (__WATCOMC__/100)
#define CXXOMFORT_COMPILER_VERSION_FULL (__WATCOMC__)
/* Versions - __WATCOMC__ 
 * Release History: https://en.wikipedia.org/wiki/Watcom_C/C%2B%2B
 * 
 * * ???? --> Open Watcom 1.8 (2009-02)
 * * 1290 --> Open Watcom 1.9 (2010-06)
 * * 1300 --> Open Watcom 2.0 beta from the travis-ci (2015-04)
 * 
 * */


#define CXXO_PRAGMA(x) _Pragma (#x)
#undef  CXXO_NOTICE
#define CXXO_NOTICE(msg) ( msg )

Deleted cxxomfort/cxxomfort/extras/14-assert.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
#ifndef CXXOMFORT_EXTRAS_14ASSERT_HPP
#define CXXOMFORT_EXTRAS_14ASSERT_HPP
/*
 * Partially implements New Assert Variants proposal (n3500)
 * http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2013/n3500.htm
 */
#include <cxxomfort/config.hpp>
#include <cxxomfort/base/static_assert.hpp>

namespace cxxomfort {
namespace extras {

/* equivalent to assert(expression), except it also prints message (when expression is false) */
#ifdef NDEBUG
#define assert_msg(expr,msg) ( (void)0 )
#else
#define assert_msg(expr,msg) (expr) ? ((void)0) : assert(0==msg) 
#endif

/* equivalent to assert(expression), 
 * except it always evaluates expression, even when NDEBUG is defined 
 */
#ifdef NDEBUG
    #define verify(expr) ((void)(expr))
    #define verify_msg(expr,msg) ((void)(expr))
#else
    #define verify(expr) assert(expr)
    #define verify_msg(expr,msg) assert_msg(expr,msg)
#endif

/* equivalent to assert(expression), 
 * except it always evaluates and checks expression, even when NDEBUG is defined 
 */
#define CXXO_abort_str_(a) #a
#define CXXO_abort_str(a) CXXO_abort_str_(a)
#define CXXO_abort_msg_where() "file " __FILE__ " line " CXXO_abort_str(__LINE__) " "
#define abort_with_message(t,s) (fprintf(stderr,"Assertion failed in " s ": " t "\n"), abort())
#define assure(expr) (expr) ? (void)0 : abort_with_message(#expr, CXXO_abort_msg_where())
#define assure_msg(expr,msg) (expr) ? (void)0 : abort_with_message(msg, CXXO_abort_msg_where())

} //cxxomfort::extras
} //cxxomfort

#endif // CXXOMFORT_EXTRAS_14ASSERT_HPP

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


























































































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

1
2
3
4
5
6
7

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef CXXOMFORT_IMPL_CONDITIONAL_HPP
#define CXXOMFORT_IMPL_CONDITIONAL_HPP
/**
 * @file cxxomfort/type_traits.hpp
 * @brief Implementation of std::enable_if , std::conditional
 *
 */


#include "../config.hpp"

#if (CXXOMFORT_CXX_STD < 2011)
    #define CXXOMFORT_USING_conditional
    #define CXXOMFORT_IMPLEMENTS_n2240 CXXO_IMPLSTATUS_BACKPORT()
#else
    #define CXXOMFORT_IMPLEMENTS_n2240 0
#endif

namespace cxxomfort {
namespace cxxostd {

template <bool B, typename T=void>
struct enable_if{};







>







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef CXXOMFORT_IMPL_CONDITIONAL_HPP
#define CXXOMFORT_IMPL_CONDITIONAL_HPP
/**
 * @file cxxomfort/type_traits.hpp
 * @brief Implementation of std::enable_if , std::conditional
 *
 */


#include "../config.hpp"

#if (CXXOMFORT_CXX_STD < 2011)
    #define CXXOMFORT_USING_conditional
    #define CXXOMFORT_IMPLEMENTS_n2240 CXXO_IMPLSTATUS_BACKPORT()
#else
    #define CXXOMFORT_IMPLEMENTS_n2240 CXXO_IMPLSTATUS_NATIVE()
#endif

namespace cxxomfort {
namespace cxxostd {

template <bool B, typename T=void>
struct enable_if{};

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

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
#define CXXOMFORT_IMPLEMENTS_n3588 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_make_unique CXXOMFORT_IMPLEMENTS_n3588


// this is included after unique_ptr

// Add make_unique
// equivalent to return std::unique_ptr<T>(new T(std::forward<Args>(args)...));

namespace cxxomfort { namespace cxxostd {

#if (CXXOMFORT_CXX_STD == 2011)

template <typename T, typename ...Args> inline
unique_ptr<T> make_unique (Args&&... args) {
    return std::unique_ptr<T>( new T(std::forward<Args>(args)... ) );
}

#elif (CXXOMFORT_CXX_STD < 2011)
template <typename T> inline
unique_ptr<T> make_unique () {
    return unique_ptr<T> (new T());
}
template <typename T, typename A1> inline
unique_ptr<T> make_unique (CXXO_FWD_REF(A1) a1) {
    return unique_ptr<T> (new T( std::forward<A1>(a1) ));
}
template <typename T, typename A1, typename A2> inline
unique_ptr<T> make_unique (CXXO_FWD_REF(A1) a1, CXXO_FWD_REF(A2) a2) {
    return unique_ptr<T> (new T( std::forward<A1>(a1), std::forward<A2>(a2) ));
}
template <typename T, typename A1, typename A2, typename A3> inline
unique_ptr<T> make_unique (CXXO_FWD_REF(A1) a1, CXXO_FWD_REF(A2) a2, CXXO_FWD_REF(A3) a3) {
    return unique_ptr<T> (new T( 
       std::forward<A1>(a1), std::forward<A2>(a2), std::forward<A3>(a3) ));
}
template <typename T, typename A1, typename A2, typename A3, typename A4> inline
unique_ptr<T> make_unique (CXXO_FWD_REF(A1) a1, CXXO_FWD_REF(A2) a2, CXXO_FWD_REF(A3) a3, CXXO_FWD_REF(A4) a4) {
    return unique_ptr<T> (new T(
       std::forward<A1>(a1), std::forward<A2>(a2), std::forward<A3>(a3)
     , std::forward<A4>(a4) ));
}
template <typename T, typename A1, typename A2, typename A3, typename A4, typename A5> inline
unique_ptr<T> make_unique (CXXO_FWD_REF(A1) a1, CXXO_FWD_REF(A2) a2, CXXO_FWD_REF(A3) a3, CXXO_FWD_REF(A4) a4, CXXO_FWD_REF(A5) a5) {
    return unique_ptr<T> (new T(
      std::forward<A1>(a1), std::forward<A2>(a2), std::forward<A3>(a3), 
      std::forward<A4>(a4), std::forward<A5>(a5) ));
}

#endif
} } // cxxomfort::cxxostd








|






|





|
|


|
|


|
|


|
|



|
|




|
|







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
#define CXXOMFORT_IMPLEMENTS_n3588 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_make_unique CXXOMFORT_IMPLEMENTS_n3588


// this is included after unique_ptr

// Add make_unique
// equivalent to return std::std::unique_ptr<T>(new T(std::forward<Args>(args)...));

namespace cxxomfort { namespace cxxostd {

#if (CXXOMFORT_CXX_STD == 2011)

template <typename T, typename ...Args> inline
std::unique_ptr<T> make_unique (Args&&... args) {
    return std::unique_ptr<T>( new T(std::forward<Args>(args)... ) );
}

#elif (CXXOMFORT_CXX_STD < 2011)
template <typename T> inline
std::unique_ptr<T> make_unique () {
    return std::unique_ptr<T> (new T());
}
template <typename T, typename A1> inline
std::unique_ptr<T> make_unique (CXXO_FWD_REF(A1) a1) {
    return std::unique_ptr<T> (new T( std::forward<A1>(a1) ));
}
template <typename T, typename A1, typename A2> inline
std::unique_ptr<T> make_unique (CXXO_FWD_REF(A1) a1, CXXO_FWD_REF(A2) a2) {
    return std::unique_ptr<T> (new T( std::forward<A1>(a1), std::forward<A2>(a2) ));
}
template <typename T, typename A1, typename A2, typename A3> inline
std::unique_ptr<T> make_unique (CXXO_FWD_REF(A1) a1, CXXO_FWD_REF(A2) a2, CXXO_FWD_REF(A3) a3) {
    return std::unique_ptr<T> (new T( 
       std::forward<A1>(a1), std::forward<A2>(a2), std::forward<A3>(a3) ));
}
template <typename T, typename A1, typename A2, typename A3, typename A4> inline
std::unique_ptr<T> make_unique (CXXO_FWD_REF(A1) a1, CXXO_FWD_REF(A2) a2, CXXO_FWD_REF(A3) a3, CXXO_FWD_REF(A4) a4) {
    return std::unique_ptr<T> (new T(
       std::forward<A1>(a1), std::forward<A2>(a2), std::forward<A3>(a3)
     , std::forward<A4>(a4) ));
}
template <typename T, typename A1, typename A2, typename A3, typename A4, typename A5> inline
std::unique_ptr<T> make_unique (CXXO_FWD_REF(A1) a1, CXXO_FWD_REF(A2) a2, CXXO_FWD_REF(A3) a3, CXXO_FWD_REF(A4) a4, CXXO_FWD_REF(A5) a5) {
    return std::unique_ptr<T> (new T(
      std::forward<A1>(a1), std::forward<A2>(a2), std::forward<A3>(a3), 
      std::forward<A4>(a4), std::forward<A5>(a5) ));
}

#endif
} } // cxxomfort::cxxostd

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

27
28
29
30
31
32
33

34
35
36
37
38
39
40
 * byte |, &, ^ byte
 * byte << integer, byte >> integer
 * 
 * byte byte(char) <-- explicit
 * 
 */


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

//
// new impl 
//








>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 * byte |, &, ^ byte
 * byte << integer, byte >> integer
 * 
 * byte byte(char) <-- explicit
 * 
 */

#include <cxxomfort/base.hpp>
#include <cxxomfort/util/type_traits.hpp>
#include <cstring>

//
// new impl 
//

Deleted cxxomfort/cxxomfort/impl/17-destroy_at.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
#ifndef CXXOMFORT_IMPL_17_DESTROY_AT_HPP
#define CXXOMFORT_IMPL_17_DESTROY_AT_HPP
/**
 * @file
 * @brief Implementation of std::destroy_at and allies
 * 
 */

#define CXXOMFORT_IMPLEMENTS_p0040r1 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_p0040r2 CXXOMFORT_IMPLEMENTS_p0040r1
#define CXXOMFORT_IMPLEMENTS_destroy_at CXXOMFORT_IMPLEMENTS_p0040r2

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

namespace cxxomfort {
namespace cxxostd {

/**
 * @brief Destructs an object, as if the destructor was invoked via <code>Type::~Type()</code>.
 * @ingroup cxx17-backports
 * @sa http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0040r2.html
 * */
template <typename T>
void destroy_at (T* p) {
    p->~T();
}

/**
 * @brief Destructs a sequence of objects.
 * @ingroup cxx17-backports
 * @sa http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0040r2.html
 * */
template <typename Iter, typename Iter2>
void destroy (Iter ini, Iter2 fin) {
    using namespace std;
    for (; ini != fin; ++ini) destroy_at(addressof(*ini));
}

/**
 * @brief Destructs a sequence of objects.
 * @ingroup cxx17-backports
 * @sa http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0040r2.html
 * */
template <typename Iter, typename Integer>
void destroy_n (Iter ini, Integer n) {
    using namespace std;
    for (Integer i=0; i < n; ++i, ++ini) destroy_at(addressof(*ini));
}


}
} // cxxomfort

#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#else
    #if (CXXOMFORT_CXX_STD < 2017)
namespace std {
    using ::cxxomfort::cxxostd::destroy_at;
    using ::cxxomfort::cxxostd::destroy;
    using ::cxxomfort::cxxostd::destroy_n;
}
    #endif // c++17
#endif // using std

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




































































































































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

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
..
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
...
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
: protected cxxomfort::impl::array_ref::array_ref<CharT const> {
    private:
    typedef cxxomfort::impl::array_ref::array_ref<CharT const> membertype;
    public:
    typedef typename membertype::value_type      value_type;
    typedef typename membertype::size_type          size_type;
    typedef typename membertype::difference_type    difference_type;
    typedef typename membertype::pointer            pointer;
    typedef typename membertype::const_pointer   const_pointer;
    typedef typename membertype::reference          reference;
    typedef typename membertype::const_reference    const_reference;
    typedef typename membertype::const_iterator     const_iterator;
    typedef const_iterator                 iterator;
    typedef typename membertype::const_reverse_iterator  const_reverse_iterator;
    typedef const_reverse_iterator         reverse_iterator;
    //! Flag that indicates a position not found.
................................................................................
    public:
    // def-ctor
    CXXO_DEFAULT_DEFAULT_CONSTRUCTOR(basic_string_view);
    CXXO_CONSTEXPR CXXO_DEFAULT_COPY_CONSTRUCTOR(basic_string_view,CXXO_NOTHROW,
    membertype(From) );
    
    //! String view to a buffer of characters at position @e px and length @e sz .
    CXXO_CONSTEXPR basic_string_view (pointer px, size_t sz) CXXO_NOEXCEPTNOTHROW
    : membertype(px,sz)
    {}
    
    //! String view to a buffer of characters at position @e px to be processed via character_traits.
    CXXO_CONSTEXPR basic_string_view (pointer px) CXXO_NOEXCEPTNOTHROW 
    : membertype(px, CTraits::length(px) )
    {}

    //! String view to an array of characters.
#if (CXXOMFORT_CXX_STD>=1997)
    template<size_t N>
    CXXO_CONSTEXPR basic_string_view (CharT const(&arr)[N])
................................................................................
 * */
#if (CXXOMFORT_CXX_STD>=1997)

namespace cxxomfort { namespace cxxostd {

template <typename Ch, typename ChTraits>
std::basic_ostream<Ch, ChTraits>&

operator<<  (std::basic_ostream<Ch, ChTraits>& os, basic_string_view<Ch, ChTraits> v) {

    using namespace std;
    //size_t const n= max(static_cast<size_t>(os.width()), v.size());
    //os.rdbuf()->sputn(v.data(), n);
    for (size_t i= 0; i < v.size(); ++i) { os<< v[i]; }
    os.width(0);
    return os;
}

} }

#else
std::ostream& 
operator<< (std::ostream& os, cxxomfort::cxxostd::string_view v) {
    using namespace std;

    for (size_t i= 0; i < v.size(); ++i) { os<< v[i]; }
    os.width(0);
    return os;
}

#endif // 1997 for operator<<

#endif







|
|







 







|




|







 







>
|
>












|

>
|
|






38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
..
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
...
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
: protected cxxomfort::impl::array_ref::array_ref<CharT const> {
    private:
    typedef cxxomfort::impl::array_ref::array_ref<CharT const> membertype;
    public:
    typedef typename membertype::value_type      value_type;
    typedef typename membertype::size_type          size_type;
    typedef typename membertype::difference_type    difference_type;
    typedef CharT*             pointer;
    typedef CharT const*       const_pointer;
    typedef typename membertype::reference          reference;
    typedef typename membertype::const_reference    const_reference;
    typedef typename membertype::const_iterator     const_iterator;
    typedef const_iterator                 iterator;
    typedef typename membertype::const_reverse_iterator  const_reverse_iterator;
    typedef const_reverse_iterator         reverse_iterator;
    //! Flag that indicates a position not found.
................................................................................
    public:
    // def-ctor
    CXXO_DEFAULT_DEFAULT_CONSTRUCTOR(basic_string_view);
    CXXO_CONSTEXPR CXXO_DEFAULT_COPY_CONSTRUCTOR(basic_string_view,CXXO_NOTHROW,
    membertype(From) );
    
    //! String view to a buffer of characters at position @e px and length @e sz .
    CXXO_CONSTEXPR basic_string_view (const_pointer px, size_t sz) CXXO_NOEXCEPTNOTHROW
    : membertype(px,sz)
    {}
    
    //! String view to a buffer of characters at position @e px to be processed via character_traits.
    CXXO_CONSTEXPR basic_string_view (const_pointer px) CXXO_NOEXCEPTNOTHROW 
    : membertype(px, CTraits::length(px) )
    {}

    //! String view to an array of characters.
#if (CXXOMFORT_CXX_STD>=1997)
    template<size_t N>
    CXXO_CONSTEXPR basic_string_view (CharT const(&arr)[N])
................................................................................
 * */
#if (CXXOMFORT_CXX_STD>=1997)

namespace cxxomfort { namespace cxxostd {

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

} }

#else
std::ostream& 
operator<< (std::ostream& os, cxxomfort::cxxostd::string_view const v) {
    using namespace std;
    size_t const l = v.length();
    for (size_t i= 0; i < l; ++i) { os<< v[i]; }
    //os.width(0);
    return os;
}

#endif // 1997 for operator<<

#endif

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

244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
#if (CXXOMFORT_CXX_STD>=1997)
    void check_range (size_t i, std::error_code& ec) const {
        if (i>=len_) ec= std::make_error_code(cxxomfort::fix::errc::invalid_argument /*, std::generic_category() */);
        
    }
#endif
    
    pointer    ptr_;
    size_t     len_ CXXOMFORT_CXX11_CODE(= 0, ;);

}; // array_ref


/**
 * @brief Create a (potentially writeable) @c arrayref view of a buffer with size.







|







244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
#if (CXXOMFORT_CXX_STD>=1997)
    void check_range (size_t i, std::error_code& ec) const {
        if (i>=len_) ec= std::make_error_code(cxxomfort::fix::errc::invalid_argument /*, std::generic_category() */);
        
    }
#endif
    
    pointer    ptr_ CXXOMFORT_CXX11_CODE(= 0, ;);
    size_t     len_ CXXOMFORT_CXX11_CODE(= 0, ;);

}; // array_ref


/**
 * @brief Create a (potentially writeable) @c arrayref view of a buffer with size.

Added cxxomfort/cxxomfort/impl/p0040-memory_management.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
#ifndef CXXOMFORT_IMPL_p0040_HPP
#define CXXOMFORT_IMPL_p0040_HPP
/**
 * @file
 * @brief Implementation of std::destroy_at and allies
 * 
 */

#define CXXOMFORT_IMPLEMENTS_p0040r1 CXXO_IMPLSTATUS_BACKPORT()
#define CXXOMFORT_IMPLEMENTS_p0040r2 CXXOMFORT_IMPLEMENTS_p0040r1
#define CXXOMFORT_IMPLEMENTS_destroy_at CXXOMFORT_IMPLEMENTS_p0040r2

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

namespace cxxomfort {
namespace cxxostd {


/**
 * @brief Destructs an object, as if the destructor was invoked via <code>Type::~Type()</code>.
 * @ingroup cxx17-backports
 * @xrefitem std0memory "<memory>" "Memory management"
 * @sa @wg21{p0040r2}
 * */
template <typename T>
void destroy_at (T* p) CXXO_NOEXCEPTNOTHROW {
    p->~T();
}

/**
 * @brief Destructs a sequence of objects.
 * @ingroup cxx17-backports
 * @sa http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0040r2.html
 * */
template <typename Iter, typename Iter2>
void destroy (Iter ini, Iter2 fin) {
    using namespace std;
    for (; ini != fin; ++ini) destroy_at(addressof(*ini));
}

/**
 * @brief Destructs a sequence of objects.
 * @ingroup cxx17-backports
 * @sa http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0040r2.html
 * */
template <typename Iter, typename Integer>
void destroy_n (Iter ini, Integer n) {
    using namespace std;
    for (Integer i=0; i < n; ++i, ++ini) destroy_at(addressof(*ini));
}


/**
 * @brief Default-constructs objects in uninitialized memory.
 * @ingroup cxx17-backports
 * @xrefitem std0memory "<memory>" "Memory management"
 * @throw <tt>bad_alloc</tt>.
 * @sa @wg21{p0040r0} .
 * */
template <typename It>
void uninitialized_default_construct (It ini, It fin) {
    typedef typename std::iterator_traits<It>::value_type Value;
    It cur = ini;
    try {
        for (; cur != last; ++cur) {
            ::new (static_cast<void*>(std::addressof(*cur))) Value;
        }
    }  catch (...) {
        std::destroy(ini, cur);
        throw;
    }
}

/**
 * @brief Default-constructs objects in uninitialized memory.
 * @ingroup cxx17-backports
 * @xrefitem std0memory "<memory>" "Memory management"
 * @throw <tt>bad_alloc</tt>.
 * @sa @wg21{p0040r0} .
 * */
template <typename It, typename Integer>
void uninitialized_default_construct_n (It ini, Integer n) {
    typedef typename std::iterator_traits<It>::value_type Value;
    It cur = ini;
    try {
        for (; n > 0; (void) ++cur, --n) {
            ::new (static_cast<void*>(std::addressof(*cur))) Value;
        }
    }  catch (...) {
        std::destroy(ini, cur);
        throw;
    }
}

}
} // cxxomfort

#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#else
    #if (CXXOMFORT_CXX_STD < 2017)
namespace std {
    using ::cxxomfort::cxxostd::destroy_at;
    using ::cxxomfort::cxxostd::destroy;
    using ::cxxomfort::cxxostd::destroy_n;
}
    #endif // c++17
#endif // using std

#endif

Changes to cxxomfort/cxxomfort/impl/using_tr1_type_traits.hpp.

36
37
38
39
40
41
42

43
44
45
46
47
48
49
    using tr1::is_member_function_pointer;
    using tr1::is_member_object_pointer;
    using tr1::is_member_pointer;
    using tr1::is_array;
    using tr1::rank;
    using tr1::extent;
    using tr1::remove_extent;

    using tr1::is_class;
    using tr1::is_union;
    using tr1::is_scalar;
    using tr1::is_object;
    using tr1::is_empty;
    using tr1::is_pod;
    using tr1::is_abstract;







>







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
    using tr1::is_member_function_pointer;
    using tr1::is_member_object_pointer;
    using tr1::is_member_pointer;
    using tr1::is_array;
    using tr1::rank;
    using tr1::extent;
    using tr1::remove_extent;
    using tr1::is_convertible;
    using tr1::is_class;
    using tr1::is_union;
    using tr1::is_scalar;
    using tr1::is_object;
    using tr1::is_empty;
    using tr1::is_pod;
    using tr1::is_abstract;

Changes to cxxomfort/cxxomfort/library.hpp.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
37
38
39
40
41
42
43


44
45
46
47
48
49
50
51
52
53
54
55
56
#include "library/algorithm.hpp"
// extra binders and object wrappers
#include "library/functional.hpp"
// extra iterator helpers (constant_iterator, etc)
#include "library/iterator.hpp"
// numeric-related stuff
#include "library/numeric.hpp"
// functional plus<> like complements for +=, -=, ...
#include "library/operatorit.hpp"
// extra string extensions (join, trim, etc)
#include "library/string.hpp"
// extra tuple extensions (tuple_pop, etc)
#include "library/tuple.hpp"
// extra type_traits extensions (is_std_array, etc)
#include "library/type_traits.hpp"
// extra utility extensions
................................................................................
#include "library/foreach.hpp"
// object-like primitive wrapper for fundamentals (int, long, etc)
// #include "library/fundamental.hpp"
// initialization of containers and sequences
#include "library/i12n.hpp"
// local function emulation
//#include "library/localfn.hpp"


// pair03 - movable pair type for C++03
//#include "library/pair03.hpp"
// typename to string helpers - typeid_demangle, type_name
#include "library/type_name.hpp"
// typesafe_enum
#include "library/typesafe_enum.hpp"

/**
 * @page cxxo-sup Library Supplements
 * @brief Implementations and additions proper to the cxxomfort library.
 * 
 * The @b cxxomfort library does not only implement backports to C++ features; it also brings its own set of features to supplement various functionality that, for example, can not be backported to previous version in a meaningful fashion. 
 * 







<
<







 







>
>





|







14
15
16
17
18
19
20


21
22
23
24
25
26
27
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "library/algorithm.hpp"
// extra binders and object wrappers
#include "library/functional.hpp"
// extra iterator helpers (constant_iterator, etc)
#include "library/iterator.hpp"
// numeric-related stuff
#include "library/numeric.hpp"


// extra string extensions (join, trim, etc)
#include "library/string.hpp"
// extra tuple extensions (tuple_pop, etc)
#include "library/tuple.hpp"
// extra type_traits extensions (is_std_array, etc)
#include "library/type_traits.hpp"
// extra utility extensions
................................................................................
#include "library/foreach.hpp"
// object-like primitive wrapper for fundamentals (int, long, etc)
// #include "library/fundamental.hpp"
// initialization of containers and sequences
#include "library/i12n.hpp"
// local function emulation
//#include "library/localfn.hpp"
// functional plus<> like complements for +=, -=, ...
#include "library/operatorit.hpp"
// pair03 - movable pair type for C++03
//#include "library/pair03.hpp"
// typename to string helpers - typeid_demangle, type_name
#include "library/type_name.hpp"
// typesafe_enum
//#include "library/typesafe_enum.hpp"

/**
 * @page cxxo-sup Library Supplements
 * @brief Implementations and additions proper to the cxxomfort library.
 * 
 * The @b cxxomfort library does not only implement backports to C++ features; it also brings its own set of features to supplement various functionality that, for example, can not be backported to previous version in a meaningful fashion. 
 * 

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

1
2
3
4
5
6
7
8
9
#ifndef CXXOMFORT_CXXO_ALGORITHM_SUPP_HPP
#define CXXOMFORT_CXXO_ALGORITHM_SUPP_HPP
#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
#include <cxxomfort/algorithm.hpp>
#include <algorithm>
#include <iterator>

/**
|
|







1
2
3
4
5
6
7
8
9
#ifndef CXXOMFORT_SUPP_ALGORITHM_HPP
#define CXXOMFORT_SUPP_ALGORITHM_HPP
#include <cxxomfort/config.hpp>
#include <cxxomfort/base.hpp>
#include <cxxomfort/algorithm.hpp>
#include <algorithm>
#include <iterator>

/**

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











>
>
>
>
>
1
2
3
4
5
#ifndef CXXOMFORT_CXXO_SUPP_LIMITS_HPP
#define CXXOMFORT_CXXO_SUPP_LIMITS_HPP


#endif

Changes to cxxomfort/cxxomfort/library/random.hpp.

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






74
75
76
77






78
79
80
81






82
83
84
85
86
87
88
...
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#include <cxxomfort/limits.hpp>
#include <ctime>

namespace cxxomfort { namespace library {
namespace random {

namespace lfv2 {
//
// random_global_engine, from experimentlas / Fundamentals V2
//









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

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

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


................................................................................
};

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

//! PRNG in Numerical Recipes, as per Wikipedia's LCG article.






typedef std::linear_congruential_engine<uint32_t, 1664525, 1013904223, 0> 
lcg_numerical_recipes_rand;

//! MMIX: RNG recommended Donald Knuth, as per Wikipedia's LCG article.






typedef std::linear_congruential_engine<uint64_t, 6364136223846793005ULL, 1442695040888963407ULL, 0> 
MMIX_rand;

//! PRNG as per xkcd #221 "Random Number"






typedef 
std::linear_congruential_engine<unsigned int, 0, 4, 0>
xkcd221_r;

// 
// splitmix54 from http://xoshiro.di.unimi.it/splitmix64.c 
// recommended by  https://arvid.io/2018/07/02/better-cxx-prng/#fnref2
................................................................................
/**
 * @page cxxo-sup-random
 *
 * This file provides supplementary features to the ones
 * present in <code><random></code> that are
 * specific to cxxomfort.
 *
 * * @c xkcd221_g - xkcd's pseudorandom number generator selection.
 * * @c MMIX_rand - Knuth's LCG generator selection.
 * * @c lcg_numerical_recipes_rand - <em>Numerical Recipes</em>' LCG generator selection.
 * * @c splitmax64 .
 * * @c default_random_engine() , from Fundamentals v2.
 * * @c reseed() , from Fundamentals v2.
 * * @c randint() , from Fundamentals v2.
 *
 *
 * All interfaces are defined in the namespace <code>cxxomfort::algorithm::</code>.







<
<
<


>
>
>
>
>
>
>






|







 







|
>
>
>
>
>
>



|
>
>
>
>
>
>



|
>
>
>
>
>
>







 







|
|
|







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
..
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
...
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#include <cxxomfort/limits.hpp>
#include <ctime>

namespace cxxomfort { namespace library {
namespace random {

namespace lfv2 {






/**
 * @brief Return the "random global engine" declared by the program.
 * @ingroup cxxo-sup-random
 * @see Library Fundamentals v2
 * 
 * */
std::default_random_engine& random_global_engine () {
    static std::default_random_engine Engine ( time(0) );
    return Engine;
};

//
// reseed, from Fundamentals V2
//

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


................................................................................
};

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

/**
 * @typedef 
 * @brief LCG as it appears in <em>Numerical Recipes</em>.
 * @ingroup cxxo-sup-random
 * 
 * When invoked with <tt>operator()</tt> returns a @c uint32_t value.
 * */
typedef std::linear_congruential_engine<uint32_t, 1664525, 1013904223, 0> 
lcg_numerical_recipes_rand;

/**
 * @typedef 
 * @brief MMIX: LCG as it appears recommended by Donald Knuth.
 * @ingroup cxxo-sup-random
 * 
 * When invoked with <tt>operator()</tt> returns a @c uint64_t value.
 * */
typedef std::linear_congruential_engine<uint64_t, 6364136223846793005ULL, 1442695040888963407ULL, 0> 
MMIX_rand;

/**
 * @typedef 
 * @brief LCG as it appears recommended by Randall Munroe in <em>xkcd #221</em>.
 * @ingroup cxxo-sup-random
 * 
 * When invoked with <tt>operator()</tt> returns a @c uint32_t value.
 * */
typedef 
std::linear_congruential_engine<unsigned int, 0, 4, 0>
xkcd221_r;

// 
// splitmix54 from http://xoshiro.di.unimi.it/splitmix64.c 
// recommended by  https://arvid.io/2018/07/02/better-cxx-prng/#fnref2
................................................................................
/**
 * @page cxxo-sup-random
 *
 * This file provides supplementary features to the ones
 * present in <code><random></code> that are
 * specific to cxxomfort.
 *
 * * @c @ref xkcd221_g - xkcd's pseudorandom number generator selection.
 * * @c @ref MMIX_rand - Knuth's LCG generator selection.
 * * @c @ref lcg_numerical_recipes_rand - <em>Numerical Recipes</em>' LCG generator selection.
 * * @c splitmax64 .
 * * @c default_random_engine() , from Fundamentals v2.
 * * @c reseed() , from Fundamentals v2.
 * * @c randint() , from Fundamentals v2.
 *
 *
 * All interfaces are defined in the namespace <code>cxxomfort::algorithm::</code>.

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

1
2
3
4
5
6
7
8
9
#ifndef CXXOMFORT_CXXO_TUPLE_SUPP_HPP
#define CXXOMFORT_CXXO_TUPLE_SUPP_HPP

/**
 * @file
 * 
 * This file provides supplementary features for the tuple-related 
 * utilities present in <code><tuple></code>.
 * 
|
|







1
2
3
4
5
6
7
8
9
#ifndef CXXOMFORT_CXXO_SUPP_TUPLE_HPP
#define CXXOMFORT_CXXO_SUPP_TUPLE_HPP

/**
 * @file
 * 
 * This file provides supplementary features for the tuple-related 
 * utilities present in <code><tuple></code>.
 * 

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

6
7
8
9
10
11
12

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

30

31
32
33

34
35
36
37


38
39
40
41
42
43
44
..
80
81
82
83
84
85
86
87

88
89
90
91
92
93
94
95
96
...
104
105
106
107
108
109
110
111
112
113
114
115




116
117
118
119
120
121
122
 * @brief Implementation of type-naming utilities for cxxomfort.
 */

#include <cxxomfort/base.hpp>
#include <cxxomfort/config.hpp>
#include <cxxomfort/type_traits.hpp> // remove_reference, etc
#include <cxxomfort/string_view.hpp>

#include "../util/type_traits.hpp"
#include <string>
// #include <typeinfo> // user now has to include it explicitly

#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG)
	#define CXXO_has_cxx_demangle 1
#endif
................................................................................
#ifdef CXXO_has_cxx_demangle
    #include <cxxabi.h>
#endif

namespace cxxomfort { namespace library {
namespace detail_demangle {

// Thanks much to ′灵魂L.眼神 for making me notice this had to be made static!

static std::string job (const char* name) {

#ifdef CXXO_has_cxx_demangle
    char buf[1024];
    size_t size=sizeof(buf);

    int status;
    char* res = abi::__cxa_demangle (name, buf, &size, &status);
    buf[sizeof(buf) - 1] = 0;
    return std::string(res);


#else
    return name;
#endif
}


} //detail_demangle::
................................................................................

cout<< cxxomfort::library::type_name<int>()<< endl;

 * @endcode
 */

template <typename T>
std::string_view type_name () CXXO_NOEXCEPTNOTHROW {

    using namespace std;

#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)
    string_view S (__FUNCSIG__);
    // from "...type_name<TYPE_WE_WANT>(void) throw"
    size_t nend= S.rfind(">(void)");
    S= S.substr(119, nend-119);

#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC)
................................................................................
	size_t prefixend= 1;
	#endif

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

#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG)
	string_view S (__PRETTY_FUNCTION__);
	#if (CXXOMFORT_COMPILER_VERSION<500)
		S= S.substr(54, S.size()-54-1);
	#endif




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









>







 







|
>

>

|
<
>
|
|
<
<
>
>







 







|
>

<







 







|


|

>
>
>
>







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
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
..
83
84
85
86
87
88
89
90
91
92

93
94
95
96
97
98
99
...
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
 * @brief Implementation of type-naming utilities for cxxomfort.
 */

#include <cxxomfort/base.hpp>
#include <cxxomfort/config.hpp>
#include <cxxomfort/type_traits.hpp> // remove_reference, etc
#include <cxxomfort/string_view.hpp>
#include <cxxomfort/memory.hpp>
#include "../util/type_traits.hpp"
#include <string>
// #include <typeinfo> // user now has to include it explicitly

#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC || CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_CLANG)
	#define CXXO_has_cxx_demangle 1
#endif
................................................................................
#ifdef CXXO_has_cxx_demangle
    #include <cxxabi.h>
#endif

namespace cxxomfort { namespace library {
namespace detail_demangle {

// 2016-xx-xx: Thanks much to ′灵魂L.眼神 for making me notice this had to be made static!
// 2019-02-25: Applied solution from https://stackoverflow.com/questions/281818/unmangling-the-result-of-stdtype-infoname
static std::string job (const char* name) {
	using namespace std;
#ifdef CXXO_has_cxx_demangle
    // char buf[1024];

    typedef std::unique_ptr<char, cxxomfort::fix::malloc_deleter> rPtr;
    int status=-4;
    rPtr res (abi::__cxa_demangle (name, NULL, NULL, &status) );


    
    return status==0 ? res.get() : name;
#else
    return name;
#endif
}


} //detail_demangle::
................................................................................

cout<< cxxomfort::library::type_name<int>()<< endl;

 * @endcode
 */

template <typename T>
std::string_view type_name ()
CXXO_NOEXCEPTNOTHROW {
    using namespace std;

#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)
    string_view S (__FUNCSIG__);
    // from "...type_name<TYPE_WE_WANT>(void) throw"
    size_t nend= S.rfind(">(void)");
    S= S.substr(119, nend-119);

#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC)
................................................................................
	size_t prefixend= 1;
	#endif

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

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


Changes to cxxomfort/cxxomfort/memory.hpp.

7
8
9
10
11
12
13

14
15
16
17
18
19
20
..
24
25
26
27
28
29
30



31
32
33
34
35
36
37
..
48
49
50
51
52
53
54








































55
56
57
58
59
60
61
..
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
...
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
...
178
179
180
181
182
183
184










185
186
187
188
189
190
191
...
226
227
228
229
230
231
232
233
234

235
236
237
238
239
240
 *
 */

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


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


#if (CXXOFLAG_namespace_tr1>0)
................................................................................
	using tr1::shared_ptr;
	//using tr1::make_shared;
	using tr1::weak_ptr;
}
	#endif
#endif




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

// 
// aligned_storage
................................................................................


//
// aligned_union
//











































// 
// pointer_traits , allocator_traits
// 

// pointer_traits, allocator_traits
#include "util/memtraits.hpp"
................................................................................
#else
	#include "impl/unique_ptr-poor.hpp"
#endif

// 
// make_unique 
// 

#if (CXXOMFORT_CXX_STD>=2014)
#elif (CXXOMFORT_CXX_STD>=1997)
    #include "impl/14-make_unique.hpp"
#else
#endif


................................................................................
        #define alignas(N) __declspec(align(N))
    #endif
*/
#endif


// 
// destroy
// 

#include "impl/17-destroy_at.hpp"



// 
// cxxomfort::fix assist
// 










// assist
namespace cxxomfort { namespace fix {
template <typename T>
bool to_bool (std::unique_ptr<T> const& p) CXXO_NOEXCEPTNOTHROW {
    return p.get() != nullptr;
}
................................................................................
} // cxxomfort

#else

#endif // memtools














// -- set up needed things in std::
#if (CXXOMFORT_CXX_STD < 2011 && defined(CXXOMFORT_USING_unique_ptr))
    #if (!defined(CXXOMFORT_NO_TR1) && !defined(NO_TR1))
//
// specialize std::tr1::hash for unique_ptr<>
................................................................................
 * * Pointer traits and Allocator traits (C++11) - tools for assisting in the design of containers.
 * * @link cxxomfort::cxxostd::aligned_storage @c aligned_storage @endlink </code> (C++11) - create an unitialized buffer for storing an object of a given type.
 * * @link cxxomfort::cxxostd::unique_ptr @c unique_ptr @endlink (C++11) - smart pointer that owns and holds a resource.
 * * @c make_unique() (C++14) - assist for creating @c unique_ptr .
 * 
 * Non-backport interfaces:
 * 
 * * <code>to_bool(<std::unique_ptr> const&)</code> - briefer conversion to @c bool , for validity checks.
 * 

 *
 * @section also See Also
 * 
 * * @see @cppref{header/memory} 
 *
 * */







>







 







>
>
>







 







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







 







<







 







|


|
<



|


>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>







 







|
|
>






7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
..
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
...
122
123
124
125
126
127
128

129
130
131
132
133
134
135
...
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
...
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
...
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
 *
 */

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

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


#if (CXXOFLAG_namespace_tr1>0)
................................................................................
	using tr1::shared_ptr;
	//using tr1::make_shared;
	using tr1::weak_ptr;
}
	#endif
#endif

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

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

// 
// aligned_storage
................................................................................


//
// aligned_union
//


// 
// default_delete
// 

#if (CXXOMFORT_CXX_STD>=2011)
#elif (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_MSC,>=1600)) // MSVC 2010 already has it
#elif (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_CXX_EMULATION>=2011)
#else

namespace std {
	template <typename T> struct default_delete {

		default_delete () throw() {}

		template <class U>
		default_delete ( default_delete<U> const&
		, typename std::enable_if<std::is_convertible<U*, T*>::value, void>::type* = 0 )  
		{ }

		void operator() (T* ptr) const  CXXO_NOEXCEPTNOTHROW   {
			static_assert (sizeof(T) > 0, "T must be a complete type");
			delete ptr;
		}

	};
	
	template <typename T> struct default_delete<T[]> {

		void operator() (T* ptr) const CXXO_NOEXCEPTNOTHROW {
			static_assert (sizeof(T) > 0, "T must be a complete type");
			delete [] ptr;
		}

		private:

		template <class U> void operator()(U*) const;
	};
}
#endif


// 
// pointer_traits , allocator_traits
// 

// pointer_traits, allocator_traits
#include "util/memtraits.hpp"
................................................................................
#else
	#include "impl/unique_ptr-poor.hpp"
#endif

// 
// make_unique 
// 

#if (CXXOMFORT_CXX_STD>=2014)
#elif (CXXOMFORT_CXX_STD>=1997)
    #include "impl/14-make_unique.hpp"
#else
#endif


................................................................................
        #define alignas(N) __declspec(align(N))
    #endif
*/
#endif


// 
// destroy, uninitialized_default_construct, ...
// 

#include "impl/p0040-memory_management.hpp"



// 
// cxxomfort::fix assist: to_bool
// 

// assist
namespace cxxomfort { namespace fix {
template <typename T>
bool to_bool (std::shared_ptr<T> const& p) CXXO_NOEXCEPTNOTHROW {
	return p.get() != nullptr;
}

} } // cxxomfort::fix

// assist
namespace cxxomfort { namespace fix {
template <typename T>
bool to_bool (std::unique_ptr<T> const& p) CXXO_NOEXCEPTNOTHROW {
    return p.get() != nullptr;
}
................................................................................
} // cxxomfort

#else

#endif // memtools


// 
// assist: malloc_deleter extension
// 
namespace cxxomfort { namespace fix {

struct malloc_deleter {
	void operator() (void* ptr) { free(ptr); }
};

} } // cxxomfort::fix::


// -- set up needed things in std::
#if (CXXOMFORT_CXX_STD < 2011 && defined(CXXOMFORT_USING_unique_ptr))
    #if (!defined(CXXOMFORT_NO_TR1) && !defined(NO_TR1))
//
// specialize std::tr1::hash for unique_ptr<>
................................................................................
 * * Pointer traits and Allocator traits (C++11) - tools for assisting in the design of containers.
 * * @link cxxomfort::cxxostd::aligned_storage @c aligned_storage @endlink </code> (C++11) - create an unitialized buffer for storing an object of a given type.
 * * @link cxxomfort::cxxostd::unique_ptr @c unique_ptr @endlink (C++11) - smart pointer that owns and holds a resource.
 * * @c make_unique() (C++14) - assist for creating @c unique_ptr .
 * 
 * Non-backport interfaces:
 * 
 * * <tt>to_bool(<std::unique_ptr> const&)</tt> - briefer validity check to @c bool .
 * * <tt>to_bool(<std::shared_ptr> const&)</tt> - briefer validity check to @c bool .
 * * <tt>malloc_deleter</tt>.
 *
 * @section also See Also
 * 
 * * @see @cppref{header/memory} 
 *
 * */

Changes to cxxomfort/cxxomfort/random.hpp.

163
164
165
166
167
168
169




170

















171
172
173
174
175
176
177
...
195
196
197
198
199
200
201
202
203

204
205
206
207
208
209
210
211
212
213
214
215
216
 * */
typedef shuffle_order_engine<minstd_rand,256> knuth_b;


#endif
} } // cxxomfort::fix

























#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#else
    #if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011)
    namespace std {
        using ::cxxomfort::cxxostd::shuffle_order_engine;
................................................................................
 * 
 * Interfaces defined in this section:
 * 
 * * @c linear_congruent_engine , @c minstd , @c minstd0 (C++11).
 * * @c shuffle_order_engine , @c knuth_b  (C++11).
 * * @link cxxomfort::cxxostd::default_random_engine @c default_random_engine @endlink - in cxxomfort defined as ranlux24_base for C++03.
 * 
 * Non-backport interfaces:
 * 

 * * <code>cxxomfort::fix::shuffle_order_engine</code> - for broken std in MSVC 2010.
 * * @c cxxomfort::fix::knuth_b - for broken std in MSVC 2010.
 *
 * Pending:
 * 
 * * @c generate_canonical complementary (C++11).
 * * @c uniform_int_distribution complementary (C++11).
 * * @c discrete_distribution complementary (C++11).
 *
 * See also: @ref cxxo-sup-random (supplemental), 
 * <a href="https://en.cppreference.com/w/cpp/header/random">\<random\> \@cppreference</a>.
 * 
 * */







>
>
>
>

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







 







|

>
|












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
...
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
 * */
typedef shuffle_order_engine<minstd_rand,256> knuth_b;


#endif
} } // cxxomfort::fix

//
// randmo 
// 
namespace cxxomfort { namespace fix {

// from https://stackoverflow.com/questions/10984974/why-do-people-say-there-is-modulo-bias-when-using-a-random-number-generator
/**
 * @brief Invokes @c rand and rids of some of the bias from the modulo.
 * @param mo An integer.
 * @returns An integer in the range <tt>[0, mo)</tt>.
 * @throws None.
 * */
static inline int randmo (int mo) CXXO_NOEXCEPTNOTHROW {
	int x= 0;
	do {
		x = rand();
	} while (x >= (RAND_MAX - RAND_MAX % mo));
	x %= mo;
	return x;
}

} } // cxxomfort::fix


#if (defined(CXXOFLAG_NO_STD_USING) && CXXOFLAG_NO_STD_USING>0 )
#else
    #if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011)
    namespace std {
        using ::cxxomfort::cxxostd::shuffle_order_engine;
................................................................................
 * 
 * Interfaces defined in this section:
 * 
 * * @c linear_congruent_engine , @c minstd , @c minstd0 (C++11).
 * * @c shuffle_order_engine , @c knuth_b  (C++11).
 * * @link cxxomfort::cxxostd::default_random_engine @c default_random_engine @endlink - in cxxomfort defined as ranlux24_base for C++03.
 * 
 * Fix (non-backport) interfaces:
 * 
 * * <tt>cxxomfort::fix::randmo()</tt> - modulo-respecting call to <tt>rand()</tt>.
 * * <tt>cxxomfort::fix::shuffle_order_engine</tt> - for broken std in MSVC 2010.
 * * @c cxxomfort::fix::knuth_b - for broken std in MSVC 2010.
 *
 * Pending:
 * 
 * * @c generate_canonical complementary (C++11).
 * * @c uniform_int_distribution complementary (C++11).
 * * @c discrete_distribution complementary (C++11).
 *
 * See also: @ref cxxo-sup-random (supplemental), 
 * <a href="https://en.cppreference.com/w/cpp/header/random">\<random\> \@cppreference</a>.
 * 
 * */

Changes to cxxomfort/cxxomfort/string_view.hpp.

22
23
24
25
26
27
28

29
30
31
32
33
34
35
36
37

38
39
40
41
42
43
44
45
..
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71

namespace cxxomfort { namespace fix {

/**
 * @brief Creates a view of a std::string.
 * */
template <typename Char, typename CT>

std::basic_string_view<Char,CT> make_string_view (std::basic_string<Char,CT> const& s) {
    return std::basic_string_view<Char,CT> (s.data(), s.size());
}

/**
 * @brief Creates a view from a character array.
 * 
 * */
template <typename Char, size_t N>

std::basic_string_view<Char> make_string_view (Char const(&arr)[N]) {
    return std::basic_string_view<Char> (arr, N);
}

} } // cxxomfort::fix

	#endif

................................................................................
 * @brief Backports from <string_view>
 * 
 * Interfaces defined here:
 * 
 * * @c @ref cxxomfort::cxxostd::basic_string_view @c basic_string_view  (C++17).
 * * the related typedefs eg.: @c string_view .
 * 
 * Non-backport interfaces:
 * 
 * * @c cxxomfort::fix::make_string_view() - Makes a @c string_view from a std::string or a literal string.
 * 
 * @section also "See Also"
 * 
 * * @ref @cppref{header/string_view} , @ref @cppref{string/basic_string_view}
 * * @ref std0string "<string> backports"
 * 
 * 
 * */







>
|








>
|







 







|










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
..
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

namespace cxxomfort { namespace fix {

/**
 * @brief Creates a view of a std::string.
 * */
template <typename Char, typename CT>
std::basic_string_view<Char,CT> 
make_string_view (std::basic_string<Char,CT> const& s) {
    return std::basic_string_view<Char,CT> (s.data(), s.size());
}

/**
 * @brief Creates a view from a character array.
 * 
 * */
template <typename Char, size_t N>
CXXO_CONSTEXPR std::basic_string_view<Char> 
make_string_view (Char const(&arr)[N]) CXXO_NOEXCEPT {
    return std::basic_string_view<Char> (arr, N);
}

} } // cxxomfort::fix

	#endif

................................................................................
 * @brief Backports from <string_view>
 * 
 * Interfaces defined here:
 * 
 * * @c @ref cxxomfort::cxxostd::basic_string_view @c basic_string_view  (C++17).
 * * the related typedefs eg.: @c string_view .
 * 
 * Fix (non-backport) interfaces:
 * 
 * * @c cxxomfort::fix::make_string_view() - Makes a @c string_view from a std::string or a literal string.
 * 
 * @section also "See Also"
 * 
 * * @ref @cppref{header/string_view} , @ref @cppref{string/basic_string_view}
 * * @ref std0string "<string> backports"
 * 
 * 
 * */

Changes to cxxomfort/cxxomfort/system_error.hpp.

336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
    
    //! Returns the value of the error code.
    int        value () const CXXO_NOEXCEPTNOTHROW { return V; }
    //! Returns the category of the error code.
    error_category const& category () const CXXO_NOEXCEPTNOTHROW { return *C; }
    //! Returns the composed message for the error code.
    std::string message () const { return category().message(value()); }
    //! Checks if the error value is set.
    operator bool () const { return value() != 0; }
    
    error_condition default_error_condition () const CXXO_NOEXCEPTNOTHROW {
        return category().default_error_condition(value());
    }

    CXXO_EXPLICIT_OPERATOR(bool) () const CXXO_NOEXCEPTNOTHROW { return value(); }
    







|
|







336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
    
    //! Returns the value of the error code.
    int        value () const CXXO_NOEXCEPTNOTHROW { return V; }
    //! Returns the category of the error code.
    error_category const& category () const CXXO_NOEXCEPTNOTHROW { return *C; }
    //! Returns the composed message for the error code.
    std::string message () const { return category().message(value()); }
    // Checks if the error value is set.
    // operator bool () const { return value() != 0; }
    
    error_condition default_error_condition () const CXXO_NOEXCEPTNOTHROW {
        return category().default_error_condition(value());
    }

    CXXO_EXPLICIT_OPERATOR(bool) () const CXXO_NOEXCEPTNOTHROW { return value(); }
    

Changes to cxxomfort/cxxomfort/type_traits.hpp.

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
...
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
	#include "impl/11-underlying_type.hpp"
	#include "impl/11-common_type.hpp"
	#include "impl/11-is_tn_xble.hpp"

#else // CXX_STD < 1997

	// 
	// compilers that don't hae <type_traits>; 
	// here we only include a minimum subset of traits


	//
	
	#include "impl/11-conditional.hpp"
	#include "util/type_traits.hpp" // at least the basic traits
	#if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_MSC)

		#include <cxxomfort/config/msc/type_traits>
	#endif

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





#endif // CXX_STD
	



................................................................................
 * bool_constant (c++17)
 */
#include "impl/17-bool_constant.hpp"

/*
 * endian (c++20)
 */
#if (CXXOMFORT_CXX_STD>=2011 || CXXO_COMPILER_SUPPORT_tr1_type_traits)
#include "impl/20-endian.hpp"
#endif


//
// is_trivially_... missing in GCC 4.7 despite announcing C++11 mode
//

#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC , < 404) && CXXOMFORT_CXX_EMULATION==2011)







|

>
>




<
>
|
|
>
|


>
>
>







 







<

<







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
...
246
247
248
249
250
251
252

253

254
255
256
257
258
259
260
	#include "impl/11-underlying_type.hpp"
	#include "impl/11-common_type.hpp"
	#include "impl/11-is_tn_xble.hpp"

#else // CXX_STD < 1997

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


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

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



#endif // CXX_STD
	



................................................................................
 * bool_constant (c++17)
 */
#include "impl/17-bool_constant.hpp"

/*
 * endian (c++20)
 */

#include "impl/20-endian.hpp"



//
// is_trivially_... missing in GCC 4.7 despite announcing C++11 mode
//

#if (CXXO_COMPILERVERSION_COMPARE(CXXO_COMPILERID_GCC , < 404) && CXXOMFORT_CXX_EMULATION==2011)

Changes to cxxomfort/cxxomfort/typeindex.hpp.

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

#endif


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

namespace std {
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC)
    namespace tr1 {
    #endif
    
    template<>
    struct hash< type_index > {
        typedef type_index argument_type;
        typedef size_t result_type;
        result_type operator()(argument_type const& s) const CXXO_NOEXCEPTNOTHROW   {
            //cout<< "[hash<type_index> for "<< s.name()<< "]"<< flush;
            return s.hash_code();
        }    
    };
    
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC)
    } // tr1
    #endif

}
#endif // no_std_using

#endif







|
>

|













|







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

#endif


#if (CXXOMFORT_CXX_STD >= 2011 || CXXO_COMPILER_SUPPORT_cstd_typeindex>0)
#else
namespace std {
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_CXX_EMULATION==0)
    namespace tr1 {
    #endif
    
    template<>
    struct hash< type_index > {
        typedef type_index argument_type;
        typedef size_t result_type;
        result_type operator()(argument_type const& s) const CXXO_NOEXCEPTNOTHROW   {
            //cout<< "[hash<type_index> for "<< s.name()<< "]"<< flush;
            return s.hash_code();
        }    
    };
    
    #if (CXXOMFORT_COMPILER_ID==CXXO_COMPILERID_GCC && CXXOMFORT_CXX_EMULATION==0)
    } // tr1
    #endif

}
#endif // no_std_using

#endif