rvalue qualified method and const expression
How can I make a const rvalue in a natural way?
Here is a simple example :
struct A {
void f() &&{} // 1
constexpr bool f() const &{return true;} // 2
constexpr bool f() const &&{return true;} // 3 really usefull?
};
int main() {
static_assert(A{}.f()); // does not compile because call 1 instead of 3
constexpr A a;
static_assert(a.f());
}
Why does the first static_assert() call 1 instead of 3?
c++ c++11 c++17 constexpr
|
show 1 more comment
How can I make a const rvalue in a natural way?
Here is a simple example :
struct A {
void f() &&{} // 1
constexpr bool f() const &{return true;} // 2
constexpr bool f() const &&{return true;} // 3 really usefull?
};
int main() {
static_assert(A{}.f()); // does not compile because call 1 instead of 3
constexpr A a;
static_assert(a.f());
}
Why does the first static_assert() call 1 instead of 3?
c++ c++11 c++17 constexpr
What's the question, exactly?
– T.C.
Nov 26 '18 at 22:24
Are you asking how to declare aconst rvalue?
– NathanOliver
Nov 26 '18 at 22:24
1
sorry but... you're checkingstatic_assert()s withconstexprreturningvoid?
– max66
Nov 26 '18 at 22:24
The question is, how can I make rvalue object works on a const expression
– Antoine Morrier
Nov 26 '18 at 22:24
@max66 it is a simple question, maybe the static_assert is not useful here
– Antoine Morrier
Nov 26 '18 at 22:25
|
show 1 more comment
How can I make a const rvalue in a natural way?
Here is a simple example :
struct A {
void f() &&{} // 1
constexpr bool f() const &{return true;} // 2
constexpr bool f() const &&{return true;} // 3 really usefull?
};
int main() {
static_assert(A{}.f()); // does not compile because call 1 instead of 3
constexpr A a;
static_assert(a.f());
}
Why does the first static_assert() call 1 instead of 3?
c++ c++11 c++17 constexpr
How can I make a const rvalue in a natural way?
Here is a simple example :
struct A {
void f() &&{} // 1
constexpr bool f() const &{return true;} // 2
constexpr bool f() const &&{return true;} // 3 really usefull?
};
int main() {
static_assert(A{}.f()); // does not compile because call 1 instead of 3
constexpr A a;
static_assert(a.f());
}
Why does the first static_assert() call 1 instead of 3?
c++ c++11 c++17 constexpr
c++ c++11 c++17 constexpr
edited Nov 27 '18 at 2:45
max66
36.8k74166
36.8k74166
asked Nov 26 '18 at 22:22
Antoine MorrierAntoine Morrier
2,065719
2,065719
What's the question, exactly?
– T.C.
Nov 26 '18 at 22:24
Are you asking how to declare aconst rvalue?
– NathanOliver
Nov 26 '18 at 22:24
1
sorry but... you're checkingstatic_assert()s withconstexprreturningvoid?
– max66
Nov 26 '18 at 22:24
The question is, how can I make rvalue object works on a const expression
– Antoine Morrier
Nov 26 '18 at 22:24
@max66 it is a simple question, maybe the static_assert is not useful here
– Antoine Morrier
Nov 26 '18 at 22:25
|
show 1 more comment
What's the question, exactly?
– T.C.
Nov 26 '18 at 22:24
Are you asking how to declare aconst rvalue?
– NathanOliver
Nov 26 '18 at 22:24
1
sorry but... you're checkingstatic_assert()s withconstexprreturningvoid?
– max66
Nov 26 '18 at 22:24
The question is, how can I make rvalue object works on a const expression
– Antoine Morrier
Nov 26 '18 at 22:24
@max66 it is a simple question, maybe the static_assert is not useful here
– Antoine Morrier
Nov 26 '18 at 22:25
What's the question, exactly?
– T.C.
Nov 26 '18 at 22:24
What's the question, exactly?
– T.C.
Nov 26 '18 at 22:24
Are you asking how to declare a
const rvalue?– NathanOliver
Nov 26 '18 at 22:24
Are you asking how to declare a
const rvalue?– NathanOliver
Nov 26 '18 at 22:24
1
1
sorry but... you're checking
static_assert()s with constexpr returning void ?– max66
Nov 26 '18 at 22:24
sorry but... you're checking
static_assert()s with constexpr returning void ?– max66
Nov 26 '18 at 22:24
The question is, how can I make rvalue object works on a const expression
– Antoine Morrier
Nov 26 '18 at 22:24
The question is, how can I make rvalue object works on a const expression
– Antoine Morrier
Nov 26 '18 at 22:24
@max66 it is a simple question, maybe the static_assert is not useful here
– Antoine Morrier
Nov 26 '18 at 22:25
@max66 it is a simple question, maybe the static_assert is not useful here
– Antoine Morrier
Nov 26 '18 at 22:25
|
show 1 more comment
3 Answers
3
active
oldest
votes
The issue here is A{} doesn't give you a const A, it just gives you an A so 2 gets called since it is callable on a non const rvalue.
If you want 4 to be called you need to make a const A and you can do that using an alias declaration. If you have using A_const = const A; then A_const{} gives you a const A and A_const{}.f() will call 4 instead of 2.
Essentially what it does is static_assert(const A{}.f());, but since syntactically you can't write it that way we need to using declaration to give us a single word type that is a const A.
Additionally you could rewrite
static_assert(A{}.f());
as
static_assert(std::add_const_t<A>{}.f());
and also get a const A rvalue.
So there is no way to write it in a natural way?
– Antoine Morrier
Nov 26 '18 at 22:31
@AntoineMorrier No, The C++ syntax does not allow you to writestatic_assert(const A{}.f());
– NathanOliver
Nov 26 '18 at 22:32
So note: This is not a language limitation, it's a parsing limitation. You can solve it using an alias.
– N00byEdge
Nov 26 '18 at 22:33
I think I should try to not use ref qualified methods, making an alias is not a good solution for me :). Thanks ;)
– Antoine Morrier
Nov 26 '18 at 22:33
1
@AntoineMorrier Just remember you can't move something that isconst/constexprso havingconst &&is basically useless.
– NathanOliver
Nov 26 '18 at 22:47
|
show 4 more comments
The question is, how can I make rvalue object works on a const expression
Another way can be through a constexpr function returning an A const
#include <iostream>
struct A
{
std::size_t f() & { return 1u; }
std::size_t f() && { return 2u; }
constexpr std::size_t f() const & {return 3u; }
constexpr std::size_t f() const && {return 4u; }
};
constexpr A const foo ()
{ return {}; }
int main()
{
static_assert( foo().f() == 4u, "!" );
}
add a comment |
Maybe this does what you want?
struct A {
constexpr bool f() &&{return true;} // 1
constexpr bool f() const &{return true;} // 2
constexpr bool f() const &&{return true;} // 3 really usefull?
};
int main() {
static_assert(A{}.f()); // does not compile because call 1 instead of 3
constexpr A a;
static_assert(a.f());
}
No, because in your case, A{}.f still call 1, that is not constexpr. However, it could be good for my use, because making constexpr f() && is not that absurd since I am dealing with template. So thanks
– Antoine Morrier
Nov 26 '18 at 22:41
@AntoineMorrier - well... (1) isconstexpr. I suppose doesn't works in C++11 (where aconstexprmethod is automatically alsoconst) but should works in C++14 and C++17.
– max66
Nov 26 '18 at 22:50
Thanks for the information :). It works perfectly well. I remember have seen an article where it was explained that constexpr does not mean const method in C++14 yes. Thanks for the remaining :)
– Antoine Morrier
Nov 26 '18 at 22:59
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53490019%2frvalue-qualified-method-and-const-expression%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
The issue here is A{} doesn't give you a const A, it just gives you an A so 2 gets called since it is callable on a non const rvalue.
If you want 4 to be called you need to make a const A and you can do that using an alias declaration. If you have using A_const = const A; then A_const{} gives you a const A and A_const{}.f() will call 4 instead of 2.
Essentially what it does is static_assert(const A{}.f());, but since syntactically you can't write it that way we need to using declaration to give us a single word type that is a const A.
Additionally you could rewrite
static_assert(A{}.f());
as
static_assert(std::add_const_t<A>{}.f());
and also get a const A rvalue.
So there is no way to write it in a natural way?
– Antoine Morrier
Nov 26 '18 at 22:31
@AntoineMorrier No, The C++ syntax does not allow you to writestatic_assert(const A{}.f());
– NathanOliver
Nov 26 '18 at 22:32
So note: This is not a language limitation, it's a parsing limitation. You can solve it using an alias.
– N00byEdge
Nov 26 '18 at 22:33
I think I should try to not use ref qualified methods, making an alias is not a good solution for me :). Thanks ;)
– Antoine Morrier
Nov 26 '18 at 22:33
1
@AntoineMorrier Just remember you can't move something that isconst/constexprso havingconst &&is basically useless.
– NathanOliver
Nov 26 '18 at 22:47
|
show 4 more comments
The issue here is A{} doesn't give you a const A, it just gives you an A so 2 gets called since it is callable on a non const rvalue.
If you want 4 to be called you need to make a const A and you can do that using an alias declaration. If you have using A_const = const A; then A_const{} gives you a const A and A_const{}.f() will call 4 instead of 2.
Essentially what it does is static_assert(const A{}.f());, but since syntactically you can't write it that way we need to using declaration to give us a single word type that is a const A.
Additionally you could rewrite
static_assert(A{}.f());
as
static_assert(std::add_const_t<A>{}.f());
and also get a const A rvalue.
So there is no way to write it in a natural way?
– Antoine Morrier
Nov 26 '18 at 22:31
@AntoineMorrier No, The C++ syntax does not allow you to writestatic_assert(const A{}.f());
– NathanOliver
Nov 26 '18 at 22:32
So note: This is not a language limitation, it's a parsing limitation. You can solve it using an alias.
– N00byEdge
Nov 26 '18 at 22:33
I think I should try to not use ref qualified methods, making an alias is not a good solution for me :). Thanks ;)
– Antoine Morrier
Nov 26 '18 at 22:33
1
@AntoineMorrier Just remember you can't move something that isconst/constexprso havingconst &&is basically useless.
– NathanOliver
Nov 26 '18 at 22:47
|
show 4 more comments
The issue here is A{} doesn't give you a const A, it just gives you an A so 2 gets called since it is callable on a non const rvalue.
If you want 4 to be called you need to make a const A and you can do that using an alias declaration. If you have using A_const = const A; then A_const{} gives you a const A and A_const{}.f() will call 4 instead of 2.
Essentially what it does is static_assert(const A{}.f());, but since syntactically you can't write it that way we need to using declaration to give us a single word type that is a const A.
Additionally you could rewrite
static_assert(A{}.f());
as
static_assert(std::add_const_t<A>{}.f());
and also get a const A rvalue.
The issue here is A{} doesn't give you a const A, it just gives you an A so 2 gets called since it is callable on a non const rvalue.
If you want 4 to be called you need to make a const A and you can do that using an alias declaration. If you have using A_const = const A; then A_const{} gives you a const A and A_const{}.f() will call 4 instead of 2.
Essentially what it does is static_assert(const A{}.f());, but since syntactically you can't write it that way we need to using declaration to give us a single word type that is a const A.
Additionally you could rewrite
static_assert(A{}.f());
as
static_assert(std::add_const_t<A>{}.f());
and also get a const A rvalue.
edited Nov 26 '18 at 22:37
answered Nov 26 '18 at 22:30
NathanOliverNathanOliver
92.6k16129195
92.6k16129195
So there is no way to write it in a natural way?
– Antoine Morrier
Nov 26 '18 at 22:31
@AntoineMorrier No, The C++ syntax does not allow you to writestatic_assert(const A{}.f());
– NathanOliver
Nov 26 '18 at 22:32
So note: This is not a language limitation, it's a parsing limitation. You can solve it using an alias.
– N00byEdge
Nov 26 '18 at 22:33
I think I should try to not use ref qualified methods, making an alias is not a good solution for me :). Thanks ;)
– Antoine Morrier
Nov 26 '18 at 22:33
1
@AntoineMorrier Just remember you can't move something that isconst/constexprso havingconst &&is basically useless.
– NathanOliver
Nov 26 '18 at 22:47
|
show 4 more comments
So there is no way to write it in a natural way?
– Antoine Morrier
Nov 26 '18 at 22:31
@AntoineMorrier No, The C++ syntax does not allow you to writestatic_assert(const A{}.f());
– NathanOliver
Nov 26 '18 at 22:32
So note: This is not a language limitation, it's a parsing limitation. You can solve it using an alias.
– N00byEdge
Nov 26 '18 at 22:33
I think I should try to not use ref qualified methods, making an alias is not a good solution for me :). Thanks ;)
– Antoine Morrier
Nov 26 '18 at 22:33
1
@AntoineMorrier Just remember you can't move something that isconst/constexprso havingconst &&is basically useless.
– NathanOliver
Nov 26 '18 at 22:47
So there is no way to write it in a natural way?
– Antoine Morrier
Nov 26 '18 at 22:31
So there is no way to write it in a natural way?
– Antoine Morrier
Nov 26 '18 at 22:31
@AntoineMorrier No, The C++ syntax does not allow you to write
static_assert(const A{}.f());– NathanOliver
Nov 26 '18 at 22:32
@AntoineMorrier No, The C++ syntax does not allow you to write
static_assert(const A{}.f());– NathanOliver
Nov 26 '18 at 22:32
So note: This is not a language limitation, it's a parsing limitation. You can solve it using an alias.
– N00byEdge
Nov 26 '18 at 22:33
So note: This is not a language limitation, it's a parsing limitation. You can solve it using an alias.
– N00byEdge
Nov 26 '18 at 22:33
I think I should try to not use ref qualified methods, making an alias is not a good solution for me :). Thanks ;)
– Antoine Morrier
Nov 26 '18 at 22:33
I think I should try to not use ref qualified methods, making an alias is not a good solution for me :). Thanks ;)
– Antoine Morrier
Nov 26 '18 at 22:33
1
1
@AntoineMorrier Just remember you can't move something that is
const/constexpr so having const && is basically useless.– NathanOliver
Nov 26 '18 at 22:47
@AntoineMorrier Just remember you can't move something that is
const/constexpr so having const && is basically useless.– NathanOliver
Nov 26 '18 at 22:47
|
show 4 more comments
The question is, how can I make rvalue object works on a const expression
Another way can be through a constexpr function returning an A const
#include <iostream>
struct A
{
std::size_t f() & { return 1u; }
std::size_t f() && { return 2u; }
constexpr std::size_t f() const & {return 3u; }
constexpr std::size_t f() const && {return 4u; }
};
constexpr A const foo ()
{ return {}; }
int main()
{
static_assert( foo().f() == 4u, "!" );
}
add a comment |
The question is, how can I make rvalue object works on a const expression
Another way can be through a constexpr function returning an A const
#include <iostream>
struct A
{
std::size_t f() & { return 1u; }
std::size_t f() && { return 2u; }
constexpr std::size_t f() const & {return 3u; }
constexpr std::size_t f() const && {return 4u; }
};
constexpr A const foo ()
{ return {}; }
int main()
{
static_assert( foo().f() == 4u, "!" );
}
add a comment |
The question is, how can I make rvalue object works on a const expression
Another way can be through a constexpr function returning an A const
#include <iostream>
struct A
{
std::size_t f() & { return 1u; }
std::size_t f() && { return 2u; }
constexpr std::size_t f() const & {return 3u; }
constexpr std::size_t f() const && {return 4u; }
};
constexpr A const foo ()
{ return {}; }
int main()
{
static_assert( foo().f() == 4u, "!" );
}
The question is, how can I make rvalue object works on a const expression
Another way can be through a constexpr function returning an A const
#include <iostream>
struct A
{
std::size_t f() & { return 1u; }
std::size_t f() && { return 2u; }
constexpr std::size_t f() const & {return 3u; }
constexpr std::size_t f() const && {return 4u; }
};
constexpr A const foo ()
{ return {}; }
int main()
{
static_assert( foo().f() == 4u, "!" );
}
answered Nov 26 '18 at 22:35
max66max66
36.8k74166
36.8k74166
add a comment |
add a comment |
Maybe this does what you want?
struct A {
constexpr bool f() &&{return true;} // 1
constexpr bool f() const &{return true;} // 2
constexpr bool f() const &&{return true;} // 3 really usefull?
};
int main() {
static_assert(A{}.f()); // does not compile because call 1 instead of 3
constexpr A a;
static_assert(a.f());
}
No, because in your case, A{}.f still call 1, that is not constexpr. However, it could be good for my use, because making constexpr f() && is not that absurd since I am dealing with template. So thanks
– Antoine Morrier
Nov 26 '18 at 22:41
@AntoineMorrier - well... (1) isconstexpr. I suppose doesn't works in C++11 (where aconstexprmethod is automatically alsoconst) but should works in C++14 and C++17.
– max66
Nov 26 '18 at 22:50
Thanks for the information :). It works perfectly well. I remember have seen an article where it was explained that constexpr does not mean const method in C++14 yes. Thanks for the remaining :)
– Antoine Morrier
Nov 26 '18 at 22:59
add a comment |
Maybe this does what you want?
struct A {
constexpr bool f() &&{return true;} // 1
constexpr bool f() const &{return true;} // 2
constexpr bool f() const &&{return true;} // 3 really usefull?
};
int main() {
static_assert(A{}.f()); // does not compile because call 1 instead of 3
constexpr A a;
static_assert(a.f());
}
No, because in your case, A{}.f still call 1, that is not constexpr. However, it could be good for my use, because making constexpr f() && is not that absurd since I am dealing with template. So thanks
– Antoine Morrier
Nov 26 '18 at 22:41
@AntoineMorrier - well... (1) isconstexpr. I suppose doesn't works in C++11 (where aconstexprmethod is automatically alsoconst) but should works in C++14 and C++17.
– max66
Nov 26 '18 at 22:50
Thanks for the information :). It works perfectly well. I remember have seen an article where it was explained that constexpr does not mean const method in C++14 yes. Thanks for the remaining :)
– Antoine Morrier
Nov 26 '18 at 22:59
add a comment |
Maybe this does what you want?
struct A {
constexpr bool f() &&{return true;} // 1
constexpr bool f() const &{return true;} // 2
constexpr bool f() const &&{return true;} // 3 really usefull?
};
int main() {
static_assert(A{}.f()); // does not compile because call 1 instead of 3
constexpr A a;
static_assert(a.f());
}
Maybe this does what you want?
struct A {
constexpr bool f() &&{return true;} // 1
constexpr bool f() const &{return true;} // 2
constexpr bool f() const &&{return true;} // 3 really usefull?
};
int main() {
static_assert(A{}.f()); // does not compile because call 1 instead of 3
constexpr A a;
static_assert(a.f());
}
answered Nov 26 '18 at 22:38
RichardRichard
8,84721423
8,84721423
No, because in your case, A{}.f still call 1, that is not constexpr. However, it could be good for my use, because making constexpr f() && is not that absurd since I am dealing with template. So thanks
– Antoine Morrier
Nov 26 '18 at 22:41
@AntoineMorrier - well... (1) isconstexpr. I suppose doesn't works in C++11 (where aconstexprmethod is automatically alsoconst) but should works in C++14 and C++17.
– max66
Nov 26 '18 at 22:50
Thanks for the information :). It works perfectly well. I remember have seen an article where it was explained that constexpr does not mean const method in C++14 yes. Thanks for the remaining :)
– Antoine Morrier
Nov 26 '18 at 22:59
add a comment |
No, because in your case, A{}.f still call 1, that is not constexpr. However, it could be good for my use, because making constexpr f() && is not that absurd since I am dealing with template. So thanks
– Antoine Morrier
Nov 26 '18 at 22:41
@AntoineMorrier - well... (1) isconstexpr. I suppose doesn't works in C++11 (where aconstexprmethod is automatically alsoconst) but should works in C++14 and C++17.
– max66
Nov 26 '18 at 22:50
Thanks for the information :). It works perfectly well. I remember have seen an article where it was explained that constexpr does not mean const method in C++14 yes. Thanks for the remaining :)
– Antoine Morrier
Nov 26 '18 at 22:59
No, because in your case, A{}.f still call 1, that is not constexpr. However, it could be good for my use, because making constexpr f() && is not that absurd since I am dealing with template. So thanks
– Antoine Morrier
Nov 26 '18 at 22:41
No, because in your case, A{}.f still call 1, that is not constexpr. However, it could be good for my use, because making constexpr f() && is not that absurd since I am dealing with template. So thanks
– Antoine Morrier
Nov 26 '18 at 22:41
@AntoineMorrier - well... (1) is
constexpr. I suppose doesn't works in C++11 (where a constexpr method is automatically also const) but should works in C++14 and C++17.– max66
Nov 26 '18 at 22:50
@AntoineMorrier - well... (1) is
constexpr. I suppose doesn't works in C++11 (where a constexpr method is automatically also const) but should works in C++14 and C++17.– max66
Nov 26 '18 at 22:50
Thanks for the information :). It works perfectly well. I remember have seen an article where it was explained that constexpr does not mean const method in C++14 yes. Thanks for the remaining :)
– Antoine Morrier
Nov 26 '18 at 22:59
Thanks for the information :). It works perfectly well. I remember have seen an article where it was explained that constexpr does not mean const method in C++14 yes. Thanks for the remaining :)
– Antoine Morrier
Nov 26 '18 at 22:59
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53490019%2frvalue-qualified-method-and-const-expression%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What's the question, exactly?
– T.C.
Nov 26 '18 at 22:24
Are you asking how to declare a
const rvalue?– NathanOliver
Nov 26 '18 at 22:24
1
sorry but... you're checking
static_assert()s withconstexprreturningvoid?– max66
Nov 26 '18 at 22:24
The question is, how can I make rvalue object works on a const expression
– Antoine Morrier
Nov 26 '18 at 22:24
@max66 it is a simple question, maybe the static_assert is not useful here
– Antoine Morrier
Nov 26 '18 at 22:25