Skip to content

Commit

Permalink
updated the 'make_lazy' utility
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwizeshift committed Aug 8, 2016
1 parent d5f1fa0 commit a55931c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 34 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,6 @@ does not properly work on g++ before 4.8
| clang xcode 7.3 | Darwin Kernel 15.5.0 (OSX 10.11.5) |
| clang xcode 8.0 | Darwin Kernel 15.6.0 (OSX 10.11.6) |

### More

If any issues or bugs are encountered, please raise them through the [Github Issues Page](https://github.com/bitwizeshift/Lazy/issues).

Other than that, this library is licensed under [MIT](#S-license), so feel free to make use of it and enjoy!

##<a name="S-license"></a> License

<img align="right" src="http://opensource.org/trademarks/opensource/OSI-Approved-License-100x137.png">
Expand Down
8 changes: 4 additions & 4 deletions include/lazy/Lazy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ namespace lazy{
//------------------------------------------------------------------------
public:

using this_type = Lazy<T>;
using this_type = Lazy<T>; ///< Instance of this type

using value_type = T;
using pointer = T*;
using reference = T&;
using value_type = T; ///< The underlying type of this Lazy
using pointer = T*; ///< The pointer type of the Lazy
using reference = T&; ///< The reference type of the Lazy

//------------------------------------------------------------------------
// Construction / Destruction / Assignment
Expand Down
10 changes: 5 additions & 5 deletions include/lazy/detail/lazy_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ namespace lazy{
using index_sequence = integer_sequence<std::size_t,Ints...>;

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

template<std::size_t... Ints>
struct build_index_sequence<0, 0, Ints...>{
template<std::size_t Start, std::size_t... Ints>
struct build_index_sequence<Start, Start, Ints...>{
typedef index_sequence<Ints...> type;
};

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

/// \brief type-trait helper to build an index sequence of 0 to Args indices
template<typename...Args>
Expand Down
2 changes: 1 addition & 1 deletion test/unit-casting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ TEST_CASE("casting")

SECTION("operator reference()")
{
SECTION("lazy initialized uninitialized lazy")
SECTION("lazy initializes uninitialized lazy")
{ // That's a mouthful
auto lazy_string = lazy::Lazy<std::string>("hello world");
auto is_initialized_before = lazy_string.is_initialized();
Expand Down
36 changes: 18 additions & 18 deletions test/unit-constructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ TEST_CASE("constructors")
{
SECTION("creates an uninitialized lazy object")
{
// auto create_string = [](){
// return std::make_tuple("hello world",5);
// };
// auto destroy_string = [](std::string& str){
// // do something
// };
// auto lazy_string = lazy::Lazy<std::string>(create_string,destroy_string);
//
// REQUIRE_FALSE( lazy_string.is_initialized() );
auto create_string = [](){
return std::make_tuple("hello world",5);
};
auto destroy_string = [](std::string& str){
// do something
};
auto lazy_string = lazy::Lazy<std::string>(create_string,destroy_string);

REQUIRE_FALSE( lazy_string.is_initialized() );
}
}

Expand Down Expand Up @@ -142,15 +142,15 @@ TEST_CASE("constructors")
{
SECTION("creates an uninitialized lazy object")
{
// auto create_string = [](){
// return std::make_tuple("hello world",5);
// };
// auto destroy_string = [](const std::string& str){
// // do something
// };
// auto lazy_string = lazy::Lazy<const std::string>(create_string,destroy_string);
//
// REQUIRE_FALSE( lazy_string.is_initialized() );
auto create_string = [](){
return std::make_tuple("hello world",5);
};
auto destroy_string = [](const std::string& str){
// do something
};
auto lazy_string = lazy::Lazy<const std::string>(create_string,destroy_string);

REQUIRE_FALSE( lazy_string.is_initialized() );
}
}

Expand Down

0 comments on commit a55931c

Please sign in to comment.