Commit Graph

230 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
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