id
stringlengths
16
145
text
stringlengths
1
179k
title
stringclasses
1 value
C++_Classes_Templates/15079_151_0.txt
[ ![@iam3yal](https://avatars.githubusercontent.com/u/3756641?s=80&u=b853037d90aa1b20e6864477d91be927aeed062c&v=4) ](/iam3yal)
C++_Classes_Templates/15079_485_0.txt
All reactions
C++_Classes_Templates/15079_578_0.txt
Getting to strings.
C++_Classes_Templates/15079_329_0.txt
[ @gordanr ](https://github.com/gordanr) I don't think it's possible for the same reason we need to mark variables with ` const ` today, the compiler cannot assume we want the function to be evaluated at compile time, beyond that there's some implications, here are some of them:
C++_Classes_Templates/15079_691_0.txt
Finally, I really think we shouldn't argue about feature which is even not planned for implementation so we can stop here until its internals are done. I think we both are thinking about some keyword, which allows compiler to check two things: that function doesn't read non-constant memory outside function and it uses ...
C++_Classes_Templates/15079_495_0.txt
Sorry, something went wrong.
C++_Classes_Templates/15079_285_0.txt
[ @redknightlois ](https://github.com/redknightlois) Well, in C++ constant expressions is solely only the compiler's work, how do you propose to pull stuff from an _external_ source? how would this work?
C++_Classes_Templates/Constexprlikekeyword_39_0.txt
**Updated** 28-Jul-19 3:48am
C++_Classes_Templates/C++_Classes_0_5.txt
nctions "cpp/language/functions") ** [ Function declaration ](/w/cpp/language/function "cpp/language/function") [ Default arguments ](/w/cpp/language/default_arguments "cpp/language/default arguments") [ Variadic arguments ](/w/cpp/language/variadic_arguments "cpp/language/variadic arguments") [ Lambda expression...
C++_Classes_Templates/15079_164_0.txt
**[ AdamSpeight2008 ](/AdamSpeight2008) ** commented Nov 8, 2016
C++_Classes_Templates/15079_352_0.txt
[ @TonyValenti ](https://github.com/TonyValenti)
C++_Classes_Templates/1157_216_0.txt
[ ![](https://avatars.githubusercontent.com/u/3105979?s=64&v=4) alrz ](/alrz) Nov 29, 2017
C++_Classes_Templates/15079_389_0.txt
All reactions
C++_Classes_Templates/1157_168_0.txt
Comment options
C++_Classes_Templates/15079_53_0.txt
Closed
C++_Classes_Templates/15079_51_0.txt
Jump to bottom
C++_Classes_Templates/15079_99_0.txt
Copy link
C++_Classes_Templates/15079_491_0.txt
**[ RandyBuchholz ](/RandyBuchholz) ** commented Jan 30, 2017
C++_Classes_Templates/1157_148_0.txt
---
C++_Classes_Templates/1157_221_0.txt
> > public string M() { > var builder = new StringBuilder(); > builder.Append("Hello world!"); > return builder.ToString(); > }
C++_Classes_Templates/Constexprlikekeyword_126_0.txt
---|--- | Your Email | ---|--- Password |
C++_Classes_Templates/Constexprlikekeyword_17_0.txt
[ All Questions ](/script/Answers/List.aspx?tab=active) [ All Unanswered ](/script/Answers/List.aspx?tab=unanswered) [ FAQ ](/KB/FAQs/QuickAnswersFAQ.aspx)
C++_Classes_Templates/1157_545_0.txt
Attach files
C++_Classes_Templates/1157_238_0.txt
That's the challenge with working out what is pure. That method ` M ` is deterministic and has no side effects. Sure it uses ` StringBuilder ` , but only as a local builder to build a string. So I'd say that is a pure method.
C++_Classes_Templates/1157_41_0.txt
[ dotnet ](/dotnet) / **[ csharplang ](/dotnet/csharplang) ** Public
C++_Classes_Templates/Constexprlikekeyword_72_0.txt
Thanks Thomas Daniels
C++_Classes_Templates/15079_144_0.txt
Contributor
C++_Classes_Templates/1157_514_0.txt
[ ![](https://avatars.githubusercontent.com/u/1862641?s=64&v=4) roji ](/roji) May 29, 2018
C++_Classes_Templates/15079_476_0.txt
will not work. But, v is "knowable" as a const with the available information.
C++_Classes_Templates/15079_421_0.txt
edited
C++_Classes_Templates/Constexprlikekeyword_122_0.txt
### Existing Members
C++_Classes_Templates/Constexprlikekeyword_95_0.txt
MSIL
C++_Classes_Templates/15079_43_0.txt
* [ Code ](/dotnet/roslyn) * [ Issues 5k+ ](/dotnet/roslyn/issues) * [ Pull requests 498 ](/dotnet/roslyn/pulls) * [ Discussions ](/dotnet/roslyn/discussions) * [ Projects 45 ](/dotnet/roslyn/projects) * [ Security ](/dotnet/roslyn/security) * [ Insights ](/dotnet/roslyn/pulse)
C++_Classes_Templates/15079_29_0.txt
Include my email address so I can be contacted
C++_Classes_Templates/1157_144_0.txt
###
C++_Classes_Templates/1157_181_0.txt
* 👍 1
C++_Classes_Templates/1157_374_0.txt
All reactions
C++_Classes_Templates/1157_418_0.txt
1 You must be logged in to vote
C++_Classes_Templates/15079_689_0.txt
[ @eyalsk ](https://github.com/eyalsk) very strange definition, because it can be inferred from ` pure ` function definition. If function doesn't have any hidden state, it cannot reference ` global memory locations ` which is not constants, but if they are, they can be inlined thus there is absolutely no difference if ...
C++_Classes_Templates/1157_412_0.txt
Author
C++_Classes_Templates/1157_29_0.txt
Include my email address so I can be contacted
C++_Classes_Templates/Constexprlikekeyword_159_0.txt
CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900
C++_Classes_Templates/1157_530_0.txt
15 participants
C++_Classes_Templates/15079_417_0.txt
Copy link
C++_Classes_Templates/Constexprlikekeyword_13_0.txt
| ---|---
C++_Classes_Templates/172624_41_0.txt
Last edited on Sep 2, 2015 at 8:15pm UTC
C++_Classes_Templates/172624_104_0.txt
enum note { A, AS_BF, B, C, CS_DF, D, DS_EF, E, F, FS_GF, G, GS_AF };
C++_Classes_Templates/15079_255_0.txt
Sorry, something went wrong.
C++_Classes_Templates/1157_106_0.txt
---
C++_Classes_Templates/15079_155_0.txt
**[ iam3yal ](/iam3yal) ** commented Nov 8, 2016
C++_Classes_Templates/1157_200_0.txt
###
C++_Classes_Templates/15079_749_0.txt
All reactions
C++_Classes_Templates/15079_1_0.txt
## Navigation Menu
C++_Classes_Templates/15079_209_0.txt
> How would we define constant (I asked this previously here: [ #12238 > ](https://github.com/dotnet/roslyn/issues/12238) (comment) and here: [ > #12238 ](https://github.com/dotnet/roslyn/issues/12238) (comment))?
C++_Classes_Templates/15079_59_0.txt
[ Area-Language Design ](/dotnet/roslyn/labels/Area-Language%20Design) [ Discussion ](/dotnet/roslyn/labels/Discussion)
C++_Classes_Templates/15079_462_0.txt
❤️ 1 asdfgasdfsafgsdfa reacted with heart emoji
C++_Classes_Templates/15079_10_0.txt
For
C++_Classes_Templates/172624_6_0.txt
* [ Forum ](/forum/) * [ Beginners ](/forum/beginner/) * Vector or C-style array?
C++_Classes_Templates/1157_406_0.txt
Comment options
C++_Classes_Templates/15079_302_0.txt
* 👍 2 reactions
C++_Classes_Templates/15079_423_0.txt
p.s. [ @asdfgasdfsafgsdfa ](https://github.com/asdfgasdfsafgsdfa) Maybe this is what you meant when you talked about reflection [ What Are Macros Good For? ](http://scalamacros.org/paperstalks/2014-02-04-WhatAreMacrosGoodFor.pdf) \--Scala
C++_Classes_Templates/1157_342_0.txt
So ` constexpr int RotateLeft(int value, int bits) ` should be possible, as should something like ` static constexpr Vector4 Add(Vector4 left, Vector4 right) ` , since in both cases the operations they would perform are well defined both in the VM and in the language.
C++_Classes_Templates/1157_546_0.txt
Mention
C++_Classes_Templates/15079_221_0.txt
All reactions
C++_Classes_Templates/15079_326_0.txt
###
C++_Classes_Templates/C++_Classes_5_6.txt
f ` Derived ` copy/move constructor (which then hides the inherited version, similar to ` using operator= ` ). struct B1 { B1(int); }; struct B2 { B2(int); };   struct D2 : B1, B2 { using B1::B1; using B2::B2;   D2(int); // OK: D2::D2(int) hides both B1::B1(int...
C++_Classes_Templates/1157_429_0.txt
---
C++_Classes_Templates/15079_268_0.txt
[ ![@Unknown6656](https://avatars.githubusercontent.com/u/8807985?s=40&u=0b85316fdb479595b2731ec5e1ab0d8c03bb3609&v=4) ](/Unknown6656) [ Unknown6656 ](/Unknown6656) mentioned this issue Nov 10, 2016
C++_Classes_Templates/1157_500_0.txt
Huge performance boost thanks to immutability guarantees. If you do this in a language without ` const ` or other immutability guarantees, your program will explode in production because the new intern ` Jimmy ` accidentally modified ` Ship ` state in ` Draw() ` and the compiler didn't care.
C++_Classes_Templates/1157_278_0.txt
Something went wrong.
C++_Classes_Templates/C++_Classes_0_0.txt
##### [ cppreference.com ](/) [ Log in ](/mwiki/index.php?title=Special:UserLogin&returnto=cpp%2Flanguage "You are encouraged to log in; however, it is not mandatory \[o\]") ##### Namespaces * [ Page ](/w/cpp/language "View the content page \[c\]") * [ Discussion ](/w/Talk:cpp/language "Discussion about the co...
C++_Classes_Templates/15079_678_0.txt
[ @Pzixel ](https://github.com/Pzixel) Just because in one field the term _constant function_ has defined meaning doesn't mean that in another field the same term would mean the same thing.
C++_Classes_Templates/15079_596_0.txt
Sorry, something went wrong.
C++_Classes_Templates/1157_18_0.txt
* [ The ReadME Project GitHub community articles ](https://github.com/readme)
C++_Classes_Templates/15079_459_0.txt
> > What? Why?? > If the programmer says "evaluate Console.ReadLine()" at compile time, then > the compiler should do it.
C++_Classes_Templates/1157_189_0.txt
[ @HaloFour ](https://github.com/HaloFour) ,
C++_Classes_Templates/172624_44_0.txt
what you are saying is this :
C++_Classes_Templates/172624_99_0.txt
[ **JLBorges** (13770) ](/user/JLBorges/)
C++_Classes_Templates/15079_535_0.txt
[ ![@iam3yal](https://avatars.githubusercontent.com/u/3756641?s=80&u=b853037d90aa1b20e6864477d91be927aeed062c&v=4) ](/iam3yal)
C++_Classes_Templates/15079_608_0.txt
Sorry, something went wrong.
C++_Classes_Templates/1157_1_0.txt
## Navigation Menu
C++_Classes_Templates/15079_193_0.txt
Should we add some kind of compiler-hint?
C++_Classes_Templates/15079_344_0.txt
All reactions
C++_Classes_Templates/1157_71_0.txt
## Replies: 39 comments
C++_Classes_Templates/1157_262_0.txt
Quote reply
C++_Classes_Templates/1157_140_0.txt
Comment options
C++_Classes_Templates/15079_610_0.txt
Copy link
C++_Classes_Templates/172624_113_0.txt
std::operator<< ( operator<< ( std::cout, Re ), '\n' ) ; // same as above }
C++_Classes_Templates/1157_389_0.txt
0 replies
C++_Classes_Templates/1157_67_0.txt
1 You must be logged in to vote
C++_Classes_Templates/1157_409_0.txt
Quote reply
C++_Classes_Templates/1157_233_0.txt
Quote reply
C++_Classes_Templates/15079_137_0.txt
---
C++_Classes_Templates/15079_194_0.txt
2. maybe rename the question to contain the tag ` [umbrella] ` (but that is not important 😉)
C++_Classes_Templates/1157_160_0.txt
[ ![](https://avatars.githubusercontent.com/u/196899?s=64&v=4) DavidArno ](/DavidArno) Nov 29, 2017
C++_Classes_Templates/15079_372_0.txt
When this code gets compiled, I would expect to see something like:
C++_Classes_Templates/15079_615_0.txt
And when you change ` 2 ` to ` 3 ` you are doing what? Because the main reason of ` Pow(2,3) ` when it's ` Pow(MY_SHINY_BOX_SIDE_LENGTH, 3) ` and side is ` const ` . In this case you are forced to insert comments like ` CHANGE THIS VALUE WHEN YOU ARE CHANGING "MY_SHINY_BOX_SIDE_LENGTH" ` or just do not use ` const ` . ...
C++_Classes_Templates/1157_109_0.txt
All reactions
C++_Classes_Templates/15079_709_0.txt
Copy link
C++_Classes_Templates/172624_100_0.txt
> and it doesn't appear to be describing a standard function