Alex Howlett
c9e423d7cf
Fix warning 4996 on Microsoft compiler ( #633 )
2018-03-05 12:04:22 -08:00
Neil MacIntosh
6a33b97a84
Fix return type of templated span.subspan() ( #625 )
...
* Added support for returning fixed-spize spans from subspan().
* Addressed issues from code review.
* Took simpler approach to static data member.
* Subtle fix to support MSVC 15.
* Helps to not introduce extraneous >
2018-03-03 19:12:45 -08:00
Anna Gringauze
cbd64c9ff6
fixed noexept warnings ( #632 )
...
* fixed noexept warnings
- Removed conditional compilation for throwing version of GSL
vs fail_fast because we don't want users of the code to see
differences in the span interface dependent on error mechanism
chosen
- Removed noexcept from functions that may fail at runtime
- Fixed CppCoreCheck warnings related to missing and incorrect
noexcept
- do not warn on unnown attributes for GCC and Clang
* remove suppress that does not compiler for clang and gcc
2018-03-03 19:12:23 -08:00
Zac Hansen
ed3693fd2e
make explicit not_null move constructor so it is noexcept ( #630 )
...
* make explicit not_null move constructor so it is noexcept
* added test for not_null being noexcet move constructible
2018-03-03 15:53:23 -08:00
beinhaerter
7eb8f41af5
constexpr for make_span ( #627 )
2018-02-23 13:35:36 -08:00
paweldac
b3870ca020
add gsl::index typedef ( #620 )
...
* rename index in multi_span to span_index
gsl::index is name reserved for different type
* add gsl::index typedef
cppcoreguidelines referece: ES.107: Don't use unsigned for subscripts, prefer gsl::index
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Res-subscripts
* rename span_index to multi_span_index
2018-02-21 13:33:07 -08:00
Johel Ernesto Guerrero Peña
73db6ef98f
Remove inline added for the now unsupported MSVC 2013. ( #585 )
2018-02-20 14:46:37 -08:00
caleb
13ce102ec0
gsl::index bug fix ( #624 )
...
Fixing a bug in the != operator in the gsl::index class
2018-02-20 14:37:50 -08:00
beinhaerter
c87c123d1b
Fix code analysis warning in multi_span ( #606 )
...
Prevents MSVC code analysis warning
...\gsl\include\gsl\multi_span(1055): warning C26440: Function 'gsl::dim_t<-1>::dim_t<-1>' can be declared 'noexcept' (f.6: http://go.microsoft.com/fwlink/?linkid=853927 ).
2018-02-13 17:42:37 -08:00
Tamir Bahar
05bf567dcb
Use in-class init for final_action members (C.48) ( #601 )
...
* Use in-class init for final_action members (C.48)
Initialize `invoke_` in-class, according to http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c48-prefer-in-class-initializers-to-member-initializers-in-constructors-for-constant-initializers
* Empty commit to trigger build.
2018-02-13 17:28:21 -08:00
Anna Gringauze
3a12c55cb6
Merge pull request #616 from neilmacintosh/tidy-comparison-ops
...
Tidy up span comparison ops
2018-02-11 22:36:32 -08:00
Neil MacIntosh
533494335b
Merge branch 'master' of https://github.com/neilmacintosh/GSL into remove-move-ops
2018-02-11 14:27:05 -08:00
Neil MacIntosh
314065b317
Fix span comparison ops to take arguments by-value rather than by-ref.
2018-02-11 14:22:08 -08:00
Neil MacIntosh
f63fe12ba7
Merge from upstream master.
2018-02-11 13:36:18 -08:00
beinhaerter
3ff6004bc3
added const ( #605 )
...
Resolves compiler code analysis warning ...\gsl\include\gsl\string_span(101): warning C26496: The variable 'str_span' is assigned only once, mark it as const (con.4: https://go.microsoft.com/fwlink/p/?LinkID=784969 ).
2018-02-11 12:19:10 -08:00
Casey Carter
95da2fd337
Don't use clang's __builtin_assume as an optimizer hint ( #608 )
...
Fixes #607 .
Drive-by: use '?:' to contextually convert to bool in the fallback definition of `GSL_ASSUME`
2018-02-11 12:16:39 -08:00
Neil MacIntosh
c23d17a61a
Make iterator access functions on span constexpr ( #612 )
...
As per feedback on span received during the C++ standardization discussions.
2018-02-10 21:11:08 -08:00
Neil MacIntosh
87e22faa7e
Removed from-smart-ptr constructors. ( #611 )
...
As per feedback during standardization discussions.
2018-02-10 20:02:05 -08:00
Neil MacIntosh
5538021e76
Removed unnecessary move operations.
2018-02-10 20:00:44 -08:00
Neil MacIntosh
2bdbba7418
Removed span from-nullptr_t ctor.
2018-02-10 19:21:22 -08:00
Neil MacIntosh
72688ff009
Removed span.length() as synonym for span.size().
2018-02-10 18:58:28 -08:00
Neil MacIntosh
9ed6ecc4e0
Made all span iterator access functions constexpr.
2018-02-10 18:25:07 -08:00
Neil MacIntosh
028925caba
Removed from-smart-ptr constructors.
2018-02-10 18:05:17 -08:00
paweldac
9d65e74400
added gsl_algorithm and gsl_byte headers to main gsl header ( #594 )
2017-12-04 09:18:40 -08:00
Tiago
6e2e207c8d
rename final_act to final_action ( #579 )
2017-11-28 07:20:32 -08:00
paweldac
436dbad8c6
Remove std::iterator inheritance from multi_span ( #591 )
...
In C++17 std::iterator is marked duplicated. Added handwritten usigs for traits.
2017-11-28 07:15:34 -08:00
Tiago
0d33bf6794
Applied iwyu --comment to the code base ( #588 )
2017-11-28 07:13:49 -08:00
bjude
7e529a47c2
Remove #pragma once ( #545 ) ( #570 )
...
Core Guidelines SF.8 recommends using portable include guards instead.
2017-11-14 08:38:16 -08:00
menete
2ad93a38dd
Iosfwd ( #586 )
...
* Solves #567 with <iosfwd> approach
* adds a little testing to not_null ostream
2017-11-14 08:14:20 -08:00
Tiago
d10ebc6555
Drop "Dummy" from enable_if in templates ( #572 )
...
Looks like this was here because of MSVC 2013 compat which is not
supported anymore
2017-11-03 16:18:59 -07:00
Anna Gringauze
9a7897915e
Minimize checking in subspan ( #569 )
...
* rewrite span subspan checks to help optimizations
* Removed checking pointer for null for subspans. We would never
check pointer for null in between ptr and ptr+size in the
original span, so there seems to be no reason to do so for
subspans, provided that the subspan's boundaries are ensured
to be within the range of the original span's boundaries.
This change allows to simplify generated code, for example, to
remove 5 out of 9 branches in code generated from the following
by MSVC, and 4 out 8 branches in clang and gcc-generated code:
span<int> mysubspan(int* p, std::ptrdiff_t size, std::ptrdiff_t i)
{
if (p != nullptr)
{
span<int> s = { p, size };
return s.subspan(i);
}
return { nullptr };
}
Similar effects are achieved for dynamic subspans of static spans,
where in the following code we remove 2 out of 4 branchs in MSVC
and GCC-generated code:
int test_dynamic_subspan_of_static_span(std::ptrdiff_t i)
{
int x[] = { 0,1,2,3,4,5 };
span<int, 6> s = { x };
auto subspan = s.subspan(i);
return subspan.size();
}
2017-11-03 16:13:39 -07:00
Tiago
4862a270b9
Move GSL pointers to a separate header ( #566 )
2017-10-31 10:19:12 -07:00
Casey Carter
166ea80f66
Update std::byte detection in gsl_byte for MSVC ( #561 )
...
* Only check that `_HAS_STD_BYTE` is defined to a non-zero value
2017-10-18 16:35:11 -07:00
Galik
4c5fdb541f
Made string_span details::string_length() generic (Fix issue #542 ) ( #543 )
...
* Made string_span details::string_length() generic
removed overloads & specialized classes
Creating string_spans using `char16_t` and `char32_t` was not possible
without creating new specializations and function overloads.
This patch makes details::string_length() generic removing the need to
extend the overloads and specializations.
* added type aliases for string_span types char16_t and char32_t
* Added char16_t & char32_t overloads for ensure_z
* added string_span tests for char16_T & char32_t
* added zstring type aliases for char16_t & char32_t
* Added tests for char16_t & char31_t zstring and string_span types
* applies clang format to <gsl/string_span>
* Clang format tests/string_span_tests.cpp
* Removed ensure_z() overloads as they don't add functionality.
2017-09-18 15:20:51 -07:00
Anna Gringauze
e7bcdf541b
Enable vectorization of common loops using iterators with range checking enabled with GCC and Clang ( #557 )
2017-09-18 15:16:23 -07:00
Rian Quinn
842344e94b
turning off warning ( #548 )
...
using the GSL with MSVC 2017 causes the following warning"
`'std::copy_n::_Unchecked_iterators::_Deprecate': Call to 'std::copy_n'`
This patch removes this since the point of this code is to deal with this issue.
2017-08-16 19:06:30 -07:00
Casey Carter
2b8d20425e
Allow users to override GSL_USE_STD_BYTE ( #536 )
2017-07-24 17:26:21 -07:00
Neil MacIntosh
be43c79742
Removed VS2013 workarounds. ( #534 )
2017-07-14 04:40:27 -07:00
Neil MacIntosh
b2ee484334
Move from unittest-cpp to catch for unit testing. ( #533 )
...
Many thanks to @rianquinn. This should fix #495 , #494 and #529 .
2017-07-13 13:53:56 -07:00
Gary Furnish
1f87ef73f1
Fix cstddef include in wrong place. ( #520 )
2017-06-02 08:45:42 -07:00
Vincent Zalzal
010ab921bf
Fix multi_span constructor taking a const std::array. ( #523 )
...
not called even by the unit test (it was calling the "container" ctor
instead). I mimicked the constructor taking a non-const std::array to fix
the issue.
2017-06-01 21:55:25 -07:00
Neil MacIntosh
1cfb241be7
Fix bug in comparison that selects std::byte.
2017-05-31 19:08:11 -07:00
Neil MacIntosh
7731a91d75
Use std::byte when available. ( #519 )
...
* Use std::byte implementation when available with MSVC.
* Rollback the /std:c++latest flag used for testing.
* Review feedback.
2017-05-31 18:42:06 -07:00
Alexey Malov
247c4250d4
Fixes dereferencing operator issue #517 introduced in PR #513 ( #516 )
...
* Fixes issue with dereferencing operator issue #491 introduced in PR #513
dereferencing operator added in PR#513 returned a copy of the object
instead of reference to it.
Adding decltype(auto) as return type of operator* fixes this issue.
* added more tests for not_null::operator*
2017-05-31 11:18:55 -07:00
saurabh singh
30595c1f1d
Restricting usage of owner<T> to pointer types ( #507 )
...
* Restricting usage of owner<T> to pointer types
* Removing an additional type that was created for testing
* Added comment about the new constraint on owner
* Adding dereference operator to not_null
* Removing dereference operator changes for not-null
* Removing dereference operator changes for not-null
* Review comments
2017-05-30 20:08:12 -07:00
saurabh singh
23581d4d63
Adding derference operator to not_null ( #513 )
2017-05-30 10:06:21 -07:00
Gary Furnish
d1032864aa
Fix use of 0 instead of nullptr warning ( #515 )
2017-05-30 09:57:45 -07:00
Galik
7abfc98198
GSL_NOEXCEPT should appear before the initialization list ( #514 )
2017-05-30 08:09:09 -07:00
Casey Carter
39902b6ec0
span_iterator: converting constructor isn't a copy constructor ( #511 )
...
Fixes #510 .
* Constrain the converting constructor to not participate in overload resolution when IsConst is true, so that it is never a copy constructor.
* Use Default Member Initializers for span_iterator's data members so that the default constructor can be explicitly defaulted.
* Declare all members of span_iterator GSL_NOEXCEPT: they only throw when contract violations throw.
* Don't use & in operator-> since evil types may overload it.
2017-05-26 15:41:12 -07:00
ewoudvc
64c0ca64ce
make_span for array doesn't pass N as span template parameter ( #498 )
2017-04-25 12:01:49 -07:00
Tiago
ebe7ebfd85
Reformat files to follow clang-format style ( #492 )
...
Project files were not following the clang-format style. For people
using IDEs were clang-format is always run after a save this would
cause unwanted changes.
This commit only applies "clang-format -i" to files.
2017-04-20 07:51:37 -07:00
Maciej T. Nowak
c2f953f2eb
Add value_type to span ( #425 )
...
* Add value_type to span
Currently I'm working on project which involves a lot of `span`s and mocking via Google Mock. Unfortunately a lot of standard matchers requires `value_type` type definition inside container which `gsl::span` lacks.
This pull request add `value_type` type definition inside `gsl::span`
* Strip cv from value_type of span and span_iterator
2017-04-13 13:55:20 -07:00
Alexey Malov
534bb4c663
Added support of not_null<smart_ptr> comparison ( #473 )
...
* Added support of not_null<smart_ptr> comparison
* The return type of not_null comparison operators is determined using SFINAE
#474
* tests for gsl::not_null comparison were added
* not_null comparison tests were rewritten to compare pointers to objects located in the same array
* not_null<shared_ptr> comparison was simplified
2017-04-12 17:34:39 -07:00
Casey Carter
ebab8cab7f
gsl::at clean-up: ( #479 )
...
* initializer_list overload returns by value to avoid lifetime issues
* generic overload uses expression SFINAE to work with any type that has member size() and operator[], which notably includes const/non-const vector and array.
* Add test coverage for const objects, rvalue initializer_lists, and constexpr usage.
Fixes #357 .
2017-04-03 22:43:43 -07:00
Casey Carter
d65660760b
fail_fast should derive from logic_error ( #480 )
...
Fixes #298 .
2017-04-03 11:09:47 -07:00
MikeGitb
ade86caa92
Fix some corechecker warnings ( #470 )
...
* Improve const correctness in string_span
* Improve const correctness in bounds_tests.cpp and byte_tests.cpp
* Improve const correctness in span_tests.cpp
* Improve const correctness in utils_tests.cpp
* Use gsl::owner for dynamically allocated memory in string_span_tests.cpp
* Improve const correctness in string_span_tests.cpp
* Improve const correctness for strided_span_tests.cpp
2017-04-02 12:30:49 -07:00
Casey Carter
16a6a41690
gsl_assert changes: ( #452 )
...
* GSL_LIKELY/_UNLIKELY always contextually convert their argument to bool.
* Add macro GSL_ASSUME(cond) to inform the optimizer that the predicate cond must hold.
* Reimplement Expects & Ensures as expressions for flexibility and correctness. (Think about "if (cond1) Expects(cond2); else goto fail;")
* Expects and Ensures GSL_ASSUME their predicate when GSL_UNENFORCED_ON_CONTRACT_VIOLATION is defined.
2017-03-20 09:30:14 -07:00
Duncan Horn
2676e172db
Updating length_func<CharT>::operator() to accept pointer-to-const. ( #458 )
2017-03-10 09:02:13 -08:00
Rian Quinn
f9c47dd63f
add gsl::not_null operator<< ( #464 )
...
* add gsl::not_null operator<<
Hippomocks, which is a popular mocking engine for C++ uses operator<< on pointers and gets confused about gsl::not_null not having this operator.
* Update gsl
2017-03-09 12:42:18 -08:00
Casey Carter
3819df6e37
Properly qualify std::size_t ( #448 )
2017-02-13 12:11:45 -08:00
Casey Carter
e3fecbd1c5
not_null cleanups and improvements: ( #449 )
...
* constexpr all the things.
* remove operator=(const T&)
* it leaves *this in an invalid state if ensure_invariant fails
* implicitly converting the T to not_null and then assigning is in every way superior.
* simplify conversion from not_null<U> with constructor delegation.
* remove the converting assignment operator; again let the conversion constructor and self-assignment operator do the work.
* Cover the remaining pointer arithmetic operations as Wakely suggests in issue #447 .
* Cleanup not_null conversions from null pointer constants:
* replace constructor that accepts T with constructor template that accepts U convertible to T
* remove deleted constructor that accepts int
* Attempts to initialize with nullptr, 0, 0L, 0LL, etc. all unambiguously select the deleted nullptr_t constructor.
2017-02-13 11:40:27 -08:00
Casey Carter
6360dd1e75
Revert change to the definition of constexpr macro in gsl_byte from #446 ( #450 )
2017-02-11 17:38:59 -08:00
Casey Carter
4e8f95b418
Cleanup include structure, constexpr and noexcept compiler workarounds.
...
* Nest "gsl" directory inside a new "include" directory.
* Cleanup the _MSC_VER conditionals a bit; use constexpr on VS2017+.
* Don't #define noexcept on non-Microsoft implementations.
* Workaround VS2017 bug in multi_span. (Also implement == and != for static_bounds_dynamic_range_t because I'm an EoP semantic soundness snob.)
Fixes #441 .
2017-02-07 15:59:37 -08:00
galik
f6cc5798a1
Renamed include/ folder to gsl/ to make including the library consistent
...
whether using it from the development folder, from the installation
folder or from being copied into a project.
#include <gsl/gsl.h>
Updated headers/tests/instructions/cmake build accordingly
This PR should address https://github.com/Microsoft/GSL/issues/277 (less
the renaming of gsl itself)
2016-08-09 15:04:58 +01:00
Neil MacIntosh
efeb557bf1
Merge pull request #310 from neilmacintosh/dev/neilmac/fix_mismatched_pragma
...
Fixed #308 - a mismatched pragma.
2016-08-08 13:52:15 -07:00
Som1Lse
c4817358aa
Implemented https://github.com/Microsoft/GSL/issues/260
2016-08-03 22:28:25 +02:00
Neil MacIntosh
db9d3da029
Merge branch 'master' of https://github.com/neilmacintosh/GSL into dev/neilmac/fix_mismatched_pragma
2016-08-02 18:10:07 -07:00
Neil MacIntosh
ebce4920d6
Fixed #308 - a mismatched pragma.
2016-08-02 16:22:18 -07:00
Neil MacIntosh
6c7be2c8ee
clang-format run.
2016-08-01 21:41:20 -07:00
Neil MacIntosh
94afa1fbd7
Removed unnecessary inheritance between iterators.
2016-08-01 18:49:48 -07:00
Neil MacIntosh
1bd2d04c2e
Another round of clang-formatting.
2016-08-01 13:10:02 -07:00
Neil MacIntosh
8e31f53f8a
Building clean with MSVC12.
2016-07-29 11:16:06 -07:00
Neil MacIntosh
a0cf1ecc49
Renamed as_span() to as_multi_span() for clarity.
2016-07-28 17:27:22 -07:00
Neil MacIntosh
a88cfb168a
Fixed type-name mixup in string_span.
2016-07-27 13:48:29 -07:00
Neil MacIntosh
6fadce975b
Applied clang-format.
2016-07-26 19:19:47 -07:00
Neil MacIntosh
4de3d4e3e3
Fixes for Clang 3.6 compilation.
2016-07-26 18:44:13 -07:00
Neil MacIntosh
c366f4415d
Fixed compilation issues for GCC on Linux.
2016-07-26 18:34:27 -07:00
Neil MacIntosh
b03b04bfcd
Applied clang-format to the source.
2016-07-20 13:17:47 -07:00
Neil MacIntosh
cd80ef6146
Merge branch 'master' into dev/neilmac/spec
2016-07-20 12:02:51 -07:00
Neil MacIntosh
eed99d8599
Merge branch 'master' into dev/neilmac/spec
2016-07-20 09:30:05 -07:00
Neil MacIntosh
f2ab3a5c54
Tidying up noexcepts.
2016-07-20 09:24:49 -07:00
Neil MacIntosh
5e7771f879
Slight tidy-up to precondition checking in span.
2016-07-20 09:00:10 -07:00
Neil MacIntosh
0c1b6717c1
Weakened cast in span::iterator.
2016-07-20 08:52:09 -07:00
Neil MacIntosh
520c72d777
Tidied up assertion.
2016-07-18 12:00:33 -07:00
Neil MacIntosh
30a038ca6a
Added tests for span iterators, fixed implementation.
2016-07-18 11:38:01 -07:00
Neil MacIntosh
8855c59579
Added basic compile support for MSVC 2013 to byte.
2016-07-15 17:31:40 -07:00
Neil MacIntosh
267472449c
Renamed byte header and tidied up string_span dependencies.
2016-06-26 17:00:56 +03:00
Neil MacIntosh
b72d7abfb0
Added definition of gsl::byte to match proposed std::byte.
2016-06-24 04:54:09 -07:00
Neil MacIntosh
7b00172f00
Final sync with D0122R3 version of specification.
2016-06-20 01:41:49 -07:00
Neil MacIntosh
64598bc0f7
Cleaned up last() functions to match spec.
2016-06-14 20:20:09 -07:00
Neil MacIntosh
62f30205e5
Additional std::array ctor to support const element cases.
2016-06-14 20:14:17 -07:00
Neil MacIntosh
c94a66f468
Tightened SFINAE for span<U> to span<T> conversions.
2016-06-12 18:28:19 -07:00
Neil MacIntosh
ba8ebef509
Added span to object rep conversions.
2016-05-29 17:06:29 -07:00
Neil MacIntosh
d63c9803da
Added comparison operators.
2016-05-29 14:05:09 -07:00
Neil MacIntosh
25ff7eca1f
Removed some redundant parens.
2016-05-29 13:54:19 -07:00
Neil MacIntosh
d9d6ff0121
Added iterators.
2016-05-29 13:52:28 -07:00
ericLemanissier
9d8866a732
gsl::at overload for initializer_list
...
initializer_list do not have subscript operator, so the generic container overload of gsl::at fails to compile.
This commits adds an overload of gsl::at for initializer_lists, using *(initializer_list::begin()+index) instead of subscript operator
2016-05-09 15:27:17 +02:00
Neil MacIntosh
a9f0ce2f77
Suppressed CppCoreCheck warnings.
2016-03-31 12:01:07 -07:00
Neil MacIntosh
c8a412f028
Implemented first, last, subspan.
2016-03-18 16:49:29 -07:00
Neil MacIntosh
3d4c34966a
Fixed ctors for Container and std::array to accept temporaries.
2016-03-17 17:20:33 -07:00
Neil MacIntosh
717a2e35f1
Added conversion ctors.
2016-03-16 19:39:55 -07:00
Neil MacIntosh
c40094a532
Added from-container constructors.
2016-03-01 12:11:41 -08:00
Neil MacIntosh
f61a9bba48
Added array constructors.
2016-02-29 13:16:48 -08:00
Neil MacIntosh
502cd6650a
Checking in to continue working elsewhere.
2016-02-28 00:50:53 -08:00
Neil MacIntosh
cc22f2bf42
first/last constructor working.
2016-02-25 11:42:26 -08:00
galik
f02dcc1cc9
Merge remote-tracking branch 'upstream/master'
2016-02-25 19:25:45 +00:00
Neil MacIntosh
d3929c59a0
Began reimplementation of span. Basic constructors.
2016-02-24 16:11:33 -08:00
Neil MacIntosh
cec26a23b9
Added new span-related files.
2016-02-24 11:26:28 -08:00
Neil MacIntosh
d2f12a8fa3
File renames to reflect new multi_span name.
2016-02-24 11:03:33 -08:00
Neil MacIntosh
49e80625c6
Renamed existing span to multi_span.
2016-02-24 10:29:29 -08:00
Paweł Bylica
c2924406e2
Disable MSVC warning 4127 (conditional expression is constant) raised for so instances of narrow().
2016-02-19 19:14:39 +01:00
Paweł Bylica
abae0bd998
Refactor is_same_signedness.
2016-02-19 19:03:51 +01:00
Paweł Bylica
092a8e53e4
narrow: Check for changed sign only if types have different signess.
2016-02-16 14:37:07 +01:00
galik
1843b1739e
Fix: Issue: #267 gsl::fail_fast only defined for one configuration
2016-02-16 00:57:04 +00:00
Paweł Bylica
6a4f2512b7
narrow: Also check if a value has changed sign after cast.
...
Fixes https://github.com/Microsoft/GSL/issues/222 .
2016-02-08 12:38:06 +01:00
Anna Gringauze
45f2bdb486
Fixed compilation issues with gcc and clang
2016-02-06 21:37:17 +00:00
Anna Gringauze
ed906e7aae
Addressed CR comments
2016-02-06 10:46:40 -08:00
Anna Gringauze
b4ff206c24
Added zstring_span and removed zstring_builder to support legacy strings
2016-02-03 19:30:34 -08:00
Gary Furnish
62b063a272
Fix issue #242
2016-01-13 16:12:17 +00:00
Neil MacIntosh
fc5fce4f4f
Correct define to undef in string_span.h.
2016-01-05 22:04:00 -08:00
Neil MacIntosh
d38e621201
Correct missing return in string_span.h
...
Should fix #239 .
2016-01-04 11:57:03 -08:00
Tristan Brindle
3bc3f35214
Fix missing #include <string> in string_span.h
2015-12-23 01:26:38 +13:00
Anna Gringauze
eb05256ffe
Fixed compilation issues in MSVC 2013
2015-12-14 20:43:58 -08:00
Neil MacIntosh
9e1402dff8
Merge fixes from menuet, dropping max() macro workaround.
...
Conflicts:
include/string_span.h
2015-12-14 11:38:20 -08:00
Neil MacIntosh
385780388e
Merge branch 'VS2013-fix-string_span-ctors' of https://github.com/menuet/GSL into menuet-VS2013-fix-string_span-ctors
2015-12-14 11:08:58 -08:00
Pascal Menuet
f38ee4fb5e
In VS2013, the std::equal does not have the overload that takes 4 iterators
2015-12-12 22:59:57 +01:00
Pascal Menuet
5e7e68c8b0
For VS2013, fix an ICE by replacing dummy template type parameter by a dummy function parameter
2015-12-12 22:51:49 +01:00
Pascal Menuet
37cdb6bc50
Disable macro max in Windows. Implement move ctors in string_span for VS2013. Remove redundant pragma warning pop for VS2013.
2015-12-11 20:47:07 +01:00
Zachary Henkel
293acf0640
Add casts to eliminate signed/unsigned mismatch warnings
...
Addresses issue #210 and VC's warning C4365
2015-12-09 13:59:32 -08:00
Neil MacIntosh
eb28b21049
Merge pull request #221 from mcheese/master
...
Correct missing rename of bytes() to size_bytes()
2015-12-08 12:02:14 -08:00
Anna Gringauze
5926942cd7
Tyding up comments
2015-12-07 15:30:00 -08:00
Anna Gringauze
e19f6b5f36
Fixed a bug on creating a span from empty string
2015-12-07 15:22:11 -08:00
Anna Gringauze
c6f3579ad1
Changes for gcc and clang
2015-12-07 00:14:31 -08:00
Anna Gringauze
87c5daa6c4
Fixed operators and constructors for string_span
2015-12-07 00:14:25 -08:00
mcheese
eedd18d5b8
Correct missing rename of bytes() to size_bytes()
2015-12-06 13:43:03 +01:00
Anna Gringauze
de6dbacbf6
Addressed CR comments
2015-12-01 14:47:53 -08:00
Anna Gringauze
7077105b9d
Added operator==
2015-12-01 13:41:28 -08:00
Anna Gringauze
8c5d06dc79
fixed GCC and clang compilation issues
2015-12-01 13:41:23 -08:00
Anna Gringauze
e3878a6556
merging with master
2015-12-01 13:41:18 -08:00
Neil MacIntosh
f76f739805
Addressing #178 : wrong return type for function.
2015-11-30 18:20:14 -08:00
Neil MacIntosh
c9959b1071
Corrected some variable naming.
2015-11-30 05:34:38 +00:00
Neil MacIntosh
0cf947db77
Reworked span to match GSL design.
2015-11-29 19:19:37 -08:00
Neil MacIntosh
38eaf9fc95
Refactored headers so span can use narrow_cast etc.
2015-11-23 16:22:31 -08:00
Neil MacIntosh
d5057370b8
Merge branch 'master' into dev/neilmac/contracts
2015-11-20 17:14:21 -08:00
Neil MacIntosh
d13f6daa75
Refactored to use Expects/Ensures everywhere.
2015-11-20 17:06:23 -08:00
Elron A. Yellin
e4d8d35af5
add as_span overload for basic_string which doesn't have nonconst .data() like other contiguous containers
2015-11-20 17:50:02 -05:00
Anna Gringauze
c95eb57d3f
Fixed conversion problem when creating strided_span from span and bounds
2015-11-19 13:13:15 -08:00
Matus Chochlik
73ec688674
Made conversion of span<> to bool explicit
2015-11-19 10:27:08 +01:00
Matus Chochlik
da75d0e757
Added explicit cast to size_type in span constructor
...
This silences implicit sign conversion warnings when constructing span
from containers which return size_t from size().
2015-11-18 17:45:36 +01:00
Neil MacIntosh
106262f1ef
Remove unnecessary workaround for max macro
2015-11-17 19:01:46 -08:00
Neil MacIntosh
107869a2e4
Merge branch 'master' of https://github.com/Microsoft/GSL into dev/neilmac/defines
2015-11-17 15:35:14 -08:00
Neil MacIntosh
292f81e5ef
Tidied up compiler-config macros.
2015-11-17 15:07:51 -08:00
Lukas Haselsteiner
e51eb228ae
fixes pragma undef warnings in MSVC2013
2015-11-15 23:08:35 +01:00
Anna Gringauze
f510025109
Removed basic_span class
2015-11-13 12:54:37 -08:00
Anna Gringauze
8aa4248722
Removing basic_span base class from span
2015-11-13 12:52:02 -08:00
Neil MacIntosh
a998a9b33b
Turned on Level 3 warnings for MSVC.
2015-11-12 18:57:23 -08:00
Neil MacIntosh
42a7030052
Merge pull request #180 from OlafvdSpek/patch-1
...
Sort includes
2015-11-12 15:42:50 -08:00
Olaf van der Spek
550361cf46
Sort includes
2015-11-12 10:23:56 +01:00
Vladislav Yaroslavlev
a29ed61a48
Merge remote-tracking branch 'refs/remotes/Microsoft/master'
2015-11-12 10:47:49 +03:00
Vladislav Yaroslavlev
995cfdf1cb
Add copy assignment operator to BoundsRanges
...
`BoundsRanges` defines copy constructor, but lacks `=` operator
2015-11-12 10:46:21 +03:00
Vladislav Yaroslavlev
557e6693b5
Add copy assignment operator to strided_bounds
...
`strided_bounds` defines copy constructor, but lacks copy assignment
operator
2015-11-12 10:44:41 +03:00
Neil MacIntosh
fc289930ee
Cast size_type for string_span ctor from container.
2015-11-11 20:48:42 -08:00
Rostislav Khlebnikov
31dd90ef31
added missing inlines
2015-11-05 17:56:50 +00:00
Neil MacIntosh
4e4882bda8
Added workaround for MSVC 2013 compiler bug.
2015-11-05 09:29:30 -08:00
Neil MacIntosh
b63ec949e9
Renaming array_view and string_view, as per WG21 discussions.
2015-11-04 12:42:27 -08:00
Neil MacIntosh
68064d63fe
Converted all tabs to spaces in array_view.h.
2015-11-03 19:17:11 -08:00
Neil MacIntosh
e9a9602b4f
Fixed compile issues for MSVC 2013.
2015-11-03 18:56:55 -08:00
Neil MacIntosh
41517ff316
Cleaned up size_t use for ranks. Compilation fixes for non-MSVC compilers.
2015-11-04 02:11:49 +00:00
Neil MacIntosh
14d50a6f77
Minor compilation fixes and workarounds.
2015-11-03 12:44:09 -08:00
Neil MacIntosh
16d1e77568
Merge remote-tracking branch 'origin' into dev/neilmac/indextype
2015-11-02 19:01:59 -08:00
Neil MacIntosh
ba3126105b
Merge pull request #163 from archshift/patch-1
...
array_view: explicitly initialize constexpr function variables
2015-11-02 11:53:08 -08:00
archshift
b39571781e
array_view: explicitly initialize constexpr function variables
2015-11-02 11:47:14 -08:00
Neil MacIntosh
a4fa2b3bd9
Merge branch 'master' of https://github.com/Microsoft/GSL
...
Conflicts:
include/array_view.h
tests/array_view_tests.cpp
2015-10-28 16:53:53 -07:00
Matt Newport
0cbdc7036d
Fixed string_view::ensure_z() for const char*.
2015-10-26 18:23:14 -07:00
Neil MacIntosh
ace9ab9d3b
Building again. Some tests failing.
2015-10-23 19:49:17 -07:00
Kosov Eugene
561da1cd00
fix clang warning on unused function parameter
2015-10-21 13:31:00 +03:00
Anna Gringauze
1c208b33d0
Removed specializations for Rank=1
2015-10-19 14:19:46 -07:00
Neil MacIntosh
1e36db9695
Merge pull request #147 from samuel3/master
...
std::hash support for gsl::not_null.
2015-10-19 13:20:53 -07:00
Anna Gringauze
5f26ddac70
Replaced index constructor from initializer list by a constructor from static list
...
Conflicts:
include/array_view.h
2015-10-19 12:35:38 -07:00
Samuel García Salas
8e2acc9c90
std::hash support for gsl::not_null.
2015-10-17 09:28:05 +02:00
Samuel García Salas
a544ada8fe
std::hash support for gsl::not_null.
2015-10-17 08:53:58 +02:00
Anna Gringauze
a4654a46b5
Removed arrow_proxy class, fixes bugs in reverse bounds_iterator
2015-10-16 17:15:56 -07:00
Neil MacIntosh
01868f2516
Fix missing header for std::divides.
2015-10-15 16:48:38 -07:00
Neil MacIntosh
d0f09e768e
Merge branch 'master' of https://github.com/Microsoft/GSL
...
Conflicts:
include/array_view.h
2015-10-15 16:38:53 -07:00
Neil MacIntosh
f45fedbec2
Partway through removing configurable SizeType.
2015-10-15 14:29:35 -07:00
Anna Gringauze
2cdedda7e4
Adding missing include library to array_view.h
2015-10-15 13:19:24 -07:00
Anna Gringauze
fdf8643471
Fixes for gcc
2015-10-14 21:27:41 -07:00
Anna Gringauze
546f8cc130
Added tests for index size_type conversions
2015-10-12 18:35:21 -07:00
Anna Gringauze
db38497d05
Removed coordinate_facade class
2015-10-12 16:52:11 -07:00
Treb Connell
fda8e12310
Fix #124 remove maybe_null
2015-10-05 13:34:50 -07:00
Treb Connell
b8ec73a179
Fix moving a final_act twice
2015-10-02 15:58:23 -07:00
Neil MacIntosh
df88352c1d
Merge pull request #57 from kernhanda/kernhanda/use_algorithms
...
We should be using standard algorithms where possible.
2015-10-02 09:12:26 -07:00
Neil MacIntosh
d531680a31
Improved macros used for non-compliant compilers.
2015-09-30 21:54:08 -07:00
Neil MacIntosh
831c6926df
Adding noexcept to finally, final_act, narrow_cast. Fixes #92 .
2015-09-30 15:10:24 -07:00
Neil MacIntosh
d06f7ff779
Renamed Final_act to final_act as per issue #91 .
2015-09-30 12:39:18 -07:00
RicoAntonioFelix
e8ff01e543
Commit to address issue #103...
2015-09-30 12:50:42 -04:00
Neil MacIntosh
761554f68d
Correct misleading text in static_assert. Fixes issue #67 .
2015-09-29 16:54:00 -07:00
Neil MacIntosh
ef626fd33a
Renamed namespace to 'gsl'. Renamed macro to configure testing.
2015-09-29 16:41:37 -07:00
john-lynch
1d11cd1ed1
Fixing typo in move constructor implementation that resulted in compile error during tests.
2015-09-29 00:00:21 -05:00
john-lynch
422e7164d5
Fixing move constructor of Final_act to take non-const r-value reference and move properly from other Final_act object so that correctness is not dependent on copy elison.
2015-09-28 23:40:25 -05:00
Neil MacIntosh
065f4880c3
Merge pull request #88 from trebconnell/fixmaybenull
...
Fix issue #49
2015-09-28 18:54:31 -07:00
Treb Connell
444bf9640a
Fix issue #49
2015-09-28 18:49:53 -07:00
Neil MacIntosh
318cee0489
Merge pull request #87 from trebconnell/fixmaybenull
...
Fix issue #50
2015-09-28 18:40:57 -07:00
Treb Connell
b29566628e
Revert "Fix issue #49 "
...
This reverts commit a46d6fcf0d
.
2015-09-28 18:26:35 -07:00
Treb Connell
a46d6fcf0d
Fix issue #49
2015-09-28 15:17:37 -07:00
Treb Connell
27ff004e84
Merge branch 'master' into fixmaybenull
...
Conflicts:
include/gsl.h
tests/maybenull_tests.cpp
2015-09-28 14:56:08 -07:00
Kosov Eugene
e46160c18e
it's better to pass a small (e.g. 16 bytes) object by value then by const reference
2015-09-28 23:20:28 +03:00
Kosov Eugene
3402b92ef6
fix clang -Wunused-parameter warnings
2015-09-28 21:20:02 +03:00
Neil MacIntosh
3571792058
Merge pull request #78 from kernhanda/kernhanda/heterogenous-assignment-not_null
...
Add various copy assignment operators to not_null and maybe_null_*.
2015-09-28 07:05:43 -07:00
Gabriel Dos Reis
6554e83c79
Macro expand constexpr
to nothing under MSVC
...
Replace `_CONSTEXPR` with plain `constexpr`.
2015-09-28 05:10:44 -07:00
Kern Handa
7d8e609faf
Merge remote-tracking branch 'upstream/master' into kernhanda/heterogenous-assignment-not_null
2015-09-28 07:37:06 +00:00
Kern Handa
783eaabf9d
Add various copy assignment operators to not_null and maybe_null_*.
...
Also removed unused constant member variable that seemed to be there
to prevent maybe_null_* being used with anything other than a pointer,
which is being taken care of with a static_assert now.
2015-09-28 07:35:18 +00:00
Neil MacIntosh
99746e2d57
Correct fix for int/size_t mismatch.
2015-09-27 16:53:58 -07:00
Neil MacIntosh
fb91393bb2
Fixing size_t/int mismatch in loops.
2015-09-27 16:25:43 -07:00
Kern Handa
f1be21aa36
Merged Microsoft/GSL:master into branch and resolved conflicts.
2015-09-27 23:25:20 +00:00
Kern Handa
2b6d90436f
not_null and maybe_null variants should only work on nullptr-assignable types.
...
This is in accordance with the GSL.View guidance on not_null and maybe_null
types in the CppCoreGuidelines document.
2015-09-27 19:35:23 +00:00
Gabriel Dos Reis
599a354b1c
Merge pull request #59 from kernhanda/kernhanda/size_t
...
Rank and dimensions should be size_t.
2015-09-27 12:21:22 -07:00
saurabh singh
437791e504
GSL::finally can make use of move semantics
...
for eg consider this case
[code]
string value = "someVeryLongErrorMessageIAm";
finally([value] { PrintErrorMessage(value); }
[/code]
With the current changes before the call to PrintErrorMessage there will be 3 calls to copy constructor for string(1 when it's captured in closure, 2nd when finally is called and 3rd when it's passed to Final_act . With my patch there will be 1 call to the copy constructor and 2 to the move constructor for the scenario in example, so 2 potential deep copies will be saved for some objects.
Validated that code builds from root, and all tests pass after my change. Also validated that indeed copy constructor calls are saved for objects that support move semantics.
2015-09-27 16:11:12 +05:30
Kern Handa
c4f9b87d96
We should be using standard algorithms where possible.
...
Use of algorithms in the STL should be promoted where possible.
Also fixed up some whitespace issues.
2015-09-25 17:11:17 -07:00
Treb Connell
1a791992a0
Add equality operators to maybe_nul_ret
2015-09-25 12:16:39 -07:00
Kern Handa
e157026807
Rank and dimensions should be size_t.
2015-09-25 00:42:38 -07:00
Treb Connell
51da13607c
Fix issue #39 : Add header guards
2015-09-24 18:08:34 -07:00
Treb Connell
35fb11853f
Fix issues #48 #49 #50
2015-09-24 18:02:37 -07:00
Treb Connell
996aa06e08
Fix issue #45 : comparing two maybe_null_dbg's can cause fail_fast
2015-09-24 14:09:40 -07:00
galik
cb068d80cd
missing header <stdexcept>
2015-09-21 22:51:46 +01:00
Gabriel Dos Reis
65655da087
Tidy testing for _MSC_VER
2015-09-21 03:09:33 -07:00
Gabriel Dos Reis
4573197546
Merge pull request #10 from galik/master
...
Prevent unused parameter warnings and unknown #pragma warnings on GCC.
2015-09-21 01:51:22 -07:00
Neil MacIntosh
05e6b6dd4b
Added missing owner<T>, corrected array_view::sub().
2015-09-20 19:18:12 -07:00
galik
cab9bda249
Prevent unused parameter warnings and unknown #pragma warnings on GCC.
2015-09-19 07:52:30 +01:00
Anna Gringauze
9dac178768
Formatting
2015-09-14 19:08:03 -07:00
Anna Gringauze
1a86498733
Formatting
2015-09-14 18:55:06 -07:00
Neil MacIntosh
006721ce8a
Merge remote-tracking branch 'upstream/dev/annagrin/strided_array_view_bugfixes' into dev/annagrin/strided_array_view_bugfixes
...
Conflicts:
include/array_view.h
2015-09-14 17:22:56 -07:00
Anna Gringauze
e5b79d242c
Reverted formatting changes
2015-09-14 16:38:25 -07:00
Anna Gringauze
18cd9801b5
Reverted formatting changes
2015-09-14 16:34:26 -07:00
Neil MacIntosh
383dc507a4
Fixes for review feedback.
2015-09-14 15:41:40 -07:00
Neil MacIntosh
9a29712022
Ensuring compilation works for VS 2013.
2015-09-14 15:11:07 -07:00
Neil MacIntosh
ef6cc65053
Fixed compilation issues with Clang and GCC on Linux.
2015-09-14 21:26:17 +00:00
Anna Gringauze
17ed5c3664
Fixed issues in strided_array_views, added tests
2015-09-14 13:03:28 -07:00
Neil MacIntosh
75f31dabe9
Removed Debug build warnings from MSVC STL.
2015-08-27 22:15:44 -07:00
Neil MacIntosh
9b40a0a7c8
Fixed compile error with GCC/clang.
2015-08-27 19:49:27 -07:00
Neil MacIntosh
9f9fad9620
Implemented comparison operators on array_view.
2015-08-27 18:13:49 -07:00
Neil MacIntosh
a9dcbe04ff
Initial commit of library files.
2015-08-20 18:09:14 -07:00