Commit Graph

133 Commits

Author SHA1 Message Date
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