Commit Graph

380 Commits (1654ee84dbf828fac1916ed4fd6387c426371239)

Author SHA1 Message Date
Daniel Kolesa 26f83b9efb pop_first() and pop_last() now return bool instead of void (true if popped, false if not) 2015-05-29 20:02:40 +01:00
Daniel Kolesa 38fc61481a initial support for "range extension" - i.e. push_first and push_last methods (+ push_first_n, push_last_n) 2015-05-29 19:52:20 +01:00
Daniel Kolesa b5f54b5cca a few more string ops 2015-05-29 01:02:46 +01:00
Daniel Kolesa 2f035f44ce simplify PointerRange more 2015-05-29 00:30:27 +01:00
Daniel Kolesa f96764fad0 simplify PointerRange 2015-05-29 00:01:24 +01:00
Daniel Kolesa c1be7f097d various ToString improvements 2015-05-28 19:58:05 +01:00
Daniel Kolesa a49716034e begin to_string infra 2015-05-28 02:38:52 +01:00
Daniel Kolesa 84336cabef tostring cleanup 2015-05-28 01:44:21 +01:00
Daniel Kolesa 324bdd154c ToString for core number types 2015-05-28 01:26:48 +01:00
Daniel Kolesa 1b75a10ec8 include <new> with OCTA_ALLOW_CXXSTD 2015-05-27 23:52:39 +01:00
Daniel Kolesa 9b98741c4d OCTA_ALLOW_CXXSTD to allow octastd to be used alongside stl (for transition and other projects) 2015-05-27 23:49:59 +01:00
Daniel Kolesa 08bb790612 stl-like initializer list interface (allow octastd to be used with stl outside of octaforge) 2015-05-27 23:46:58 +01:00
Daniel Kolesa 1371a32db7 use size() instead of length() 2015-05-27 23:19:16 +01:00
Daniel Kolesa d2ddb82499 swap args 2015-05-27 22:32:35 +01:00
Daniel Kolesa 6885006199 ToString function object + callback variant of concat 2015-05-27 22:29:57 +01:00
Daniel Kolesa c111483f1d some initial funcs 2015-05-27 22:15:24 +01:00
Daniel Kolesa 434816840b octa::concat 2015-05-27 22:09:22 +01:00
Daniel Kolesa 593acb35e4 initial octa::String 2015-05-27 21:43:13 +01:00
Daniel Kolesa 07881f2a4f octa::chunks 2015-05-27 20:56:44 +01:00
Daniel Kolesa d2f48ea0a5 octa::take 2015-05-27 20:45:34 +01:00
Daniel Kolesa 28828ff448 fix swap_ranges api to correctly handle differently sized ranges 2015-05-27 00:49:35 +01:00
Daniel Kolesa e9367246b5 completely genericized octa::swap (no need for global overloads ever) 2015-05-26 21:29:44 +01:00
Daniel Kolesa 42167fdc5a fix vector::swap 2015-05-26 21:16:59 +01:00
Daniel Kolesa 029575d4a6 add octa::each 2015-05-26 19:25:20 +01:00
Daniel Kolesa ea83f402ab octa::algorithm::{foldl,foldr} 2015-05-25 20:46:49 +01:00
Daniel Kolesa f0380a2aaf initializer list fixes 2015-05-25 19:08:53 +01:00
Daniel Kolesa ffbb7da63a unexpose insertion sort 2015-05-24 18:22:35 +01:00
Daniel Kolesa 96d2404c0e allow different return type for octa::map callbacks 2015-05-24 14:34:37 +01:00
Daniel Kolesa b2f085b9da more accurate range category for FilterRange 2015-05-24 14:16:20 +01:00
Daniel Kolesa 8718630a5a il.range() -> il.each(), add algorithm::filter(range, pred) 2015-05-24 02:31:54 +01:00
Daniel Kolesa fe6325d5e3 check for input range before checking for put() - avoid potential false positives 2015-05-23 22:27:57 +01:00
Daniel Kolesa 329aefdecd IsOutputRange will now test for presence of the right 'put' method, enabling IsOutputRange tests on hybrid ranges (i.e. input ranges that satisfy output requirements) 2015-05-23 22:24:12 +01:00
Daniel Kolesa 7589a93539 add some traits to check range for range types including proper type inheritance 2015-05-23 20:33:08 +01:00
Daniel Kolesa 8908ac0506 new range category: FiniteRandomAccessRange 2015-05-23 20:00:03 +01:00
Daniel Kolesa 3883a0da33 octa::Vector - new constructor and operator= for construction from range (+ random access specialization for efficiency) 2015-05-23 19:52:42 +01:00
Daniel Kolesa 523c0e0ad1 const correctness 2015-05-23 18:59:14 +01:00
Daniel Kolesa 7c91e1cc5b implement random access requirements on MapRange 2015-05-23 18:55:22 +01:00
Daniel Kolesa 8c96179bd6 add octa::algorithm::map 2015-05-23 18:44:06 +01:00
Daniel Kolesa b90fce8d84 Revert "add range difference type"
This reverts commit 4adbeb4e1b.
2015-05-23 17:56:08 +01:00
Daniel Kolesa 4adbeb4e1b add range difference type 2015-05-23 17:40:36 +01:00
Daniel Kolesa 9c3486903d add optional pop_first_n and pop_last_n methods on ranges 2015-05-23 17:36:26 +01:00
Daniel Kolesa 56d8e481c8 .get() -> .data() 2015-05-21 00:45:34 +01:00
Daniel Kolesa f919983e03 array fixes 2015-05-21 00:34:42 +01:00
Daniel Kolesa 64810e4006 remove the noexcept stuff; nothing in octastd ever throws 2015-05-20 22:05:41 +01:00
Daniel Kolesa 25fb30b524 atomic.h: use strongly typed enum 2015-05-20 00:24:20 +01:00
Daniel Kolesa 559a1afd26 noexcept fix 2015-05-19 01:23:41 +01:00
Daniel Kolesa 704066954a remove vector::pop_ret 2015-05-19 01:21:23 +01:00
Daniel Kolesa 700905f594 style fix 2015-05-18 01:59:04 +01:00
Daniel Kolesa 767226a4ce array in_range fix 2015-05-18 01:57:44 +01:00
Daniel Kolesa 1d4e01ad5e array empty fix 2015-05-18 01:56:31 +01:00
Daniel Kolesa f4ef47e75a noexcept fix 2015-05-17 22:59:32 +01:00
Daniel Kolesa 5a991f3e21 array::in_range 2015-05-17 22:51:42 +01:00
Daniel Kolesa 7e61799f8b vector: do not free buffer in copy assignment unless necessary 2015-05-17 17:28:11 +01:00
Daniel Kolesa ed24618061 vector: clear does not free buffer + add operator= for initializer list 2015-05-17 17:11:56 +01:00
Daniel Kolesa 58faefa317 initial impl of allocator 2015-05-13 20:56:53 +01:00
Daniel Kolesa 3e51a86aa4 add header file for stream (no implementation yet) 2015-05-12 21:27:46 +01:00
Daniel Kolesa e3d5da3e66 octa::Hash in functional.h (+ specializations for all primitive types) 2015-05-10 21:57:52 +01:00
Daniel Kolesa 6a8dec424a range fixes 2015-05-08 02:03:48 +01:00
Daniel Kolesa ff9c78c1d4 fix 2015-05-07 21:07:06 +01:00
Daniel Kolesa 680c0da0a6 some traits cleanup 2015-05-06 19:52:07 +01:00
Daniel Kolesa a6bb089283 use some standard builtin traits 2015-05-05 19:30:31 +01:00
Daniel Kolesa 61a66f7372 more IsIntegral specializations 2015-05-04 00:00:27 +01:00
Daniel Kolesa fb0c7571c1 more style/consistency stuff 2015-05-03 23:50:21 +01:00
Daniel Kolesa 98e7566ad9 coding style 2015-05-03 23:44:48 +01:00
Daniel Kolesa 6a9d3b8ea7 coding style 2015-05-03 23:34:21 +01:00
Daniel Kolesa ef9995ae51 remove PointerTraits; replace with individual using aliases 2015-05-03 22:39:32 +01:00
Daniel Kolesa 2d10cd9280 ditch RangeTraits for alias definitions 2015-05-03 21:54:26 +01:00
Daniel Kolesa da69a57015 add input func check to octa::Function 2015-05-03 16:09:47 +01:00
Daniel Kolesa 64f403011a deprecate MSVC support for the time being 2015-05-02 22:12:28 +01:00
Daniel Kolesa 897f1873f7 remove macros 2015-05-01 21:17:28 +01:00
Daniel Kolesa 084139b731 remove more macros 2015-05-01 21:09:44 +01:00
Daniel Kolesa 367a586bf7 start demacrofying msvc implementation 2015-05-01 20:59:47 +01:00
Daniel Kolesa 302e674141 initial support for atomics 2015-05-01 20:34:32 +01:00
Daniel Kolesa 8fe03741cc fix vector noexcept on gcc 4.8 2015-05-01 20:21:47 +01:00
Daniel Kolesa cbd6d66eca box optimization - compress with empty deleters 2015-04-30 18:53:38 +01:00
Daniel Kolesa 95711030aa more noexcept for pair 2015-04-29 18:52:00 +01:00
Daniel Kolesa b1192b248c noexcept formatting 2015-04-29 01:38:16 +01:00
Daniel Kolesa ef47ade61f basic Pair type implementation 2015-04-29 00:01:22 +01:00
Daniel Kolesa 1a2d606ae7 noexcept the library 2015-04-28 18:48:58 +01:00
Daniel Kolesa f4b0691003 noexcept for functional 2015-04-28 02:30:17 +01:00
Daniel Kolesa bd86d82446 noexcept for memory.h 2015-04-28 02:20:14 +01:00
Daniel Kolesa 56f19204a2 style update 2015-04-27 20:23:38 +01:00
Daniel Kolesa 709bcb1362 add octa::make_box 2015-04-27 20:05:33 +01:00
Daniel Kolesa de7ceba269 minor renames 2015-04-27 19:56:06 +01:00
Daniel Kolesa e98b8946ae define size_type for ranges 2015-04-27 19:53:48 +01:00
Daniel Kolesa d7778cf259 ditch the separate "type" struct 2015-04-27 19:38:34 +01:00
Daniel Kolesa 990a7646da initial Box and pointer traits impl 2015-04-27 19:01:07 +01:00
Daniel Kolesa b37921ee93 add octa::clamp 2015-04-26 18:45:10 +01:00
Daniel Kolesa 0245db3fec rename traits->type_traits 2015-04-25 16:13:21 +01:00
Daniel Kolesa 6de48f1f21 refactor traits: e.g. "RemoveCV<T>" instead of "typename RemoveCV<T>::type" 2015-04-24 20:03:16 +01:00
Daniel Kolesa 8dd7ae1eda export core types outside of octa 2015-04-24 18:51:35 +01:00
Daniel Kolesa f106c5ae24 get rid of namespace internal 2015-04-24 18:16:35 +01:00
Daniel Kolesa cca0a62d34 use IsPOD rather than !IsClass to decide whether to memcpy etc. 2015-04-23 23:31:52 +01:00
Daniel Kolesa 89bab3362b add another condition on Function in-place optimization 2015-04-23 21:05:09 +01:00
Daniel Kolesa e92f5bba4b remove traits dependency on utility.h and thus the need to put some of the traits in utility.h 2015-04-23 20:53:05 +01:00
Daniel Kolesa 0c217e2128 add all remaining traits + cleanup, remove namespace internal etc 2015-04-23 20:38:18 +01:00
Daniel Kolesa a80f535b5d IsDestructible and IsNothrowDestructible 2015-04-23 19:26:26 +01:00
Daniel Kolesa 8557b0abe1 some platforms' C libs don't have max_align_t 2015-04-23 19:07:13 +01:00
Daniel Kolesa c388e8c09a add lots of new traits 2015-04-23 18:47:33 +01:00
Daniel Kolesa fff049d6c7 add IsConvertible 2015-04-23 02:39:43 +01:00
Daniel Kolesa c1e9b5e5e5 implement more traits + enable Decay (the remaining traits were implemented for it) 2015-04-23 02:16:48 +01:00
Daniel Kolesa 8cfd714a2d implement IsFunction + other traits 2015-04-23 01:49:24 +01:00
Daniel Kolesa 456704caa2 more traits 2015-04-23 01:26:03 +01:00
Daniel Kolesa 7779563bd9 add some more type traits, reorder the others 2015-04-23 00:26:53 +01:00
Daniel Kolesa 90cecea052 correctly forward 2015-04-22 23:28:43 +01:00
Daniel Kolesa 9a7a832fe3 move mem_fn to functional 2015-04-22 23:25:02 +01:00
Daniel Kolesa af9eff5c6d add functional::Function (generic wrapper around any callable type) 2015-04-22 18:42:58 +01:00
Daniel Kolesa 87e324bb1c traits::enable_if, algorithm::iota 2015-04-21 23:54:26 +01:00
Daniel Kolesa ff5fc7368d add EnumeratedRange + octa::enumerate 2015-04-21 17:58:36 +01:00
Daniel Kolesa e6a176c870 add Array container 2015-04-21 17:57:57 +01:00
Daniel Kolesa 6807d22df5 satisfy OutputRange on MoveRange and PointerRange (might be mutable), add more algorithms 2015-04-21 17:56:36 +01:00
Daniel Kolesa ab95885b4a add more algorithms 2015-04-21 02:33:58 +01:00
Daniel Kolesa d68d381f72 move initializer lists into initializer_list.h + add new .range() method to retrieve a PointerRange to it 2015-04-20 19:06:47 +01:00
Daniel Kolesa 9885909485 add algorithm::all_of, any_of, none_of 2015-04-20 02:21:27 +01:00
Daniel Kolesa 6d60b051e8 add algorithm::for_each 2015-04-20 02:14:55 +01:00
Daniel Kolesa c4aa7242fc add algorithm::is_partitioned 2015-04-20 02:06:42 +01:00
Daniel Kolesa ed0b28f2e0 add PointerRange constructor for pointer + length 2015-04-19 20:53:02 +01:00
Daniel Kolesa 58063fe392 add min, max, min_element, max_element in algorithm.h; rename VectorRange to PointerRange and move to range.h (useful as generic, e.g. with InitializerList) 2015-04-19 00:04:17 +01:00
Daniel Kolesa c36a653824 use introsort for sorting 2015-04-18 23:12:45 +01:00
Daniel Kolesa f9a298c1b8 move quicksort to internal namespace 2015-04-18 22:43:20 +01:00
Daniel Kolesa 4850e2454f don't use lambda 2015-04-18 22:40:38 +01:00
Daniel Kolesa 708100d171 add quicksort 2015-04-18 22:33:19 +01:00
Daniel Kolesa dc2dacaf5d add slicing for finite random access ranges 2015-04-18 22:05:24 +01:00
Daniel Kolesa cd0b6fc2fc add algorithm::partition 2015-04-18 21:46:31 +01:00
Daniel Kolesa 35424dd248 assignment op overloads for reverserange/moverange (c++ deletes them because of move ctor) 2015-04-18 20:31:07 +01:00
Daniel Kolesa 0ac7bb4302 initial sort support + cleanups 2015-04-18 20:21:59 +01:00
Daniel Kolesa 1177d94b6e implement ReferenceWrapper + ref/cref + address_of 2015-04-18 19:03:11 +01:00
Daniel Kolesa 799c9fed94 add not1/not2 2015-04-18 18:36:06 +01:00
Daniel Kolesa 2e750f6874 give IntegralConstant an "operator value_type" and "value_type operator()" 2015-04-18 18:32:25 +01:00
Daniel Kolesa cdc63eaf63 allow pointers to objects to be passed to calls with mem_fn 2015-04-18 17:28:11 +01:00
Daniel Kolesa c68742811b specialize mem_fn types for const 2015-04-18 17:23:59 +01:00
Daniel Kolesa cc4113459a implement octa::mem_fn 2015-04-18 17:19:58 +01:00
Daniel Kolesa f549d876e4 ResultOf trait, declval 2015-04-18 16:48:54 +01:00
Daniel Kolesa 2c03469cf8 more type traits 2015-04-18 16:09:08 +01:00
Daniel Kolesa 6247093ad9 add BinaryNegate and UnaryNegate 2015-04-18 02:50:20 +01:00
Daniel Kolesa c147f57588 add functional.h (for now with operator functor defs) + skeleton for algorithm.h 2015-04-18 02:35:36 +01:00
Daniel Kolesa 296b7cdeb9 move move/forward to utility.h 2015-04-18 00:11:16 +01:00
Daniel Kolesa 97fd88be62 octa::swap 2015-04-18 00:07:37 +01:00
Daniel Kolesa 32d925d298 define support for OutputRange 2015-04-17 21:33:01 +01:00
Daniel Kolesa c9b7afc035 add NumberRange specialization for 1 argument (creates a "[0, v)" range) 2015-04-17 20:33:36 +01:00
Daniel Kolesa 1557c227d0 remove range traits pointer specializations, as a pointer is not a range... also remove the pointer member type 2015-04-17 20:29:38 +01:00
Daniel Kolesa 0116d3cf4c equality checking for NumberRange 2015-04-17 20:20:38 +01:00
Daniel Kolesa 37aa387734 use inheritance to guarantee iterable behavior (also shortens code) 2015-04-17 20:15:03 +01:00
Daniel Kolesa 83abf1d44b make RangeIterator more internal; strip down its unnecessary functionality; remove the iterator macro for standard containers; fixes 2015-04-17 18:33:41 +01:00
Daniel Kolesa e73a8344ab RangeIterator doesn't need a type {} structure 2015-04-17 02:19:40 +01:00
Daniel Kolesa 21ba9d025d add NumberRange 2015-04-17 00:55:50 +01:00
Daniel Kolesa bc35dad776 fix RangeIterator to use empty() 2015-04-17 00:15:20 +01:00
Daniel Kolesa 36d53f2019 make_move_range/make_reverse_range 2015-04-16 23:47:31 +01:00
Daniel Kolesa 603cb42eca fix insert + add move_range 2015-04-16 23:26:10 +01:00
Daniel Kolesa 00175b59ad rename range insert to insert_range (prevent ambiguous calls) 2015-04-16 23:18:30 +01:00
Daniel Kolesa 1458188593 initializer-list insert for vector 2015-04-16 23:11:56 +01:00
Daniel Kolesa cb8e189450 range-based vector insert + add MoveRange that wraps any InputRange with move semantics 2015-04-16 23:06:39 +01:00
Daniel Kolesa 953e4a2afa cleanup insert + move variant 2015-04-16 22:44:37 +01:00
Daniel Kolesa 172b62fa92 use moving in insert 2015-04-16 22:33:31 +01:00
Daniel Kolesa 66f7bc90c2 range category tags + cleanup 2015-04-16 21:50:53 +01:00
Daniel Kolesa b3a49b597c define a range and const_range type for containers 2015-04-16 20:40:59 +01:00
Daniel Kolesa e1b9e208ae better constness on ranges 2015-04-16 20:35:10 +01:00
Daniel Kolesa 0ac0ec24be const stuff 2015-04-16 02:40:49 +01:00
Daniel Kolesa aca6a7810b correct [] operator on reverse ranges 2015-04-16 02:13:53 +01:00
Daniel Kolesa 1f7c5e97b3 reverse range 2015-04-16 02:07:32 +01:00
Daniel Kolesa 988b092778 actually working comparisons 2015-04-16 01:47:02 +01:00
Daniel Kolesa cb68ada121 simplify ranges a bit 2015-04-16 01:18:18 +01:00
Daniel Kolesa c27a77b611 public inheritance for ranges by default 2015-04-16 01:07:58 +01:00
Daniel Kolesa c79e5757f9 initial proof-of-concept implementation of ranges and range iterator 2015-04-16 00:18:00 +01:00
Daniel Kolesa e12b221112 use nullptr 2015-04-15 22:41:32 +01:00
Daniel Kolesa e2f43ed25e initializer list support + insert on vector 2015-04-15 22:38:35 +01:00
Daniel Kolesa 9d5acc2337 more vector utils 2015-04-15 22:09:35 +01:00
Daniel Kolesa dba2ac673f split new implementations 2015-04-15 01:39:26 +01:00
Daniel Kolesa 6767157db9 use static_cast 2015-04-14 23:25:29 +01:00
Daniel Kolesa d26db78f0d move stuff instead of copy, forward correctly in emplace_back 2015-04-14 23:14:46 +01:00
Daniel Kolesa 2f56d5b52b vector move ctor + emplace_back 2015-04-14 23:04:51 +01:00
Daniel Kolesa f70d8e792d mark explicit 2015-04-14 22:21:17 +01:00
Daniel Kolesa 16c1cc203e working basic vector implementation 2015-04-14 22:16:06 +01:00
Daniel Kolesa df1b9daeaf add move/forward and more traits 2015-04-14 01:12:15 +01:00
Daniel Kolesa 0311af0ffe IsClass and IsNumber traits 2015-04-13 23:20:04 +01:00
Daniel Kolesa 0500e52295 moar traits 2015-04-13 23:04:25 +01:00
Daniel Kolesa 292c5a35b7 moar traits + strip qualifiers first 2015-04-13 22:56:15 +01:00
Daniel Kolesa 844fc88b9b some core types, initial type traits 2015-04-13 22:25:31 +01:00
Daniel Kolesa 6c6e7b69f7 some vector work 2015-04-12 21:41:02 +01:00
Daniel Kolesa 323e992ea5 new namespace 2015-04-11 21:00:10 +01:00