Skip to content

Commit 0131a63

Browse files
committed
Make function::base private
This diff removes the `function::base` nested alias from `function`'s public interface.
1 parent cf9d2ca commit 0131a63

2 files changed

Lines changed: 32 additions & 14 deletions

File tree

include/exec/function.hpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,15 @@ namespace experimental::execution
376376
: _func::_func_impl<STDEXEC::sender_tag(Args...), _func::_sigs_from_t<Return, false>, queries<>>
377377
, _func::_func_ops_crtp<function<Return(Args...)>>
378378
{
379+
private:
379380
using base = _func::_func_impl<STDEXEC::sender_tag(Args...),
380381
_func::_sigs_from_t<Return, false>,
381382
queries<>>;
382383

384+
template <class, class, template <class> class, template <class> class>
385+
friend struct std::basic_common_reference;
386+
387+
public:
383388
using base::base;
384389
};
385390

@@ -388,9 +393,14 @@ namespace experimental::execution
388393
: _func::_func_impl<STDEXEC::sender_tag(Args...), _func::_sigs_from_t<Return, true>, queries<>>
389394
, _func::_func_ops_crtp<function<Return(Args...) noexcept>>
390395
{
396+
private:
391397
using base =
392398
_func::_func_impl<STDEXEC::sender_tag(Args...), _func::_sigs_from_t<Return, true>, queries<>>;
393399

400+
template <class, class, template <class> class, template <class> class>
401+
friend struct std::basic_common_reference;
402+
403+
public:
394404
using base::base;
395405
};
396406

@@ -400,9 +410,14 @@ namespace experimental::execution
400410
: _func::_func_impl<STDEXEC::sender_tag(Args...), _func::_canonical_t<Sigs>, queries<>>
401411
, _func::_func_ops_crtp<function<STDEXEC::sender_tag(Args...), Sigs>>
402412
{
413+
private:
403414
using base =
404415
_func::_func_impl<STDEXEC::sender_tag(Args...), _func::_canonical_t<Sigs>, queries<>>;
405416

417+
template <class, class, template <class> class, template <class> class>
418+
friend struct std::basic_common_reference;
419+
420+
public:
406421
using base::base;
407422
};
408423

@@ -413,10 +428,15 @@ namespace experimental::execution
413428
_func::_canonical_t<queries<Queries...>>>
414429
, _func::_func_ops_crtp<function<Return(Args...), queries<Queries...>>>
415430
{
431+
private:
416432
using base = _func::_func_impl<STDEXEC::sender_tag(Args...),
417433
_func::_sigs_from_t<Return, false>,
418434
_func::_canonical_t<queries<Queries...>>>;
419435

436+
template <class, class, template <class> class, template <class> class>
437+
friend struct std::basic_common_reference;
438+
439+
public:
420440
using base::base;
421441
};
422442

@@ -427,10 +447,15 @@ namespace experimental::execution
427447
_func::_canonical_t<queries<Queries...>>>
428448
, _func::_func_ops_crtp<function<Return(Args...) noexcept, queries<Queries...>>>
429449
{
450+
private:
430451
using base = _func::_func_impl<STDEXEC::sender_tag(Args...),
431452
_func::_sigs_from_t<Return, true>,
432453
_func::_canonical_t<queries<Queries...>>>;
433454

455+
template <class, class, template <class> class, template <class> class>
456+
friend struct std::basic_common_reference;
457+
458+
public:
434459
using base::base;
435460
};
436461

@@ -445,10 +470,15 @@ namespace experimental::execution
445470
STDEXEC::completion_signatures<Sigs...>,
446471
queries<Queries...>>>
447472
{
473+
private:
448474
using base = _func::_func_impl<STDEXEC::sender_tag(Args...),
449475
_func::_canonical_t<STDEXEC::completion_signatures<Sigs...>>,
450476
_func::_canonical_t<queries<Queries...>>>;
451477

478+
template <class, class, template <class> class, template <class> class>
479+
friend struct std::basic_common_reference;
480+
481+
public:
452482
using base::base;
453483
};
454484
} // namespace experimental::execution

test/exec/test_function.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -297,20 +297,13 @@ namespace
297297
exec::function<ex::sender_tag(int),
298298
ex::completion_signatures<ex::set_stopped_t(), ex::set_value_t(int)>>;
299299

300-
SECTION("the function types are not the same as each other...")
300+
SECTION("the function types are not the same as each other")
301301
{
302302
STATIC_REQUIRE(!std::same_as<func1_t, func2_t>);
303303
STATIC_REQUIRE(!std::same_as<func1_t, func3_t>);
304304
STATIC_REQUIRE(!std::same_as<func2_t, func3_t>);
305305
}
306306

307-
SECTION("...but they all inherit from the same _func_impl base")
308-
{
309-
STATIC_REQUIRE(std::same_as<func1_t::base, func2_t::base>);
310-
STATIC_REQUIRE(std::same_as<func1_t::base, func3_t::base>);
311-
STATIC_REQUIRE(std::same_as<func2_t::base, func3_t::base>);
312-
}
313-
314307
SECTION("move-construction works in every direction between all three types")
315308
{
316309
STATIC_REQUIRE(std::constructible_from<func1_t, func1_t>);
@@ -385,16 +378,11 @@ namespace
385378
using func2_t =
386379
exec::function<int(int), exec::queries<double(query2_t, int), int(query1_t) noexcept>>;
387380

388-
SECTION("the function types are not the same as each other...")
381+
SECTION("the function types are not the same as each other")
389382
{
390383
STATIC_REQUIRE(!std::same_as<func1_t, func2_t>);
391384
}
392385

393-
SECTION("...but they both inherit from the same _func_impl base")
394-
{
395-
STATIC_REQUIRE(std::same_as<func1_t::base, func2_t::base>);
396-
}
397-
398386
SECTION("move construction works in all directions with both types")
399387
{
400388
STATIC_REQUIRE(std::constructible_from<func1_t, func1_t>);

0 commit comments

Comments
 (0)