Julien Monat Rodier
66cf6896e5
Updated submodule reference for unittest-cpp to latest ( #483 )
...
- updated to latest unittest-cpp
2017-04-13 10:46:31 -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
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
3819df6e37
Properly qualify std::size_t ( #448 )
2017-02-13 12:11:45 -08:00
Casey Carter
6367b42ac5
Silence warning in algorithm_tests with VS2017 ( #453 )
...
Now that the STL respects /W4, this test that uses std::copy_n to copy a span of ints to a span of chars triggers "warning C4244: '=': conversion from 'int' to 'char', possible loss of data". Switch the source & destination spans to short and int to maintain the test's cross-type nature but without narrowing.
2017-02-13 11:25:09 -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
Casey Carter
96eaf274f8
Make is_default_constructible work for spans.
2017-01-28 00:08:48 -08:00
David Doria
c52d54f955
Fix a signed/unsigned comparison warning.
2016-11-29 18:08:32 -08:00
MikeGitb
d2dafe2ddf
Add a copy() function for span.
2016-11-17 10:45:06 -08:00
Rian Quinn
2df9f85385
Add make_span()
...
This patch provides a make_span function to simplify the
creation of spans until C++17 is available. In addition
this patch updates the unit tests to includes tests that
verify this new functionality.
2016-11-16 10:17:04 -08:00
Neil MacIntosh
9523c1842e
Fix template pack expansion bug in multi_span.
...
* Fix issue #333 by moving a parenthesis.
* Added test to prove fix is good.
2016-11-16 10:15:04 -08:00
Rian Quinn
bdcef948a5
Cleanup compiler warnings
...
The unique_ptr / shared_ptr patch introduced a compiler
warning. This corrects that issue.
2016-11-16 09:42:46 -08:00
Neil MacIntosh
0d31109d41
Fixed compile flags for tests when using MSVC.
2016-11-04 14:48:22 -07:00
Rian Quinn
2b51b8767a
Add span construction from unique_ptr and shared_ptr
...
This patch adds support for std::unique_ptr and
std::shared_ptr to the gsl::span
class instead of having to manually grab the pointer via
get().
For reference, this is part of the following issue:
https://github.com/Microsoft/GSL/issues/402
2016-11-03 18:55:41 -07:00
Rian Quinn
d641796b21
Cleanup additional GCC warnings
...
When turning on the following flags, several additional warnings
were generated, which have been cleaned up in this patch. The
flags included:
-Wextra
-Wpedantic
-Wconversion
-Wsign-conversion
-Wctor-dtor-privacy
-Wshadow
-Wnon-virtual-dtor
-Wold-style-cast
-Wcast-align
-Woverloaded-virtual
2016-11-03 18:38:32 -07:00
Rian Quinn
fb1a89fb14
Fix gsl::at()'s use of size_t
...
gsl::at should use std::ptrdiff_t instead of size_t. This patch
fixes that, and adds missing unit tests
2016-10-28 11:46:14 -07:00
Rian Quinn
6cffe0d14c
Adds gsl::span::at()
...
As per this discussion:
https://github.com/Microsoft/GSL/issues/402
This patch adds support for at() to gsl::span
2016-10-26 14:11:24 -07:00
Marc Mutz
1e95421889
[ #392 ] Don't install tests
...
'make install' should install the GSL library (ie. the headers),
not the tests.
It still installs the UnitTest++ headers, but that will be more
complex to fix, as GSL just imports UnitTest++ as a git submodule,
and the install command propagates down to UnitTest++'s
CMakeLists.txt.
2016-10-17 12:42:58 -07:00
MikeGitb
1287e624cd
Address #313 : try to guard against strict-aliasing bugs with gsl::byte
...
* Add test to demonstrate byte aliasing problem on g++ and clang++
* Add note about no-strict-aliasing flag in README
* Activate aliasing unit test and use -fno-strict-aliasing flag
2016-10-17 12:36:11 -07:00
Neil MacIntosh
fd5ad87bf2
Add tests for to_integer(), fix to_integer()
2016-09-20 08:47:49 -07:00
Neil MacIntosh
e4de6cccdd
Fix wrong types in multi_span_test for comparison operators.
2016-09-20 08:46:27 -07:00
Krzysztof Wrzalik
22c2785452
Added tests for negative multi-span access.
2016-09-18 17:44:45 +02:00
Michael Balszun
95f465aeca
fix wrong types in multi_span_test (<comparison_operators>)
2016-09-17 16:09:21 +02:00
Martin Moene
ad991370da
Add tests for to_integer(): they fail
2016-09-17 09:16:15 +02:00
Neil MacIntosh
6bc1e7e709
Fix for #313 Corrected SFINAE for conversion constructors on span
2016-09-13 12:19:19 -07:00
Neil MacIntosh
3b2419532e
Corrected SFINAE for conversion constructors on span.
2016-09-12 18:51:23 -07:00
Kris
d5847ceef0
Merge remote-tracking branch 'Microsoft/master'
2016-09-07 22:16:19 +01:00
Kris Cruickshank
55b232dde4
Issue: #329
...
This is my best attempt at fixing the issues raised by @gdr-at-ms while supporting VS2013, VS2015, providing shorter syntax than the static_cast and giving developer meaningful errors when they do the wrong thing.
2016-09-07 21:38:43 +01:00
Gary Furnish
ec109d2374
Add to_basic_string
2016-09-04 00:29:10 -06:00
Kris
95bbaa1ec2
Added to_byte method for issue #329
...
I have added the to_byte method and updated the unit tests.
This gives slightly nicer syntax than static_cast, is better than the
c-style cast used in the unit test.
See: https://github.com/Microsoft/GSL/issues/329#issuecomment-240588515
2016-08-28 21:55:58 +01:00
ericLemanissier
134f2db5d9
Specialize gsl::at for span
...
span being a view and not a container, the generic version of gsl::at is not valid any more for span.
This commits adds a specialization of gsl::at for span
2016-08-23 12:18:36 +02:00
Neil MacIntosh
f3e660a5a5
Added basic test for interop with std::regex as per Issue #271 .
2016-08-10 19:39:48 -07:00
Neil MacIntosh
d6ac640271
Added basic test for interop with std::regex as per Issue #271 .
2016-08-10 19:32:00 -07:00
Neil MacIntosh
6b4ae834a3
Merge branch 'master' into dev/neilmac/iterators
2016-08-10 19:00:43 -07:00
Galik
222c2d85fd
Removed .h extension from header files.
2016-08-10 17:24:00 +01:00
Neil MacIntosh
5ebfc16f14
Merge branch 'master' into dev/neilmac/spans_in_maps
2016-08-09 18:14:11 -07:00
Neil MacIntosh
f9f08a56fa
Added test for Issue #305 .
2016-08-09 18:07:17 -07: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
32ee66d320
Added basic tests for std::begin/end and friends (Issue #252 ).
2016-08-08 13:48:12 -07:00
Neil MacIntosh
0dd5f56bed
Fixed unused variable and ran clang-format. Tested on gcc/clang.
2016-08-08 13:33:02 -07:00
Neil MacIntosh
82389aa630
Fixed up iterator implementation to allow conversion from iterator to
...
const_iterator.
2016-08-08 12:06:47 -07:00
Som1Lse
c4817358aa
Implemented https://github.com/Microsoft/GSL/issues/260
2016-08-03 22:28:25 +02: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
c366f4415d
Fixed compilation issues for GCC on Linux.
2016-07-26 18:34:27 -07:00
Neil MacIntosh
ca4cdd80de
64-bit clean fixes.
2016-07-20 12:47:21 -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
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
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
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
Sergiy Oryekhov
79030c5586
Moving submodule init before subdirectory.
2016-03-23 16:53:00 -07:00
Sergiy Oryekhov
32d00796ad
Adding unittest-cpp as a submodule.
2016-03-23 16:42:35 -07:00
Neil MacIntosh
85939048b4
Test for operator function call.
2016-03-18 16:53:16 -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
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
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
b4ff206c24
Added zstring_span and removed zstring_builder to support legacy strings
2016-02-03 19:30:34 -08:00
Anna Gringauze
eb05256ffe
Fixed compilation issues in MSVC 2013
2015-12-14 20:43:58 -08:00
Anna Gringauze
87c5daa6c4
Fixed operators and constructors for string_span
2015-12-07 00:14:25 -08:00
Anna Gringauze
4efa9e8f07
Run clang format
2015-12-02 12:43:45 -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
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
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
b9565e50ce
Update CMakeLists.txt
2015-11-12 19:36:34 -08:00
Neil MacIntosh
fa056f67e8
Enabled -Wall for gcc and clang.
2015-11-13 03:27:53 +00:00
Neil MacIntosh
a998a9b33b
Turned on Level 3 warnings for MSVC.
2015-11-12 18:57:23 -08: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
dbf0d5017c
Reactivated tests disabled during development.
2015-11-04 12:17:41 -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
16d1e77568
Merge remote-tracking branch 'origin' into dev/neilmac/indextype
2015-11-02 19:01:59 -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
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
Anna Gringauze
a4654a46b5
Removed arrow_proxy class, fixes bugs in reverse bounds_iterator
2015-10-16 17:15:56 -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
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
kkoenig
144ee44132
First arg of vector ctor should be num elements, second should be value. Fixes issue #121
2015-10-03 22:02:49 -07:00
Treb Connell
b8ec73a179
Fix moving a final_act twice
2015-10-02 15:58:23 -07:00
Neil MacIntosh
ef626fd33a
Renamed namespace to 'gsl'. Renamed macro to configure testing.
2015-09-29 16:41:37 -07:00
john-lynch
ae24c0fe06
Added test that Final_act object can be moved properly. While this is not a common case, it may happen if the user calls finally and the compiler fails to perform RVO.
2015-09-29 00:03:15 -05:00
Treb Connell
444bf9640a
Fix issue #49
2015-09-28 18:49:53 -07:00
Treb Connell
83333419de
Add test that reproduces issue
2015-09-28 18:34:04 -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
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
bb169976da
Fixed leak in owner<> test. Ha ha ha!
2015-09-27 18:06:51 -07: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
Neil MacIntosh
8ae77b1fd5
Merge pull request #46 from trebconnell/fixmaybenull
...
Fix issue #45 : comparing two maybe_null_dbg's can cause fail_fast
2015-09-24 15:22:43 -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
Tamas Kenez
9b454b7a9b
add travis testing (gcc5, clang36)
...
- also relaxed CMake version to 2.8.7, the version default in travis
2015-09-23 17:43:36 +02:00
David Capello
5d9aae7430
Add add_gsl_test() function in tests/CMakeLists.txt
...
With this function we can avoid duplicated code to add a new test.
2015-09-21 16:04:06 -03:00
Neil MacIntosh
05e6b6dd4b
Added missing owner<T>, corrected array_view::sub().
2015-09-20 19:18:12 -07:00
Anna Gringauze
1a86498733
Formatting
2015-09-14 18:55:06 -07:00
Neil MacIntosh
54ec02fef6
Fixing misformatting of ArrayViewComparison.
2015-09-14 18:04:40 -07:00
Neil MacIntosh
3ff9b17a9f
Restoring empty_array_view tests.
2015-09-14 17:57:29 -07:00
Neil MacIntosh
c6a2f8c086
Testing tab fixup.
2015-09-14 17:51:31 -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
9f9fad9620
Implemented comparison operators on array_view.
2015-08-27 18:13:49 -07:00
Anna Gringauze
5e945461c9
Fixed unittest directory check to look in the source directory
2015-08-25 11:50:58 -07:00
Neil MacIntosh
a9dcbe04ff
Initial commit of library files.
2015-08-20 18:09:14 -07:00