Skip to content

Commit

Permalink
Implement LWG2367, SFINAE for tuple default constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
K-ballo committed Apr 23, 2016
1 parent 6b65347 commit caf9958
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions hpx/util/tuple.hpp
Expand Up @@ -361,6 +361,13 @@ namespace hpx { namespace util

// constexpr tuple();
// Value initializes each element.
template <typename Delay = int, typename Enable =
typename std::enable_if<
detail::all_of<
std::is_constructible<Delay>,
std::is_constructible<Ts>...
>::value
>::type>
HPX_CONSTEXPR tuple()
: _impl()
{}
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/util/tuple.cpp
Expand Up @@ -16,6 +16,7 @@
#include "boost/type_traits/is_const.hpp"
#include "boost/ref.hpp"
#include <string>
#include <type_traits>
#include <utility>

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -131,8 +132,8 @@ void construction_test()
dummy(hpx::util::tuple<int, double>(1,3.14));


//dummy(hpx::util::tuple<double&>()); // should fail, not defaults for references
//dummy(hpx::util::tuple<const double&>()); // likewise
HPX_TEST(std::is_constructible<hpx::util::tuple<double&> >() == false);
HPX_TEST(std::is_constructible<hpx::util::tuple<const double&> >() == false);

double dd = 5;
dummy(hpx::util::tuple<double&>(dd)); // ok
Expand Down

0 comments on commit caf9958

Please sign in to comment.