stack cleanups

master
Daniel Kolesa 2017-03-11 18:39:46 +01:00
parent c07f7d5ddc
commit b2a71d773d
2 changed files with 7 additions and 6 deletions

View File

@ -66,8 +66,8 @@ template<typename TR, bool Protected>
struct basic_fixedsize_stack {
using traits_type = TR;
basic_fixedsize_stack(size_t ss = 0) noexcept:
p_size(ss ? ss : TR::default_size())
basic_fixedsize_stack(size_t ss = TR::default_size()) noexcept:
p_size(ss)
{}
stack_context allocate() {
@ -128,12 +128,13 @@ template<typename TR>
struct basic_segmented_stack {
using traits_type = TR;
basic_segmented_stack(size_t ss = 0) noexcept:
p_size(ss ? ss : TR::default_size())
basic_segmented_stack(size_t ss = TR::default_size()) noexcept:
p_size(ss)
{}
stack_context allocate() {
size_t ss = p_size;
ss = std::clamp(ss, TR::minimum_size(), TR::maximum_size());
stack_context ret;
void *p = detail::__splitstack_makecontext(

View File

@ -336,7 +336,7 @@ public:
/* 0 means default size decided by the stack allocator */
template<typename F, typename SA = default_stack>
coroutine(F func, SA sa = SA{0}):
coroutine(F func, SA sa = SA{}):
base_t(), p_func(std::move(func))
{
/* that way there is no context creation/stack allocation */
@ -465,7 +465,7 @@ public:
generator() = delete;
template<typename F, typename SA = default_stack>
generator(F func, SA sa = SA{0}):
generator(F func, SA sa = SA{}):
base_t(), p_func(std::move(func))
{
/* that way there is no context creation/stack allocation */