Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | Commit 2020-01-13 - The “don't ask me for documentation fixes, I don't have 2020 vision” release.
This release marks the opening of (pre-)releases to be marked with the 'y2020' tag. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | gcc_min_404 | msvc_min_1500 | release | y2020 | clang_min_303 |
Files: | files | file ages | folders |
SHA3-256: |
4817fec6ebf970ca35b4a5b2f646415c |
User & Date: | luismachuca 2020-01-14 05:29:56 |
2020-02-04
| ||
02:05 | • Fixed ticket [98efdadf]: "any_of" is always true plus 5 other changes artifact: dd1c4832 user: luismachuca | |
2020-02-07
| ||
16:42 | Commit 2020-02-04 - Compatibility improvements for MSVC 2012, GCC 6.x. check-in: f22f0a4b user: luismachuca tags: trunk, msvc_min_1500, release, y2020, gcc_min_408, tagfiles, gcc_max_605, msvc_max_1700 | |
2020-01-14
| ||
05:29 | Commit 2020-01-13 - The “don't ask me for documentation fixes, I don't have 2020 vision” release. check-in: 4817fec6 user: luismachuca tags: gcc_min_404, msvc_min_1500, release, y2020, clang_min_303 | |
2019-11-11
| ||
04:41 | Commit 2019-11-11 - .at() the end of year _or close. check-in: 1dfa7ad4 user: luismachuca tags: y2019, clang_min_302, gcc_min_404, gcc_max_600 | |
Changes to cxxomfort/CHANGELOG.txt.
1 2 3 | Commit 2019-11-11 - .at() the end of year _or close. * cxxomfort: <tt>CXXOMFORT_CXX_EMULATION</tt> now returns <tt>>=2007</tt> for C++98/03 mode with TR1, where possible. | > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 | Commit 2020-01-13 - The “don't ask me for documentation fixes, I don't have 2020 vision” release. * cxxomfort: Added detection of Clang 4.x with some features. * cxxomfort: CXXOMFORT_VERSION now copies CXXOMFORT_DATE. * config: Slightly improved detection of Clang <tt>__has_extension</tt>. * algorithm: Fixed <tt>any_of</tt> returning always true (Fixes: [98efdadf5b]). * functional: Fixed missing connection of documentation for heterogeneous functors. * iterator: Defined and documented the behaviour of fix:is_contiguous_access_iterator for "checked" iterators. * limits: Fixed missing documentation for <tt>integral_limits</tt>. * memory: Fixed documentation for the <tt>to_bool</tt> fixes. * system_error: Fixed Doxygen marking for the category functions. * library:functional: Fixed missing connection of documentation for heterogeneous functors. * library:iterator: Added <tt>at_or()</tt> adapter. * library:tuple: Fixed missing Doxygen marking for <tt>tuple_pop</tt>, <tt>tuple_shift</tt>. * library:utility: Added valcmp (also in library:algorithm). * library:array_ref: Fixed constructors in accordance to n3334. * library:function_ref: Added support for 3, 4, 5-args functions. * library:typesafe_enum: Corrected default constructor as per [expr.type.conv] and https://stackoverflow.com/questions/53897991/enum-class-default-initialization . * tags: Added tags for new features in library:functional. * tags: Updated cxxomfort tags for new fix / assists. * tags: Removed references to CXXOMFORT_VERSION. * doc: Updated autogenerated documentation. * LICENSE: Now reflects year 2020. This release marks the opening of (pre-)releases to be marked with the '<tt>y2020</tt>' tag. Commit 2019-11-11 - .at() the end of year _or close. * cxxomfort: <tt>CXXOMFORT_CXX_EMULATION</tt> now returns <tt>>=2007</tt> for C++98/03 mode with TR1, where possible. * cxxomfort: <tt>library</tt> is now **not** included automatically. It must be included explicitly even with <tt>cxxomfort.hpp</tt>. * algorithm: Added <tt>count</tt>, <tt>count_if</tt> from C++20 (fixes: [ac8af64591]). * algorithm: Tentatively marking <tt>find</tt>, <tt>count</tt> algorithms as <tt>constexpr</tt> for C++14. * array: Fixed a wrong call to <tt>lexicographical_compare</tt> in pre-TR1 implementation. * iterator: Added <tt>contiguous_iterator_tag</tt>. Note that pre-C++17 Standard code would not know how to use it. * iterator: Added <tt>make_reverse_iterator</tt> from C++14. * random: Fixed a missing cxxomfort::fix in certain compilers in C++11 mode (enhances: [5ba7743db6] Clang-4.x support, GCC-6.x support). * string_view: Added <tt>.at_or()</tt>. |
︙ | ︙ |
Changes to cxxomfort/LICENSE.txt.
1 | cxxomfort Library for C++ | | | 1 2 3 4 5 6 7 8 9 | cxxomfort Library for C++ Copyright (c) 2012-2020 Luis Machuca Bezzaza, credits to various authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, |
︙ | ︙ |
Changes to cxxomfort/cxxomfort/algorithm.hpp.
︙ | ︙ | |||
13 14 15 16 17 18 19 | #include "base.hpp" #include CXXO_INCLUDE_SYS(algorithm) //#include "util/meta.hpp" // conditional namespace cxxomfort { namespace cxxostd { | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #include "base.hpp" #include CXXO_INCLUDE_SYS(algorithm) //#include "util/meta.hpp" // conditional namespace cxxomfort { namespace cxxostd { #if (1) /** * @brief Copy elements conditionally to @a dest if they fulfill @a f . * @return the advanced @a dest iterator. * @xrefitem std0algorithm "<algorithm> backports" "" * @ingroup cxx11-backports * @sa @cppref{algorithm/copy} |
︙ | ︙ | |||
288 289 290 291 292 293 294 | #pragma message CXXO_NOTICE("enabled <algorithm> support.") #endif #if (defined( CXXOFLAG_NO_STD_USING ) && CXXOFLAG_NO_STD_USING>0) #else // the commented ones here are using'd in subheaders: | | | | | | > > > > > > > | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | #pragma message CXXO_NOTICE("enabled <algorithm> support.") #endif #if (defined( CXXOFLAG_NO_STD_USING ) && CXXOFLAG_NO_STD_USING>0) #else // the commented ones here are using'd in subheaders: #if (CXXOMFORT_CXX_STD < 2011 && CXXOMFORT_CXX_EMULATION < 2011) using ::cxxomfort::cxxostd::copy_if; using ::cxxomfort::cxxostd::copy_n; using ::cxxomfort::cxxostd::partition_copy; using ::cxxomfort::cxxostd::find_if_not; using ::cxxomfort::cxxostd::is_sorted; using ::cxxomfort::cxxostd::shuffle; //using ::cxxomfort::cxxostd::all_of; //using ::cxxomfort::cxxostd::any_of; //using ::cxxomfort::cxxostd::none_of; //using ::cxxomfort::cxxostd::minmax; //using ::cxxomfort::cxxostd::minmax_element; #endif #if (CXXOMFORT_CXX_STD < 2014 && CXXOMFORT_CXX_EMULATION < 2014) using ::cxxomfort::cxxostd::equal; using ::cxxomfort::cxxostd::mismatch; #endif #if (CXXOMFORT_CXX_STD < 2017 && CXXOMFORT_CXX_EMULATION < 2017) using ::cxxomfort::cxxostd::for_each_n; //using ::cxxomfort::cxxostd::clamp; #endif #if (CXXOMFORT_CXX_STD < 2020 && CXXOMFORT_CXX_EMULATION < 2020) using ::cxxomfort::cxxostd::count; using ::cxxomfort::cxxostd::count_if; #endif #endif #endif /** * @page std0algorithm <algorithm> * @brief Backports related to Standard header <tt><algorithm></tt> * * @code * #include <cxxomfort/algorithm.hpp> * @endcode * * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>) * * Interfaces defined in this section: * * * @c all_of(), @c any_of(), @c none_of() (C++11) - check if elements of a sequence fit a predicate. * * @c copy_if(), @c copy_n(), @c partition_copy() (C++11) - copy elements from a sequence. * * @c find_if_not() (C++11) - check if elements @e don't fit a predicate. * * @c is_permutation(), @c next_permutation(), @c prev_permutation() (C++11) - check the sorting status of a sequence. * * @c is_sorted() (C++11) - check the sorting status of a sequence. * * @c minmax() , @c minmax_element() (C++11) - minimum and maximum elements in a sequence. * * @c equal() , @c mismatch() overloads (C++14) - compare sequences. * * @c clamp() (C++17) - constrain values. * * @c count() , @c count_if() (C++17) - count elements in a sequence. * * @c for_each_n() (C++17) - execute functors across a sequence. * * Pending: * * * @c shuffle * * |
︙ | ︙ | |||
376 377 378 379 380 381 382 | for_each_n( begin(s1), end(s1), print); * @endcode * * For other examples see the following entries in @c cxxomfort-examples : * * * @c randomly.cpp https://notabug.org/lmachucabezzaza/cxxomfort-examples/src/master/examples/randomly.cpp | | | | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | for_each_n( begin(s1), end(s1), print); * @endcode * * For other examples see the following entries in @c cxxomfort-examples : * * * @c randomly.cpp https://notabug.org/lmachucabezzaza/cxxomfort-examples/src/master/examples/randomly.cpp * * <em>More pending...</em> * * @section also See Also * * @see @ref cxxomfort/algorithm.hpp (header reference) * @see @cppref{algorithm} (cppreference) , @ref std0numeric , @ref cxxo-sup-algorithm (supplemental) * * */ |
Changes to cxxomfort/cxxomfort/backports.hpp.
︙ | ︙ | |||
38 39 40 41 42 43 44 45 | #include "numeric.hpp" // <numeric> backports (iota, etc...) #include "random.hpp" // <random> backports (rename fixes, std::random_device, etc...) #include "system_error.hpp" // <system_error> backports #include "tuple.hpp" // <tuple> backports (tuple get<type>, etc...) #include "type_traits.hpp" // <type_traits> backports (common_type, decay, is_literal, is_null_pointer, etc...) //#include "ios.hpp" // <ios> stuff. #endif | > > | 38 39 40 41 42 43 44 45 46 47 | #include "numeric.hpp" // <numeric> backports (iota, etc...) #include "random.hpp" // <random> backports (rename fixes, std::random_device, etc...) #include "system_error.hpp" // <system_error> backports #include "tuple.hpp" // <tuple> backports (tuple get<type>, etc...) #include "type_traits.hpp" // <type_traits> backports (common_type, decay, is_literal, is_null_pointer, etc...) //#include "ios.hpp" // <ios> stuff. //#include "span.php" // <span> stuff. #endif |
Changes to cxxomfort/cxxomfort/config.hpp.
1 2 3 4 5 6 7 8 9 10 11 12 | #ifndef CXXOMFORT_CONFIG_HPP #define CXXOMFORT_CONFIG_HPP /** * @file * @author Luis Machuca Bezzaza * @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 | | | | 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_CONFIG_HPP #define CXXOMFORT_CONFIG_HPP /** * @file * @author Luis Machuca Bezzaza * @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 20200113UL //! Defines the library version //! @warning to be deprecated #define CXXOMFORT_VERSION CXXOMFORT_DATE #include "config/_pre.hpp" #include "config/_support.hpp" /* * Behaviour macros |
︙ | ︙ | |||
386 387 388 389 390 391 392 | #include <cstdio> //! The default namespace of C++ Standard stuff. namespace std {} //! Namespace of the @c cxxomfort library. namespace cxxomfort { | > > > | > > > > > > | > > > > > > | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | #include <cstdio> //! The default namespace of C++ Standard stuff. namespace std {} //! Namespace of the @c cxxomfort library. namespace cxxomfort { /** * @brief Backports made available by cxxomfort. * * Namespace that holds the library's backports of named C++ features. * * @ingroup cxxomfort-cxxostd * */ namespace cxxostd {} /** * @namespace cxxomfort::fix * @brief Fixes for implementation issues in std * * Namespace that holds fixes and alternative implementations or names * for stuff in C++ std that can not be modified or reimplemented. * * See @ref cxxomfort-fix for more details. * * @ingroup cxxomfort-fix * */ namespace fix {} /** * @brief Supplements to backports and other utilities. * 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 { |
︙ | ︙ | |||
483 484 485 486 487 488 489 | * To deal with this, namespace <code>cxxomfort::fix</code> offers a number of * alternatives or "forwarders" for the features in namespace std. These * features either redirect to the @c std one if it's working, or to an implementation * in cxxomfort when they are not. * * Examples of features here: * | | | | > > > > > > > > | 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | * To deal with this, namespace <code>cxxomfort::fix</code> offers a number of * alternatives or "forwarders" for the features in namespace std. These * features either redirect to the @c std one if it's working, or to an implementation * in cxxomfort when they are not. * * Examples of features here: * * * @link cxxomfort::fix::to_byte() @c to_byte() @endlink - * Allows construction of a @c std::byte value pre-C++14 where uniform initialization * is not available, as @c std::byte has no value-taking constructors. * * * @c @ref cxxomfort::fix::hash hash<> - * An extended, extensible version of * @c std::hash from <tt><functional></tt> that forwards to the std one but also * allows implementing extended specializations based on type_traits, etc. * In cxxomfort it is used primarily to provide <tt>hash<enum type></tt>. * * * @link cxxomfort::fix::to_bool @c to_bool(smart_pointer) @endlink - * Access and check to the status of a smart pointer. Equivalent to * <tt>explicit operator bool</tt> in C++>=11. * * * @link cxxomfort::fix::randmo @c randmo(uint) @endlink - * Obtains a "random" number the same way as @c rand does, except it * discards some bias. * * */ #endif |
Changes to cxxomfort/cxxomfort/impl/11-is_xxx_of.hpp.
︙ | ︙ | |||
38 39 40 41 42 43 44 | * @xrefitem std0algorithm "<algorithm> backports" "" */ template< class Iterator, class Predicate > bool any_of(Iterator ini, Iterator fin, Predicate p) { for (; ini != fin; ++ini) { if (p(*ini)) return true; } | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | * @xrefitem std0algorithm "<algorithm> backports" "" */ template< class Iterator, class Predicate > bool any_of(Iterator ini, Iterator fin, Predicate p) { for (; ini != fin; ++ini) { if (p(*ini)) return true; } return false; } /** * @brief Returns @c true if no elements in sequence <var>[ini,fin)</var> comply with predicate @p p . * @param p A predicate (a function that returns @c true or @c false ). * @xrefitem std0algorithm "<algorithm> backports" "" */ |
︙ | ︙ |
Changes to cxxomfort/cxxomfort/impl/n3334-array_ref.hpp.
︙ | ︙ | |||
28 29 30 31 32 33 34 | namespace array_ref { namespace ct = cxxomfort::traits; /** * @brief An object representing a reference or @e slice of a * contiguous area of memory of type @e T . | | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | namespace array_ref { namespace ct = cxxomfort::traits; /** * @brief An object representing a reference or @e slice of a * contiguous area of memory of type @e T . * @anchor cxxo_array_ref * @tparam T Type of the kind of value contained in the view. * @ingroup cxxo-sup * @xrefitem cxxo-sup "Supplements" "Container Supplements" * * A @c array_ref is a non-owning view of a sequence of * *contiguous* elements via a simple {pointer+length} package. * In many ways it could be considered an analogue to |
︙ | ︙ | |||
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | //! Reverse iterator type; potentially writable. typedef std::reverse_iterator<iterator> reverse_iterator; //! Reverse iterator type; view-only. typedef std::reverse_iterator<const_iterator> const_reverse_iterator; public: #ifdef DOXYGEN_DOC constexpr array_ref () noexcept = default; //!< trivial, empty array_ref. constexpr array_ref (array_ref const&) noexcept = default; // //!< trivial copy-ctor. #endif #if (CXXOMFORT_CXX_STD>=2011) constexpr array_ref () noexcept = default; constexpr array_ref (array_ref const&) noexcept = default; #else array_ref () CXXO_NOEXCEPTNOTHROW : ptr_(nullptr), len_(0) {} array_ref (array_ref const& a) CXXO_NOEXCEPTNOTHROW : ptr_(a.ptr_), len_(a.len_) {} #endif | > > > > > > > > > | | > > | | | | | | | > > | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | //! Reverse iterator type; potentially writable. typedef std::reverse_iterator<iterator> reverse_iterator; //! Reverse iterator type; view-only. typedef std::reverse_iterator<const_iterator> const_reverse_iterator; public: // // basic constructors // #ifdef DOXYGEN_DOC constexpr array_ref () noexcept = default; //!< trivial, empty array_ref. constexpr array_ref (array_ref const&) noexcept = default; // //!< trivial copy-ctor. #endif #if (CXXOMFORT_CXX_STD>=2011) constexpr array_ref () noexcept = default; constexpr array_ref (array_ref const&) noexcept = default; constexpr array_ref& operator= (array_ref const&) noexcept = default; #else array_ref () CXXO_NOEXCEPTNOTHROW : ptr_(nullptr), len_(0) {} array_ref (array_ref const& a) CXXO_NOEXCEPTNOTHROW : ptr_(a.ptr_), len_(a.len_) {} #endif // // special constructors // //! This object refers to a buffer of memory pointed by @a p and of size @a len . CXXO_CONSTEXPR array_ref (pointer p, size_t len) CXXO_NOEXCEPTNOTHROW : ptr_(p), len_(len) {} //! This object refers to a buffer of memory constrained by two pointers // (not in original n3334) CXXO_CONSTEXPR array_ref (std::nullptr_t, const_pointer p, const_pointer q) CXXO_NOEXCEPTNOTHROW : ptr_(p), len_(static_cast<size_t>(q-p)) {} //! This object refers to a native C-array. template <size_t N> CXXO_CONSTEXPR explicit array_ref (T(&arr)[N]) CXXO_NOEXCEPTNOTHROW : ptr_(arr), len_(N) {} // view from related non-const view, only for const view, for C++11-onwards #if (CXXOMFORT_CXX_STD >= 2011) template <bool B = std::is_const<T>::value, typename std::enable_if<B,int>::type=0 > array_ref (array_ref< typename std::remove_const<T>::type > const& av) : ptr_(av.ptr_), len_(av.len_) {} #endif //! This object refers to a @c std::array . template <size_t N> CXXO_CONSTEXPR array_ref (std::array<T,N> const& arr) CXXO_NOEXCEPTNOTHROW : ptr_(arr.data()), len_(arr.size()) {} // access to elements //! Unchecked access to the @a i -th element. CXXO_CONSTEXPR14 reference operator[] (size_t i) CXXO_NOEXCEPTNOTHROW { return ptr_[i]; } //! Unchecked access to the @a i -th element. CXXO_CONSTEXPR14 const_reference operator[] (size_t i) const CXXO_NOEXCEPTNOTHROW { return ptr_[i]; } //! Checked access to the @a i -th element; throw. reference at (size_t i) { check_range(i); return ptr_[i]; } //! Checked access to the @a i -th element; throw. const_reference at (size_t i) const { check_range(i); return ptr_[i]; } //! Checked access to the @a i -th element; nonthrow. reference at_or (size_t i, reference rx) { return i < size() ? ptr_[i] : rx; } //! Checked access to the @a i -th element; nonthrow. const_reference at_or (size_t i, const_reference rx) const { return i < size() ? ptr_[i] : rx; } #if (CXXOMFORT_CXX_STD>=2011) //! Checked access to i-th element; sets up an @c error_code if the index is out of range. const_reference at (size_t i, std::error_code& ec) const { check_range(i,ec); return ptr_[i]; } #endif |
︙ | ︙ |
Changes to cxxomfort/cxxomfort/impl/typesafe_enum-core.hpp.
︙ | ︙ | |||
41 42 43 44 45 46 47 | typedef inner inner_type; typedef typename std::conditional< std::is_enum<inner>::value , typename std::underlying_type< /*inner*/ typename def::type >::type , inner >::type underlying_type; public: | > > > | | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | typedef inner inner_type; typedef typename std::conditional< std::is_enum<inner>::value , typename std::underlying_type< /*inner*/ typename def::type >::type , inner >::type underlying_type; public: // as per standard sections 3.9.9, 8.5.5, 8.5.7 and 8.5.10 together, see https://stackoverflow.com/questions/17630967/user-defined-c11-enum-class-default-constructor // an enum class is def-ctible as if it was value-initialized to 0. //CXXO_CONSTEXPR typesafe_enum () CXXO_NOEXCEPTNOTHROW //: val(0) {} CXXO_CONSTEXPR typesafe_enum (inner_type e = static_cast<inner_type>(0) ) CXXO_NOEXCEPTNOTHROW : val(e) {} /* typesafe_enum (::cxxomfort::detail::explicit_cast<typesafe_enum> const& e) : val (e) {} */ |
︙ | ︙ |
Changes to cxxomfort/cxxomfort/iterator.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 36 37 38 39 40 41 | #include "base.hpp" #include CXXO_INCLUDE_SYS(iterator) #include "base/iterator.hpp" namespace cxxomfort { namespace cxxostd { struct contiguous_iterator_tag : public std::random_access_iterator_tag {}; } } #if (defined( CXXOFLAG_NO_STD_USING ) && CXXOFLAG_NO_STD_USING>0) #else namespace std { using ::cxxomfort::cxxostd::contiguous_iterator_tag; } #endif // // make_reverse_iterator // (taken from cppreference.com sample code) // namespace cxxomfort { namespace cxxostd { template <typename It> CXXO_CONSTEXPR std::reverse_iterator<It> make_reverse_iterator (It i) { return std::reverse_iterator<It>(i); } } } | > > > > > > > > > > | 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 | #include "base.hpp" #include CXXO_INCLUDE_SYS(iterator) #include "base/iterator.hpp" namespace cxxomfort { namespace cxxostd { /** * @brief A tag type that describes contiguous access iterators. * */ struct contiguous_iterator_tag : public std::random_access_iterator_tag {}; } } #if (defined( CXXOFLAG_NO_STD_USING ) && CXXOFLAG_NO_STD_USING>0) #else namespace std { using ::cxxomfort::cxxostd::contiguous_iterator_tag; } #endif // // make_reverse_iterator // (taken from cppreference.com sample code) // namespace cxxomfort { namespace cxxostd { /** * @brief Constructs the reverse_iterator for a given iterator. * @ingroup cxx14-backports * @see https://en.cppreference.com/w/cpp/iterator/make_reverse_iterator * * */ template <typename It> CXXO_CONSTEXPR std::reverse_iterator<It> make_reverse_iterator (It i) { return std::reverse_iterator<It>(i); } } } |
︙ | ︙ | |||
56 57 58 59 60 61 62 | // // contiguous_access, contiguous_access_iterator // namespace cxxomfort { namespace fix { | | > > > | > > > > > > > > | 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 | // // contiguous_access, contiguous_access_iterator // namespace cxxomfort { namespace fix { /** * @brief Tags an iterator as a contiguous access type iterator. * * Given an iterator type I, indicates whether the type either: * * * matches the @c contiguous_iterator_tag tag * * or represents access to a contiguous area of memory, like an array * * Pre C++17, this can only be implemented as an heuristic and can not * determine contiguousness of storage types where the iterator is * being wrapped, in hwich cases it will always declare @c false . * * One such example is <tt><array></tt> and <tt><vector></tt> iterators * in MSVC, in versions that don't support disabling the debug iterator mode. * */ template <typename Iterator, typename Tag= typename std::iterator_traits<Iterator>::iterator_category > struct is_contiguous_access_iterator { enum { value= 0, specialized= 0 }; }; template <typename Iterator> |
︙ | ︙ | |||
83 84 85 86 87 88 89 | } } #endif /** * @page std0iterator <iterator> | | > > > > > | | | > > > | | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | } } #endif /** * @page std0iterator <iterator> * @brief Backports related to Standard header <tt><iterator></tt> * * @code * #include <cxxomfort/iterator.hpp> * @endcode * * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>) * Interfaces defined in this section: * * * @c begin() , @c end() accessors (C++11). * * @c rbegin() , @c rend() accessors (C++14). * * @c cbegin() , @c cend() accessors (C++14). * * @c make_reverse_iterator() (C++14). * * @c size() accessor (C++17). * * @c data() accessor (C++17). * * @c empty() accessor (C++17). * * @c contiguous_iterator_tag (C++20). * * Non-backport interfaces (<tt>cxxomfort::fix</tt>): * * * @link cxxomfort::fix::is_contiguous_access_iterator <tt>is_contiguous_access_iterator</tt> @endlink - A check for contiguous access iterators. * * @subsection Contiguous Access Iterator * * @e PENDING * * @subsection also See Also * * * @see @cppref{header/iterator} (cppreference) * * @see @ref cxxo-sup-iterator * * */ |
Changes to cxxomfort/cxxomfort/library/algorithm.hpp.
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | * @file cxxomfort/library/algorithm.hpp * @brief cxxomfort Supplementals for <algorithm> * @xrefitem cxxo-sup-algorithm * */ #include <cxxomfort/impl/valcomp.hpp> namespace cxxomfort { namespace library { namespace algorithm { /** * @ingroup cxxo-sup-algorithm * @{ */ // copy_leftmost_n is simply copy_n /** * @brief Copy like @c copy_if with inverted predicate (for symmetry with @c find_if_not ). * @xrefitem cxxo-sup-algorithm "cxxo-sup-algorithm" "Copying" * | > > > > | 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 | * @file cxxomfort/library/algorithm.hpp * @brief cxxomfort Supplementals for <algorithm> * @xrefitem cxxo-sup-algorithm * */ #include <cxxomfort/impl/valcomp.hpp> namespace cxxomfort { namespace library { namespace algorithm { /** * @ingroup cxxo-sup-algorithm * @{ */ using cxxomfort::impl::valcmp; // copy_leftmost_n is simply copy_n /** * @brief Copy like @c copy_if with inverted predicate (for symmetry with @c find_if_not ). * @xrefitem cxxo-sup-algorithm "cxxo-sup-algorithm" "Copying" * |
︙ | ︙ | |||
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | using namespace std; return find_if(ini,fin, bind(if_,placeholders::_1,v) ); } /** * @brief Finds the first element in the sequence not equal to @e t . * @return An iterator, or @e fin . * @see @c find() * * This is provided for homology with: * <tt>std::find</tt>, <tt>std::find_if_not</tt>. * * */ template <typename It, typename T> It find_not (It ini, It fin, T const& t) { for (; ini != fin; ++ini) { if (t==*ini) {} else { return ini; } } return fin; } /** * @brief Finds the first element in the sequence not fitting predicate @e if_ . * @return An iterator, or @e fin . * @see @c find_if() * */ template <typename It, typename Pred> It find_if_not (It ini, It fin, Pred if_) { using namespace std; return find_if (ini,fin,not1(if_)); } /** * @brief Finds a pair of elements that are out of place (ie.: the second one is "less" than the first). * @return Iterator pointing to the first such element, or @a fin if none. * @xrefitem cxxo-sup-algorithm "" "Sorting" * * For example, for the following example @c find_inversion will return an iterator pointing to the element 6: * * @code vector<int> elems = { -17, 3, 6, -2, -3, -4 }; | > > | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | using namespace std; return find_if(ini,fin, bind(if_,placeholders::_1,v) ); } /** * @brief Finds the first element in the sequence not equal to @e t . * @return An iterator, or @e fin . * @xrefitem cxxo-sup-algorithm "cxxo-sup-algorithm" "Searching" * @see @c find() * * This is provided for homology with: * <tt>std::find</tt>, <tt>std::find_if_not</tt>. * * */ template <typename It, typename T> It find_not (It ini, It fin, T const& t) { for (; ini != fin; ++ini) { if (t==*ini) {} else { return ini; } } return fin; } /** * @brief Finds the first element in the sequence not fitting predicate @e if_ . * @return An iterator, or @e fin . * @xrefitem cxxo-sup-algorithm "cxxo-sup-algorithm" "Searching" * @see @c find_if() * */ template <typename It, typename Pred> It find_if_not (It ini, It fin, Pred if_) { using namespace std; return find_if (ini,fin,not1(if_)); } /** * @brief Finds a pair of elements that are out of place (ie.: the second one is "less" than the first). * @return Iterator pointing to the first such element, or @a fin if none. * @xrefitem cxxo-sup-algorithm "" "Sorting" * * For example, for the following example @c find_inversion will return an iterator pointing to the element 6: * * @code vector<int> elems = { -17, 3, 6, -2, -3, -4 }; // ^ sorting order is broken in this pair vector<int>::iterator br = find_inversion( begin(elems), end(elems) ); * @endcode * * See also: @c fix_inversion(). * **/ |
︙ | ︙ | |||
271 272 273 274 275 276 277 | } /** * @brief Transform elements in the range conditionally. * @param tf A transformation of the form <code>TF(*FIter) -> *FIter</code>. * @param p a predicate to decide if the elements need transformation. * @return The @e end iterator of the sequence. | | | | 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | } /** * @brief Transform elements in the range conditionally. * @param tf A transformation of the form <code>TF(*FIter) -> *FIter</code>. * @param p a predicate to decide if the elements need transformation. * @return The @e end iterator of the sequence. * @xrefitem cxxo-sup-algorithm "" "Transforms" * * This is provided for homology with: * <tt>std::copy_if</tt> * */ template <typename FIter, typename TF, typename P> FIter transform_inplace_if (FIter ini, FIter fin, TF tf, P p) { for (; ini != fin; ++ini) { if (p(*ini)) *ini= tf(*ini); } return ini; } /** * @brief Transform elements up to n times * @param tf A transformation of the form <code>TF(*FIter) -> *FIter</code>. * @xrefitem cxxo-sup-algorithm "" "Transforms" * * This is provided for homology with: * <tt>std::copy_n</tt>. * */ template <typename IIterator, typename OIterator, typename TF, typename Integer> inline OIterator transform_n (IIterator ini, Integer n, OIterator dest, TF tf) { |
︙ | ︙ | |||
398 399 400 401 402 403 404 | * @code * #include <cxxomfort/library/algorithm.hpp> * * namespace algorithm2 = cxxomfort::library::algorithm; * * @endcode * | | | > | > | 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | * @code * #include <cxxomfort/library/algorithm.hpp> * * namespace algorithm2 = cxxomfort::library::algorithm; * * @endcode * * This component provides supplementary features for the set of * algorithms present in <code><algorithm></code> that are * specific to cxxomfort, as well as functions that complete the * family of <code>_n</code> functions such as <code>transform_n</code>. * * Interfaces defined here: * * * @c valcmp() - compares two values the way eg.: @c memcmp does. * * @c copy_leftmost_n() , @c copy_rightmost_n () - copies from either end of a sequence. * * @c copy_if_not() - complementary to @c find_if_not . * * @c count_while() - counts elements in a sequence. * * @c find_not() , @c find_if_not() - complements to @c find() , from p1223. * * binary predicate form @c find() , from lwg127. * * @c find_inversion() - finds elements out of place in a sequence. * * @c find_last_if() - finds elements matching a predicate. * * @c transform_inplace() , @c transform_inplace_if() - transforms sequences in-place. * * @c transform_n() - transforms sequences. * * @c count_frequencies_map() , @c count_frequencies() - gathers data frequency in a sequence. * * @c relative_search() - finds element ranges matching a differential. * * @c lfv2::erase() , @c lfv2::erase_if() from Fundamentals V2 - simplified erase-remove idiom for sequence containers. * * * All interfaces are defined in the namespace * <tt>cxxomfort::library::algorithm::</tt>. * * See also: @ref std0algorithm . * * */ |
Changes to cxxomfort/cxxomfort/library/functional.hpp.
︙ | ︙ | |||
43 44 45 46 47 48 49 | template <typename R> nullary_function_ptrt<R> ptr_fun (R(* const function)()) { return nullary_function_ptrt<R>(function); } //! Generic no-op functor, for wrapping "unset" eg.: @c function , @c function_ref . struct noop_t { | | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | template <typename R> nullary_function_ptrt<R> ptr_fun (R(* const function)()) { return nullary_function_ptrt<R>(function); } //! Generic no-op functor, for wrapping "unset" eg.: @c function , @c function_ref . struct noop_t { CXXO_CONSTEXPR void operator() (...) const CXXO_NOEXCEPTNOTHROW { } }; #if (CXXOMFORT_CXX_STD>=2014) constexpr const noop_t noop = {}; #else const noop_t noop = {}; |
︙ | ︙ | |||
66 67 68 69 70 71 72 | // // equivalent_to // /** * @brief Function object that performs equivalence comparison: | | > > > > > > > > > > > > > > | | > > | > | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | // // equivalent_to // /** * @brief Function object that performs equivalence comparison: * arguments are "equivalent" * if they are not less or greater than each other. Or, * alternatively, if neither is less than the other. * * Given a functor @a eq: * * @code equivalent_to<T> eq; T foo, bar; eq(foo,bar) == !less(foo,bar) && !greater(foo,bar) == !less(foo,bar) && !less(bar,foo) // note the above relationship does not necessarily imply!: eq(foo,bar) == equal_to(foo,bar) * @endcode * * See also: @c @cppref{utility/functional/equal_to} * * */ template <typename T, typename Ord = std::less<T> > struct equivalent_to { typedef bool result_type; CXXO_CONSTEXPR14 bool operator() (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { /*static*/ const Ord ord; return !(ord(vl,vr)) && !(ord(vr,vl)); } }; template<typename T> struct equivalent_to<void,Ord> { typedef bool result_type; template <typename T> CXXO_CONSTEXPR14 bool operator() (T const& vl, T const& vr) CXXO_NOEXCEPTNOTHROW { /*static*/ const Ord ord; return !ord(vl,vr) && !ord(vr,vl); } }; //! Generates an equivalence comparison functor on the fly. CXXO_CONSTEXPR14 static inline equivalent_to<void> make_equivalence () CXXO_NOEXCEPTNOTHROW { return equivalent_to<void>(); } |
︙ | ︙ | |||
144 145 146 147 148 149 150 | T const value; CXXO_CONSTEXPR14 constant_function (T const& t) : value(t) {} T const& operator() (...) const CXXO_NOEXCEPT { return value; } }; | > > > > > > | | | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | T const value; CXXO_CONSTEXPR14 constant_function (T const& t) : value(t) {} T const& operator() (...) const CXXO_NOEXCEPT { return value; } }; template <typename T> inline constant_function<T> constant_fn (T& const t) { return constant_function<T>(t); } CXXO_CONSTEXPR14 const constant_function<bool> true_fn (true); CXXO_CONSTEXPR14 const constant_function<bool> false_fn (false); } // .functional: }} #include "operatorit.hpp" // supplement operator functors |
︙ | ︙ | |||
184 185 186 187 188 189 190 | #endif // end of file /** * @page cxxo-sup-functional * @brief Supplements to <functional>. * | > > > > > > > | | > | > > > | | | > > > > > > | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | #endif // end of file /** * @page cxxo-sup-functional * @brief Supplements to <functional>. * * @code * #include <cxxomfort/library/functional.hpp> * * namespace functional2 = cxxomfort::library::functional; * * @endcode * * This component offers a number of alternatives and supplements to features found in * <code><functional></code> such as function objects to complete various tasks, * a function-like reference wrapper, and * function objects that complement the <code>plus</code> family. * * * @c #noop - an object that does nothing with its arguments. * * @c ptr_fun() for nullary functions. * * Supplements to named operators: * * <code>@ref preincrement</code> , @c predecrement . * * Operator+assignment operators @c plus_it , @c minus_it , @c multiplies_it , @c divides_it , @c modulus_it . * * Function object @c equivalent_to ("not less or greater"). * * @c is_std_function . * * @c constant_function . * * The assist functions @c true_fn() , @c false_fn() and @c constant_fn() that create specific constants. * * @c #functiontype - meta information on function signatures. * * @c #function_caller - zero-cost function object calling a named C function. * * @c #function_ref - non-owning reference to a function-like callable. * * * @section Supplement Operators * * Given a Standard C++ operator wrapper like <code>std::plus</code>, which wraps <code>operator+()</code>, * cxxomfort also provides an analogue <code>@ref plus_it</code> which wraps <code>operator+=()</code>. * That is, they operate in the following way: * * @code plus<float> p; plus_it<float,float> pa; // plus_assign float r = p(3, M_PI); // same as r = 3 + M_PI; pa(r, -4.12); // same as r+= -4.12; * @endcode * * The cxxomfort supplemental functor @c equivalent_to tests for potential "equivalence" between two objects - that is, none is less than the other. * * @section function_caller * */ |
Changes to cxxomfort/cxxomfort/library/iterator.hpp.
1 2 3 4 5 6 7 8 | #ifndef CXXOMFORT_SUPP_ITERATOR_HPP #define CXXOMFORT_SUPP_ITERATOR_HPP #include <cxxomfort/config.hpp> #include <cxxomfort/base.hpp> #include <iterator> #include <functional> #include <cxxomfort/iterator.hpp> #include <cxxomfort/functional.hpp> | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #ifndef CXXOMFORT_SUPP_ITERATOR_HPP #define CXXOMFORT_SUPP_ITERATOR_HPP #include <cxxomfort/config.hpp> #include <cxxomfort/base.hpp> #include <iterator> #include <functional> #include <cxxomfort/iterator.hpp> #include <cxxomfort/functional.hpp> //#include <cxxomfort/impl/n3334-array_ref.hpp> #include <cxxomfort/impl/p1227r0-ssize.hpp> // ssize /** * @file * @ingroup cxxo-sup-iterator */ |
︙ | ︙ | |||
117 118 119 120 121 122 123 | }; template <typename I, typename F> function_iterator<I,F> make_function_iterator(I const& i, F & f) { return function_iterator<I,F>(i,f); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | }; template <typename I, typename F> function_iterator<I,F> make_function_iterator(I const& i, F & f) { return function_iterator<I,F>(i,f); } #if 1 /** * @class container_extensions_view * @brief A view into a container that adds extra member functions. * * A @c container_extensions_view initialized to a given container * @a c , adds a number of member functions that are cxxomfort extensions * or are otherwise not readily available. * * * <tt>.at_or (index, object&)</tt> -- returns a reference to the element at position @a index , or @a object if none is found. * * <tt>.contiguous ()</tt> -- determines if the container uses continuous storage. Currently unimplemented, returns @c false . * * */ template <typename Cont, typename = void> struct container_extensions_view { typedef Cont container_type; typedef typename container_type::value_type value_type; typedef typename container_type::size_type size_type; typedef typename container_type::iterator iterator; typedef typename container_type::const_iterator const_iterator; CXXO_CONSTEXPR explicit container_extensions_view (Cont& c) CXXO_NOEXCEPTNOTHROW : c (c) {} CXXO_CONSTEXPR size_type size () const CXXO_NOEXCEPTNOTHROW { return c.size(); } CXXO_CONSTEXPR iterator begin () { return c.begin(); } CXXO_CONSTEXPR iterator end () { return c.end(); } value_type const& at_or (size_type i, value_type const& o) const CXXO_NOEXCEPTNOTHROW { return i < c.size() ? c[i] : o; } value_type & at_or (size_type i, value_type & o) CXXO_NOEXCEPTNOTHROW { return i < c.size() ? c[i] : o; } private: // std::reference_wrapper<Cont> c; Cont& c; }; template <typename Cont> CXXO_CONSTEXPR container_extensions_view<Cont const> ccexview (Cont const& c) CXXO_NOEXCEPTNOTHROW { return container_extensions_view<Cont const> (c); } template <typename Cont> container_extensions_view<Cont> cexview (Cont & c) CXXO_NOEXCEPT { return container_extensions_view<Cont> (c); } #endif // container // iterator } // cxxomfort::library } } // // extensions to cxxomfort::fix::contiguous_access // #include <vector> #include <string> |
︙ | ︙ | |||
155 156 157 158 159 160 161 | template<> struct is_contiguous_access_iterator <std::wstring::iterator> { enum { value = (__cplusplus>=201103L), specialized = 1 }; }; | | > > > > > > > > | | > > > > > | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | template<> struct is_contiguous_access_iterator <std::wstring::iterator> { enum { value = (__cplusplus>=201103L), specialized = 1 }; }; } } // namespace cxxomfort::fix /** * @page cxxo-sup-iterator * @ingroup cxxo-sup * * @code * #include <cxxomfort/library/iterator.hpp> * * namespace iterator2 = cxxomfort::library::iterator; * * @endcode * * This component provides supplementary features for * the utilities found in <tt><iterator></tt>. * * Interfaces defined here: * * * @c absdistance() . * * @c ssize() from p1227r0. (to be moved to std) * * @c fake_iterator and @c make_fake_iterator() . * * @c function_iterator and @c make_function_iterator() . * * @c container_extensions_view . * * All interfaces are defined in the namespace * <tt>cxxomfort::library::iterator::</tt>. * * @see * * @ref std0iterator * */ #endif |
Changes to cxxomfort/cxxomfort/library/utility.hpp.
1 2 3 4 5 6 7 8 9 10 11 12 | #ifndef CXXOMFORT_LIBRARY_UTILITY_HPP #define CXXOMFORT_LIBRARY_UTILITY_HPP /** * @file * * Interfaces defined in this file: * * * */ #include <cxxomfort/type_traits.hpp> #include <cxxomfort/utility.hpp> // pair #include <cxxomfort/impl/relationals.hpp> | | > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #ifndef CXXOMFORT_LIBRARY_UTILITY_HPP #define CXXOMFORT_LIBRARY_UTILITY_HPP /** * @file * * Interfaces defined in this file: * * * */ #include <cxxomfort/type_traits.hpp> #include <cxxomfort/utility.hpp> // pair #include <cxxomfort/impl/relationals.hpp> #include <cxxomfort/impl/valcomp.hpp> namespace cxxomfort { namespace library { namespace utility { using cxxomfort::impl::valcmp; template <unsigned I> struct prio : prio <I-1> {}; template <> struct prio<0> {}; |
︙ | ︙ | |||
152 153 154 155 156 157 158 | * #include <cxxomfort/library/utility.hpp> * * namespace utility2 = cxxomfort::library::utility; * * @endcode * | | > | | > | 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 | * #include <cxxomfort/library/utility.hpp> * * namespace utility2 = cxxomfort::library::utility; * * @endcode * * This component provides supplementary features for the set of * facilities present in <code><utility></code> that are * specific to cxxomfort. * * Interfaces defined here: * * * @c valcmp() - compares two values the way eg.: @c memcmp does. * * @c v_in_place_type(), @c v_in_place_index() . * * @c @link cxxomfort::library::utility::strict_type strict_type @endlink . * * @c #simple_pair . * * TBA: * * * @c null_device() . * * * All interfaces are defined in the namespace * <tt>cxxomfort::library::utility::</tt>. * * See also: @ref std0utility . * */ |
Changes to cxxomfort/cxxomfort/memory.hpp.
︙ | ︙ | |||
56 57 58 59 60 61 62 63 64 65 66 67 68 69 | // 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 { | > > > > > > > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | // aligned_union // // // default_delete // #ifdef DOXYGEN_DOC namespace cxxomfort { namespace cxxostd { //! Backport of @c default_delete template <typename T> struct default_delete {}; }} #endif #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 { |
︙ | ︙ | |||
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 | #include "impl/p0040-memory_management.hpp" // // cxxomfort::fix assist: to_bool // #if (CXXOMFORT_CXX_STD>=2011 || CXXOMFORT_CXX_EMULATION>=2011) #if (CXXOFLAG_tr1) // 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 #endif #endif #if defined(CXXOMFORT_USING_unique_ptr) // assist namespace cxxomfort { namespace fix { template <typename T> bool to_bool (std::unique_ptr<T> const& p) CXXO_NOEXCEPTNOTHROW { return p.get() != nullptr; } } } // cxxomfort::fix | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | #include "impl/p0040-memory_management.hpp" // // cxxomfort::fix assist: to_bool // #ifdef DOXYGEN_DOC namespace cxxomfort { namespace fix { /** * @brief @c bool validity check for a @c shared_ptr . * @returns @c true if the smart pointer is currently engaged. * @ingroup cxxomfort-fix * * @see shared_ptr's explicit @c bool operator. * * */ template <typename T> inline bool to_bool (std::shared_ptr<T> const& p) CXXO_NOEXCEPTNOTHROW; /** * @brief @c bool validity check for a @c unique_ptr . * @returns @c true if the smart pointer is currently engaged. * @ingroup cxxomfort-fix * * @see unique_ptr's explicit @c bool operator. * * */ template <typename T> inline bool to_bool (std::unique_ptr<T> const& p) CXXO_NOEXCEPTNOTHROW; } } #endif // DOXYGEN_DOC #if (CXXOMFORT_CXX_STD>=2011 || CXXOMFORT_CXX_EMULATION>=2011) #if (CXXOFLAG_tr1) // 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 #endif #endif #if defined(CXXOMFORT_USING_unique_ptr) // assist namespace cxxomfort { namespace fix { template <typename T> bool to_bool (std::unique_ptr<T> const& p) CXXO_NOEXCEPTNOTHROW { return p.get() != nullptr; } } } // cxxomfort::fix |
︙ | ︙ | |||
285 286 287 288 289 290 291 292 293 294 | }; CXXO_STDTR1_CLOSE() // } /* tr1 */ } #endif #endif #endif // file /** * @page std0memory <memory> | > | > > > > > > > > > > > > | > | | | > > > | | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | }; CXXO_STDTR1_CLOSE() // } /* tr1 */ } #endif #endif #endif // file /** * @page std0memory <memory> * @brief Backports related to Standard Header <memory> * * @code * #include <cxxomfort/memory.hpp> * @endcode * * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>) * Interfaces defined here: * * * @c alignof() (C++11) (See @e base_features ). * * @c addressof() (C++11) - get the memory address of an object. * * Pointer traits and Allocator traits (C++11) - tools for assisting in the design of containers. * * @link cxxomfort::cxxostd::aligned_storage @c aligned_storage @endlink </code> (C++11) - create an unitialized buffer for storing an object of a given type. * * @link cxxomfort::cxxostd::unique_ptr @c unique_ptr @endlink (C++11) - smart pointer that owns and holds a resource. * * @c make_unique() (C++14) - assist for creating @c unique_ptr . * * @c destroy() , @c destroy_at() (C++17) - memory management by calling destructors. * * Interfaces repointed here when in TR1: * * * @c std::shared_ptr and related utilities. * * @c std::weak_pre and related utilities. * * * Non-backport interfaces (<tt>cxxomfort::fix</tt>): * * * <tt>to_bool()</tt> overloads: * * <tt>to_bool(std::shared_ptr const&)</tt> - briefer validity check to @c bool . * * <tt>to_bool(std::unique_ptr const&)</tt> - briefer validity check to @c bool . * * <tt>#cxxomfort::fix::malloc_deleter</tt>. * * @note <b>Cxxomfort</b> expects an implementation of <tt>std::shared_ptr</tt> * to exist and work in order, as part of the general TR1 requirement. * * @subsection also See Also * * * @see @cppref{header/memory} (cppreference) * * */ |
Changes to cxxomfort/cxxomfort/system_error.hpp.
︙ | ︙ | |||
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | // // error_category and helpers // class error_category; static error_category const& generic_category() CXXO_NOEXCEPTNOTHROW; static error_category const& system_category() CXXO_NOEXCEPTNOTHROW; // // declare helpers // static error_code make_error_code( errc e ) CXXO_NOEXCEPTNOTHROW; static error_code make_error_code( errc e , error_category const& ec) CXXO_NOEXCEPTNOTHROW; // // error_category and helpers // | > > > > | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | // // error_category and helpers // class error_category; //! Returns an @c error_category used as the category for generic errors. static error_category const& generic_category() CXXO_NOEXCEPTNOTHROW; //! Returns an @c error_category used as the category for system errors. static error_category const& system_category() CXXO_NOEXCEPTNOTHROW; // // declare helpers // //! Create an @c error_code . static error_code make_error_code( errc e ) CXXO_NOEXCEPTNOTHROW; static error_code make_error_code( errc e , error_category const& ec) CXXO_NOEXCEPTNOTHROW; // // error_category and helpers // |
︙ | ︙ | |||
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | public: CXXO_DEFAULT_DEFAULT_CONSTRUCTOR(error_category); CXXO_DELETED_COPY_CONSTRUCTOR(error_category); virtual ~error_category () {}; CXXO_DELETED_COPY_ASSIGN(error_category); virtual const char* name () const CXXO_NOEXCEPTNOTHROW = 0; virtual std::string message (int condition ) const = 0; virtual error_condition default_error_condition (int code ) const CXXO_NOEXCEPTNOTHROW; virtual bool equivalent (int code, error_condition const& condition ) const CXXO_NOEXCEPTNOTHROW; | > > | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | public: CXXO_DEFAULT_DEFAULT_CONSTRUCTOR(error_category); CXXO_DELETED_COPY_CONSTRUCTOR(error_category); virtual ~error_category () {}; CXXO_DELETED_COPY_ASSIGN(error_category); //! Deriveds implement a naming schema for the category here. virtual const char* name () const CXXO_NOEXCEPTNOTHROW = 0; //! Deriveds provide a descriptive message about the error here. virtual std::string message (int condition ) const = 0; virtual error_condition default_error_condition (int code ) const CXXO_NOEXCEPTNOTHROW; virtual bool equivalent (int code, error_condition const& condition ) const CXXO_NOEXCEPTNOTHROW; |
︙ | ︙ | |||
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 | private: }; CXXO_GENERATE_RELATIONALS(error_category); struct generic_category_t : public error_category { ~generic_category_t () {} const char* name () const CXXO_NOEXCEPTNOTHROW { return "generic"; } std::string message (int condition) const { return std::string(name()) + ": " + strerror(condition); } }; //! Obtains a reference to the @c error_category object for generic errors. static inline error_category const& generic_category() CXXO_NOEXCEPTNOTHROW { static generic_category_t g; return g; } struct system_category_t : public error_category { ~system_category_t () {} const char* name () const CXXO_NOEXCEPTNOTHROW { return "system"; } std::string message (int condition) const { | > > > > > > > | 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 | private: }; CXXO_GENERATE_RELATIONALS(error_category); /** * @brief Type that describes the category for generic errors. * */ struct generic_category_t : public error_category { ~generic_category_t () {} const char* name () const CXXO_NOEXCEPTNOTHROW { return "generic"; } std::string message (int condition) const { return std::string(name()) + ": " + strerror(condition); } }; //! Obtains a reference to the @c error_category object for generic errors. static inline error_category const& generic_category() CXXO_NOEXCEPTNOTHROW { static generic_category_t g; return g; } /** * @brief Type that describes the category for system errors. * */ struct system_category_t : public error_category { ~system_category_t () {} const char* name () const CXXO_NOEXCEPTNOTHROW { return "system"; } std::string message (int condition) const { |
︙ | ︙ | |||
511 512 513 514 515 516 517 | #endif // CXXOMFORT_CXX_STD #endif /** * @page std0system_error <system_error> * | | > > > > > > > > > > | | | > | | | > > > > > > > > > > | | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | #endif // CXXOMFORT_CXX_STD #endif /** * @page std0system_error <system_error> * * @brief Backports and interfaces related to Standard header <tt><system_error></tt> * * @code * #include <cxxomfort/system_error.hpp> * @endcode * * (or automatically by including <tt><cxxomfort/backports.hpp></tt> / <tt><cxxomfort/cxxomfort.hpp></tt>) * * In new C++, <tt><system_error></tt> provides general facilities for * dealing with error codes and categorization of error types * using a schema alternative and complimentary to eg.: exceptions. * * Interfaces defined in this file: * * * @link cxxomfort::cxxostd::errc @c errc @endlink - enumerator for error codes. * * @c error_category() , @c generic_category() , @c system_category() . * * @link cxxomfort::cxxostd::error_condition @c error_condition @endlink . * * @c @ref cxxomfort::cxxostd::error_code "error_code" . * * @c make_error_code() * * POSIX error codes that might be missing in some compilers (eg.: older versions of MSVC). * * Non-backport interfaces (<tt>cxxomfort::fix</tt>): * * * @link cxxomfort::fix::errc @c errc @endlink - Alias to @c errc::errc in MSVC 2010, normal @c std::errc otherwise. * * @c to_errc() - Create an @c errc value from a native integer. * * @subsection errc codes * * @e Pending * * @subsection Client Code * * For sections of cxxomfort making use of these facilities * (even in C++03 mode), see: @link cxxo-sup-iterator @endlink , <tt>at_or</tt>, * @ref fixed_vector , @ref cxxo_array_ref . * * @subsection See Also * * * @cppref{header/system_error} * * @cppref{error/errc} (definition and values of the enumeration type) * * * */ |
Changes to cxxomfort/tags/cxxomfort-macros.cpp.tags.
1 2 3 4 5 6 7 8 9 10 11 | #format=pipe # Geany Tags file for the cxxomfort library. # cxxomfort backports features of more advanced C++ standards to # previous versions, and adds some convenience features. # # Fossil Repo: http://ryan.gulix.cl/fossil.cgi/cxxomfort # # @author Luis Machuca Bezzaza <luis.machuca@gulix.cl> # @version 2 # Tags for cxxomfort information CXXOMFORT_DATE|unsigned long: yyyymmdd|| | < | | | | | 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 | #format=pipe # Geany Tags file for the cxxomfort library. # cxxomfort backports features of more advanced C++ standards to # previous versions, and adds some convenience features. # # Fossil Repo: http://ryan.gulix.cl/fossil.cgi/cxxomfort # # @author Luis Machuca Bezzaza <luis.machuca@gulix.cl> # @version 2 # Tags for cxxomfort information CXXOMFORT_DATE|unsigned long: yyyymmdd|| CXXOMFORT_COMPILER_ID|unsigned int|| CXXOMFORT_COMPILER_VERSION|unsigned int|| CXXOMFORT_COMPILER_VERSION_FULL|unsigned long long|| # Tags for cxxomfort support and configuration CXXOMFORT_CXX_STD|unsigned int: yyyy (year of STD)|| CXXOMFORT_CXX_EMULATION|unsigned int: yyyy (year of STD)|| CXXOMFORT_NOTICES|int|noticelevel| CXXO_NOTICE||("message")| CXXO_WARNING||("warning")| CXXOFLAG_SHADOW_KEYWORD_constexpr||| CXXOFLAG_INCLUDE_PATH||| #code generation CXXO_COMPILERVERSION_COMPARE|BOOL|(compilerid_, <=> version_)| CXXOMFORT_CXX11_CODE|code...|(cxx11onward_code,cxx03upto_code)| CXXOMFORT_CXX14_CODE|code...|(cxx14onward_code,cxx11upto_code)| CXXOMFORT_CXX17_CODE|code...|(cxx17onward_code,cxx14upto_code)| CXXO_AUTO|type?|(name , expression)| CXXO_I12N_BEG|expr...|(Sequence_Type , Variable_Name)| CXXO_I12N_END|expr...|(Sequence_Type , Variable_Name)| CXXO_I12N_SEQ|expr...|(Sequence_Type , Variable_Name , { sequence...})| CXXO_LOCALFN||(Signature)(arguments...){...}| CXXO_LOCALFN_NAME_DEF||(Name,Signature)| CXXO_TYPEOF|type?|(expression)| CXXO_CONSTEXPR|expr?|| CXXO_CONSTEXPR14|expr?|| CXXO_DECLTYPE|type?|(expression)| CXXO_DEFAULT_DEFAULT_CONSTRUCTOR|default_ctor_expression|(T)| CXXO_DISABLE_DEFAULT_CONSTRUCTOR|private_expr|(T)| CXXO_EXPLICIT_OPERATOR|code...|(Target_Type)| CXXO_FOREACH|expr...|(key , sequence)| CXXO_GENERATE_RELATIONALS|code...|(Type)| CXXO_GENERATE_RELATIONALS_T|code...|(Type with TPARAMS and TARGS)| CXXO_NOEXCEPT|expr?|| CXXO_NOEXCEPTNOTHROW|expr?|| CXXO_NOEXCEPT_COND|expr?|(conditional)|| CXXO_PSEUDOVARIADIC_MEMBER||(prefix,func_name,suffix)| |
Changes to cxxomfort/tags/cxxomfort.cpp.tags.
1 2 3 4 5 6 7 8 | #format=pipe # Geany Tags file for the cxxomfort library. # cxxomfort backports features of more advanced C++ standards to # previous versions, and adds some convenience features. # # Fossil Repo: http://ryan.gulix.cl/fossil.cgi/cxxomfort # # @author Luis Machuca Bezzaza <luis.machuca@gulix.cl> | | < < > > > > | 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 | #format=pipe # Geany Tags file for the cxxomfort library. # cxxomfort backports features of more advanced C++ standards to # previous versions, and adds some convenience features. # # Fossil Repo: http://ryan.gulix.cl/fossil.cgi/cxxomfort # # @author Luis Machuca Bezzaza <luis.machuca@gulix.cl> # @version 3 #library general arrayref|array_ref<T>|(T&[N])| carrayref|array_ref<T const>|(T[N])| carrayref|array_ref<T const>|(array_ref)| seq_|"sequence type"|<T>(...sequence of T)| to_byte|std::byte|(Integral byte)| to_errc|std::errc|(integral_errc_value)| typeid_demangle|std::string|(typeid construct)| type_name|std::string_view|<T>() [parametrized on T]| #algorithm copy_leftmost_n|ItDest|(ItSrc ini, ItSrc fin, Integer n, ItDest dest)| copy_rightmost_n|ItDest|(ItSrc ini, ItSrc fin, Integer n, ItDest dest)| count_frequencies_map|Iterator|(Iterator ini, Iterator fin, ValueMapIndex[]& v)| find_inversion|Iterator|(Iterator ini, Iterator fin, Comparison less)| find_last_if|Iterator|(Iterator ini, Iterator fin, Predicate f)| find_not|Iterator|(Iterator ini, Iterator fin, Value t)| find_if_not|Iterator|(Iterator ini, Iterator fin, Predicate f)| transform_inplace|Iterator|(Iterator ini, Iterator fin, Function f)| transform_inplace_if|Iterator|(Iterator ini, Iterator fin, Function f, Predicate p)| transform_n|Iterator|(Iterator ini, Integer n, DestIterator out, Function f)| #functional ptr_fun|nullary_functor|(Ret(*fn)())| constant_fn|constant_function<T>|(T t)| make_equivalence|equivalent_to<void>|()| fnref|function_ref<Signature>|(function or functoid name)| #iterator ssize|ptrdiff_t|(Object&)| make_fake_iterator|fake_iterator|(T const& t)| cexview|container_extension_view<Container>|(Container &)| ccexview|container_extension_view<Container const>|(Container const &)| #memory to_bool|bool|(unique_ptr<T> const& resource)| to_bool|bool|(shared_ptr<T> const& resource)| #numeric to_signed|signed T|(T t)| to_unsigned|unsigned T|(T t)| static_minmax|with.[min_value,max_value]|<T... args>| |
︙ | ︙ | |||
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | r_trim||(String& content, Predicate)| r_trim||(string& content, char)| trim||(String& content, Predicate)| string_replace|string|(string const& from, string const& to, string content)| to_string|std::string|(expressions..., )| to_wstring|std::wstring|(expressions..., )| string_cast|To|(From)| #tuple tuple_index|with.[value]|<type, Tuple>| tuple_shift|tuple<A_{2...n}>|(tuple<A_{1...n}>)| tuple_pop|tuple<A_{1...n-1}>|(tuple<A_{1...n}>)| #utility v_in_place_type|std::in_place_type_t<T>|()| v_in_place_index|std::in_place_index_t<Ind>|()| CXXO_in_place_type(T)|std::in_place_type_t<T>|(type T)| CXXO_in_place_index(I)|std::in_place_index_t<I>|(size_t I)| | > > > > > > | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | r_trim||(String& content, Predicate)| r_trim||(string& content, char)| trim||(String& content, Predicate)| string_replace|string|(string const& from, string const& to, string content)| to_string|std::string|(expressions..., )| to_wstring|std::wstring|(expressions..., )| string_cast|To|(From)| #string_view make_string_view|basic_string_view<Char>|(basic_string<Char>)| make_string_view|basic_string_view<Char>|(Char[N])| #tuple tuple_index|with.[value]|<type, Tuple>| tuple_shift|tuple<A_{2...n}>|(tuple<A_{1...n}>)| tuple_pop|tuple<A_{1...n-1}>|(tuple<A_{1...n}>)| #utility v_in_place_type|std::in_place_type_t<T>|()| v_in_place_index|std::in_place_index_t<Ind>|()| CXXO_in_place_type(T)|std::in_place_type_t<T>|(type T)| CXXO_in_place_index(I)|std::in_place_index_t<I>|(size_t I)| #i12n #fixed_vector #mistack |