id
stringlengths
16
145
text
stringlengths
1
179k
title
stringclasses
1 value
C++_Classes_Templates/15079_507_0.txt
Is evaluating Pow(2,3) easier? Or do you suggest only a few functions should be supported? Like Math.* and maybe some String.* methods? And how is it decided what methods get to be in the allowed-set? Then again we're going in circles as the next logical conclusion would be some kind of "provable pure method" detector ...
C++_Classes_Templates/15079_391_0.txt
Sorry, something went wrong.
C++_Classes_Templates/1157_285_0.txt
1 You must be logged in to vote
C++_Classes_Templates/15079_379_0.txt
Also, one other thing... someone on an earlier thread talked about reducing "Known at compile time" values into constants/literals. I think this would be a good thing to look at as well because of how it would transform certain code. For example, theoretically, this code:
C++_Classes_Templates/1157_171_0.txt
Quote reply
C++_Classes_Templates/1157_450_0.txt
# {{title}}
C++_Classes_Templates/1157_408_0.txt
Something went wrong.
C++_Classes_Templates/C++_Classes_5_1.txt
e/lambda") [ ` inline ` specifier ](/w/cpp/language/inline "cpp/language/inline") [ Dynamic exception specifications ](/w/cpp/language/except_spec "cpp/language/except spec") ( until C++17* ) [ ` noexcept ` specifier ](/w/cpp/language/noexcept_spec "cpp/language/noexcept spec") (C++11) Exceptions | [ ` thr...
C++_Classes_Templates/15079_20_0.txt
* [ Topics ](https://github.com/topics) * [ Trending ](https://github.com/trending) * [ Collections ](https://github.com/collections)
C++_Classes_Templates/172624_56_0.txt
![](/img/link.png) Sep 3, 2015 at 4:09am UTC
C++_Classes_Templates/15079_704_0.txt
❤️ 1 Pzixel reacted with heart emoji
C++_Classes_Templates/15079_686_0.txt
Copy link
C++_Classes_Templates/15079_515_0.txt
edited
C++_Classes_Templates/1157_8_0.txt
* [ All features ](https://github.com/features) * [ Documentation ](https://docs.github.com) * [ GitHub Skills ](https://skills.github.com) * [ Blog ](https://github.blog)
C++_Classes_Templates/1157_498_0.txt
class Ship { Universe* Owner; // Ships have access to Universe public: // const propagation: Owner is implicitly `const Universe*` so we have a very good guarantee // Draw won't cause dangerous side effects or dead-locks; only const methods may be called // With just one glance at `const`, you can be reassured void Dra...
C++_Classes_Templates/Constexprlikekeyword_31_0.txt
constexpr int Fibonacci(int n) { //cout << "Executed Fib" << endl; switch (n) { case 0: return 0; case 1: return 1; default: return Fibonacci(n - 1) + Fibonacci(n - 2); } }
C++_Classes_Templates/Constexprlikekeyword_110_0.txt
TypeScript
C++_Classes_Templates/1157_19_0.txt
Repositories
C++_Classes_Templates/15079_668_0.txt
**[ Pzixel ](/Pzixel) ** commented Jan 30, 2017
C++_Classes_Templates/15079_528_0.txt
On Mon, Jan 30, 2017 at 7:41 AM asdfgasdfsafgsdfa ***@***.***> wrote: [ @CyrusNajmabadi ](https://github.com/CyrusNajmabadi) < [ https://github.com/CyrusNajmabadi ](https://github.com/CyrusNajmabadi) > Well *if* code generators allow us to replace a property completely (how get, set, and initializer are implemented) th...
C++_Classes_Templates/172624_51_0.txt
class PianoKeyNote { const char * name; bool isBlank; bool isSharp; int scale; //etc };
C++_Classes_Templates/Constexprlikekeyword_30_0.txt
in C++, I can have a function (e.g. Fibonacci) like below:
C++_Classes_Templates/15079_387_0.txt
---
C++_Classes_Templates/15079_179_0.txt
All reactions
C++_Classes_Templates/15079_272_0.txt
Copy link
C++_Classes_Templates/172624_88_0.txt
JLBorges: Your thorough example here (I'm not sure if you wrote this or dug it up from somewhere, but either way) was far more than I could have asked or hoped for. Since posting my question, I've updated my program and narrowed down a better design scheme. This code confirms that I'm headed in the right direction for ...
C++_Classes_Templates/Constexprlikekeyword_116_0.txt
OK Paste as
C++_Classes_Templates/1157_378_0.txt
Something went wrong.
C++_Classes_Templates/1157_403_0.txt
All reactions
C++_Classes_Templates/15079_690_0.txt
So I think we can distinct pure functions (which are called ` constant ` in gcc documentation) and some subset of pure functions (which are called ` pure ` in gcc documentation). I think we should take more common name, used accross multiple languages: D/Lisp/Haskell/whatever instead of one, used in one compiler of C++...
C++_Classes_Templates/15079_732_0.txt
---
C++_Classes_Templates/15079_748_0.txt
👍 2 jnm2 and iam3yal reacted with thumbs up emoji
C++_Classes_Templates/1157_55_0.txt
Something went wrong.
C++_Classes_Templates/15079_278_0.txt
Sorry, something went wrong.
C++_Classes_Templates/1157_479_0.txt
Beta Was this translation helpful? Give feedback.
C++_Classes_Templates/15079_475_0.txt
[attrib(v)] class Foo{}
C++_Classes_Templates/15079_39_0.txt
You signed in with another tab or window. [ Reload ]() to refresh your session. You signed out in another tab or window. [ Reload ]() to refresh your session. You switched accounts on another tab or window. [ Reload ]() to refresh your session. Dismiss alert
C++_Classes_Templates/Constexprlikekeyword_87_0.txt
dbase
C++_Classes_Templates/172624_96_0.txt
[ **Ericool** (522) ](/user/Ericool/)
C++_Classes_Templates/15079_47_0.txt
**Have a question about this project?** Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
C++_Classes_Templates/Constexprlikekeyword_52_0.txt
Use **Improve question** to update your question. So that everyone can pay attention to this information.
C++_Classes_Templates/15079_477_0.txt
const int x = 5; const int y = 6; constexpr v = x + y;
C++_Classes_Templates/15079_244_0.txt
###
C++_Classes_Templates/1157_553_0.txt
## Footer
C++_Classes_Templates/15079_577_0.txt
Though that would address the intent, it is confusing and just weird. People might say, "That's redundant". It is, and that's part of the point. This capability is still pretty "safe", in that the compiler should have little trouble verifying that this is a const within this scope. And though it is still narrow, it wo...
C++_Classes_Templates/15079_66_0.txt
One of the features that I like from C++11/14 is ` constexpr ` that stands for [ constant expression ](http://en.cppreference.com/w/cpp/language/constexpr) and the reason is it allows to evaluate expressions at compile-time.
C++_Classes_Templates/15079_669_0.txt
[ @eyalsk ](https://github.com/eyalsk) [ https://en.wikipedia.org/wiki/Constant_function ](https://en.wikipedia.org/wiki/Constant_function) . You are talking about pure function calling it const for some reason. Why not just use proper name?
C++_Classes_Templates/C++_Classes_2_1.txt
line "cpp/language/inline") [ Dynamic exception specifications ](/w/cpp/language/except_spec "cpp/language/except spec") ( until C++17* ) [ ` noexcept ` specifier ](/w/cpp/language/noexcept_spec "cpp/language/noexcept spec") (C++11) Exceptions | [ ` throw ` -expression ](/w/cpp/language/throw "cpp/language/t...
C++_Classes_Templates/C++_Classes_8_4.txt
int) A a5 = (A)1; // OK: explicit cast performs static_cast, direct-initialization   // B b1 = 1; // error: copy-initialization does not consider B::B(int) B b2(2); // OK: direct-initialization selects B::B(int) B b3{4, 5}; // OK: direct-list-initialization selects B::B...
C++_Classes_Templates/1157_125_0.txt
Something went wrong.
C++_Classes_Templates/15079_248_0.txt
> I think the pre-processor should build a caller tree to sort the methods by > complexity and recursion depth. > It should then optimize the less complex methods first, and then move onto > the more complex ones. I have no idea, which should be the complexity > "limit", but it will be dependent from the method size.
C++_Classes_Templates/C++_Classes_6_2.txt
"cpp/language/type alias") (C++11) Casts [ Implicit conversions ](/w/cpp/language/implicit_conversion "cpp/language/implicit conversion") \- [ Explicit conversions ](/w/cpp/language/explicit_cast "cpp/language/explicit cast") [ ` static_cast ` ](/w/cpp/language/static_cast "cpp/language/static cast") \- [ ` dynam...
C++_Classes_Templates/15079_67_0.txt
**So here are just some questions to open the discussion:**
C++_Classes_Templates/1157_487_0.txt
###
C++_Classes_Templates/15079_134_0.txt
###
C++_Classes_Templates/172624_68_0.txt
std::ostream& operator<< ( std::ostream& stm, note n ) { static const char* const name_of[] { "A", "AS_BF", "B", "C", "CS_BF", "D", "DS_EF", "E", "F", "FS_GF", "G", "GS_AF" } ; return stm << name_of[n] ; }
C++_Classes_Templates/15079_445_0.txt
**[ iam3yal ](/iam3yal) ** commented Jan 30, 2017
C++_Classes_Templates/15079_705_0.txt
All reactions
C++_Classes_Templates/Constexprlikekeyword_59_0.txt
![](https://www.codeproject.com/script/Ratings/Images/star-fill-md.png)
C++_Classes_Templates/15079_524_0.txt
Copy link
C++_Classes_Templates/1157_309_0.txt
> I recently learned (in [ #1155 > ](https://github.com/dotnet/csharplang/discussions/1155) ) that C# will > create a copy of structs if you use in since it can't trust that the code it > calls on them really does not mutate the struct.
C++_Classes_Templates/C++_Classes_3_4.txt
n the context: class Outer { int a[sizeof(*this)]; // error: not inside a member function unsigned int sz = sizeof(*this); // OK: in default member initializer   void f() { int b[sizeof(*this)]; // OK   struct Inner ...
C++_Classes_Templates/1157_431_0.txt
1 You must be logged in to vote
C++_Classes_Templates/172624_40_0.txt
So I guess my question is, how would I use local iterators to provide that specific functionality?
C++_Classes_Templates/Constexprlikekeyword_18_0.txt
# Constexpr like keyword in C#
C++_Classes_Templates/15079_9_0.txt
* Solutions
C++_Classes_Templates/1157_466_0.txt
👍 2
C++_Classes_Templates/15079_444_0.txt
###
C++_Classes_Templates/15079_83_0.txt
**[ Unknown6656 ](/Unknown6656) ** commented Nov 8, 2016 •
C++_Classes_Templates/1157_258_0.txt
0 replies
C++_Classes_Templates/15079_252_0.txt
I think that it's better to set the recursion depth as opposed to time limit like in [ Clang ](http://clang.llvm.org/docs/UsersManual.html#cmdoption- fconstexpr-depth)
C++_Classes_Templates/15079_724_0.txt
edited
C++_Classes_Templates/1157_137_0.txt
All reactions
C++_Classes_Templates/1157_380_0.txt
###
C++_Classes_Templates/15079_479_0.txt
would work under the basic idea.
C++_Classes_Templates/1157_128_0.txt
[ ![](https://avatars.githubusercontent.com/u/3756641?s=64&v=4) iam3yal ](/iam3yal) Nov 29, 2017
C++_Classes_Templates/Constexprlikekeyword_36_0.txt
I google for this. Found that someone in quora mentioned java is missing this. [ https://www.quora.com/What-is-the-counterpart-to-the-C++-constexpr-clause- in-languages-like-Java-or-C ](https://www.quora.com/What-is-the-counterpart- to-the-C++-constexpr-clause-in-languages-like-Java-or-C) [ [ ^ ](https://www.quora.com/...
C++_Classes_Templates/1157_187_0.txt
###
C++_Classes_Templates/1157_246_0.txt
# {{title}}
C++_Classes_Templates/C++_Classes_3_2.txt
as "cpp/language/type alias") (C++11) Casts [ Implicit conversions ](/w/cpp/language/implicit_conversion "cpp/language/implicit conversion") \- [ Explicit conversions ](/w/cpp/language/explicit_cast "cpp/language/explicit cast") [ ` static_cast ` ](/w/cpp/language/static_cast "cpp/language/static cast") \- [ ` dy...
C++_Classes_Templates/1157_550_0.txt
# Select a reply
C++_Classes_Templates/172624_49_0.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
C++_Classes_Templates/1157_414_0.txt
I had a ` ResettableValueLazy<T> ` struct, and by mistake (and habit) it was declared ` readonly ` on the class. So in practice it would call the factory for every invocation (since every assignment would be on the implied copy).
C++_Classes_Templates/15079_716_0.txt
---
C++_Classes_Templates/1157_273_0.txt
1 You must be logged in to vote
C++_Classes_Templates/172624_87_0.txt
Ericool: Thanks for clarifying your approach. At the very least, it gave me a clear and concise look at how iterators can be used, and what they are.
C++_Classes_Templates/15079_184_0.txt
Copy link
C++_Classes_Templates/15079_649_0.txt
**[ iam3yal ](/iam3yal) ** commented Jan 30, 2017
C++_Classes_Templates/1157_223_0.txt
---
C++_Classes_Templates/1157_253_0.txt
Sure, you're right.
C++_Classes_Templates/15079_769_0.txt
[ ![@yatli](https://avatars.githubusercontent.com/u/20684720?s=40&v=4) ](/yatli) [ yatli ](/yatli) mentioned this issue Nov 12, 2019
C++_Classes_Templates/1157_188_0.txt
[ ![](https://avatars.githubusercontent.com/u/196899?s=64&v=4) DavidArno ](/DavidArno) Nov 29, 2017
C++_Classes_Templates/1157_426_0.txt
[ ![](https://avatars.githubusercontent.com/u/10102290?s=64&v=4) HaloFour ](/HaloFour) Dec 1, 2017
C++_Classes_Templates/15079_282_0.txt
###
C++_Classes_Templates/15079_440_0.txt
Sorry, something went wrong.
C++_Classes_Templates/172624_19_0.txt
![](/img/link.png) Sep 2, 2015 at 3:40am UTC
C++_Classes_Templates/Constexprlikekeyword_141_0.txt
| [ Pete O'Hanlon ](/script/Membership/View.aspx?mid=213147) | 215 ---|--- [ OriginalGriff ](/script/Membership/View.aspx?mid=6122202) | 195 [ merano99 ](/script/Membership/View.aspx?mid=8633029) | 90 [ Richard MacCutchan ](/script/Membership/View.aspx?mid=767687) | 50 [ KarstenK ](/script/Membership/View.aspx?mid...
C++_Classes_Templates/172624_64_0.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
C++_Classes_Templates/15079_274_0.txt
**[ redknightlois ](/redknightlois) ** commented Nov 10, 2016
C++_Classes_Templates/15079_340_0.txt
Hi All, I wanted to toss in my two cents here and say that I really like the idea of being able to push more work into the compiler.