WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit a55931c

Browse files
committed
updated the 'make_lazy' utility
1 parent d5f1fa0 commit a55931c

File tree

5 files changed

+28
-34
lines changed

5 files changed

+28
-34
lines changed

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,6 @@ does not properly work on g++ before 4.8
163163
| clang xcode 7.3 | Darwin Kernel 15.5.0 (OSX 10.11.5) |
164164
| clang xcode 8.0 | Darwin Kernel 15.6.0 (OSX 10.11.6) |
165165

166-
### More
167-
168-
If any issues or bugs are encountered, please raise them through the [Github Issues Page](https://github.com/bitwizeshift/Lazy/issues).
169-
170-
Other than that, this library is licensed under [MIT](#S-license), so feel free to make use of it and enjoy!
171-
172166
##<a name="S-license"></a> License
173167

174168
<img align="right" src="http://opensource.org/trademarks/opensource/OSI-Approved-License-100x137.png">

include/lazy/Lazy.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ namespace lazy{
6767
//------------------------------------------------------------------------
6868
public:
6969

70-
using this_type = Lazy<T>;
70+
using this_type = Lazy<T>; ///< Instance of this type
7171

72-
using value_type = T;
73-
using pointer = T*;
74-
using reference = T&;
72+
using value_type = T; ///< The underlying type of this Lazy
73+
using pointer = T*; ///< The pointer type of the Lazy
74+
using reference = T&; ///< The reference type of the Lazy
7575

7676
//------------------------------------------------------------------------
7777
// Construction / Destruction / Assignment

include/lazy/detail/lazy_traits.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ namespace lazy{
3333
using index_sequence = integer_sequence<std::size_t,Ints...>;
3434

3535
/// \brief type-trait helper to build an integer sequence
36-
template<std::size_t N, std::size_t... Ints>
36+
template<std::size_t Start, std::size_t N, std::size_t... Ints>
3737
struct build_index_sequence
38-
: public build_index_sequence<0, N - 1, N - 1, Ints...>{};
38+
: public build_index_sequence<Start, N - 1, N - 1, Ints...>{};
3939

40-
template<std::size_t... Ints>
41-
struct build_index_sequence<0, 0, Ints...>{
40+
template<std::size_t Start, std::size_t... Ints>
41+
struct build_index_sequence<Start, Start, Ints...>{
4242
typedef index_sequence<Ints...> type;
4343
};
4444

4545
/// \brief type-trait helper to build an index sequence from 0 to N
4646
template<std::size_t N>
47-
using make_index_sequence = typename build_index_sequence<N>::type;
47+
using make_index_sequence = typename build_index_sequence<0,N>::type;
4848

4949
/// \brief type-trait helper to build an index sequence of 0 to Args indices
5050
template<typename...Args>

test/unit-casting.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ TEST_CASE("casting")
3838

3939
SECTION("operator reference()")
4040
{
41-
SECTION("lazy initialized uninitialized lazy")
41+
SECTION("lazy initializes uninitialized lazy")
4242
{ // That's a mouthful
4343
auto lazy_string = lazy::Lazy<std::string>("hello world");
4444
auto is_initialized_before = lazy_string.is_initialized();

test/unit-constructor.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ TEST_CASE("constructors")
3232
{
3333
SECTION("creates an uninitialized lazy object")
3434
{
35-
// auto create_string = [](){
36-
// return std::make_tuple("hello world",5);
37-
// };
38-
// auto destroy_string = [](std::string& str){
39-
// // do something
40-
// };
41-
// auto lazy_string = lazy::Lazy<std::string>(create_string,destroy_string);
42-
//
43-
// REQUIRE_FALSE( lazy_string.is_initialized() );
35+
auto create_string = [](){
36+
return std::make_tuple("hello world",5);
37+
};
38+
auto destroy_string = [](std::string& str){
39+
// do something
40+
};
41+
auto lazy_string = lazy::Lazy<std::string>(create_string,destroy_string);
42+
43+
REQUIRE_FALSE( lazy_string.is_initialized() );
4444
}
4545
}
4646

@@ -142,15 +142,15 @@ TEST_CASE("constructors")
142142
{
143143
SECTION("creates an uninitialized lazy object")
144144
{
145-
// auto create_string = [](){
146-
// return std::make_tuple("hello world",5);
147-
// };
148-
// auto destroy_string = [](const std::string& str){
149-
// // do something
150-
// };
151-
// auto lazy_string = lazy::Lazy<const std::string>(create_string,destroy_string);
152-
//
153-
// REQUIRE_FALSE( lazy_string.is_initialized() );
145+
auto create_string = [](){
146+
return std::make_tuple("hello world",5);
147+
};
148+
auto destroy_string = [](const std::string& str){
149+
// do something
150+
};
151+
auto lazy_string = lazy::Lazy<const std::string>(create_string,destroy_string);
152+
153+
REQUIRE_FALSE( lazy_string.is_initialized() );
154154
}
155155
}
156156

0 commit comments

Comments
 (0)