id stringlengths 16 145 | text stringlengths 1 179k | title stringclasses 1
value |
|---|---|---|
C++_Classes_Templates/15079_471_0.txt | I think this is what [ @eyalsk ](https://github.com/eyalsk) has been trying to
say for a while now. And what I tried to support. The value of the idea is
being lost by expanding the scope too much. | |
C++_Classes_Templates/15079_332_0.txt | p.s. As for the keyword maybe we can use ` const ` in C# instead of `
constexpr ` but maybe there's more plans for ` const ` like ` immutability ` ,
dunno. :) | |
C++_Classes_Templates/C++_Classes_7_5.txt | rely
};
| (since C++17)
---|---
#### [ [ edit
](/mwiki/index.php?title=cpp/language/static&action=edit§ion=5 "Edit
section: Constant static members") ] Constant static members
If a static data member of integral or enumeration type is declared const
(and not volatile ), it can be initialized with... | |
C++_Classes_Templates/1157_166_0.txt | All reactions | |
C++_Classes_Templates/15079_665_0.txt | [

](/Pzixel) | |
C++_Classes_Templates/1157_143_0.txt | Quote reply | |
C++_Classes_Templates/1157_47_0.txt | Unanswered | |
C++_Classes_Templates/1157_32_0.txt | ## Use saved searches to filter your results more quickly | |
C++_Classes_Templates/15079_336_0.txt | [

](/TonyValenti) | |
C++_Classes_Templates/15079_562_0.txt | [ 
](/RandyBuchholz) | |
C++_Classes_Templates/Constexprlikekeyword_112_0.txt | XML | |
C++_Classes_Templates/1157_391_0.txt | # {{title}} | |
C++_Classes_Templates/172624_54_0.txt | while(current_it != last_it)
{
( * current_it ++ ).name;
//or instead
( * current_it ) . name;
++ current_it;
} | |
C++_Classes_Templates/15079_218_0.txt | Well, before we draw the line we need to define the rules. 😄 | |
C++_Classes_Templates/1157_326_0.txt | C++ ` constexpr ` usually requires compile time evaluation to be actually
useful. That's in general not achievable in .NET (unless you're willing to
give up using ` constexpr ` methods across projects). | |
C++_Classes_Templates/1157_175_0.txt | Does that matter terribly if the state itself is readonly/immutable? An
instance method is really just syntax candy for a static method that accepts
the instance as the first parameter, which would qualify for being pure. | |
C++_Classes_Templates/15079_238_0.txt | --- | |
C++_Classes_Templates/172624_67_0.txt | // ordered as in the standard chromatic scale. (AS_BF, FS_GF etc. are the semitones)
enum note { A, AS_BF, B, C, CS_DF, D, DS_EF, E, F, FS_GF, G, GS_AF }; | |
C++_Classes_Templates/15079_166_0.txt | --- | |
C++_Classes_Templates/Constexprlikekeyword_83_0.txt | COBOL | |
C++_Classes_Templates/15079_125_0.txt | ### | |
C++_Classes_Templates/15079_519_0.txt | But it wouldn't work for attributes that want a string in their constructor,
right? | |
C++_Classes_Templates/1157_489_0.txt | So what's wrong with using C++'s concept of ` const ` methods? It solves
pretty much 95% of all use cases that you might encounter. Consider the every-
day problem of having two different threads accessing shared state at the same
time. | |
C++_Classes_Templates/1157_172_0.txt | ### | |
C++_Classes_Templates/15079_452_0.txt | Contributor | |
C++_Classes_Templates/C++_Classes_5_7.txt | Same applies to a using-
declaration that inherits a base class constructor that happens to match the
derived class copy/move constructor (since C++11) .
The semantics of inheriting constructors were retroactively changed by a defect report against C++11 . Previously, an inheriting constructor declaration caused a... | |
C++_Classes_Templates/172624_97_0.txt | you should see this as a normal method which returns a stream (object) , then
this stream is output to the screen . Depending on the type send to this
operator << (method) it returns something different . You should at std::cout
in the code , that is normally where these operator overloaded method are
called . | |
C++_Classes_Templates/15079_542_0.txt | > You could say that about simpler examples as well, right? I mean what would
> be the advantage of having Pow(2,3) or fib(...) calculated at compiletime?
> And wouldn't the answer to those questions not apply to more complex things
> as well? Geniously curious where you'd draw the line and why.3 | |
C++_Classes_Templates/15079_33_0.txt | Name | |
C++_Classes_Templates/15079_513_0.txt | ### | |
C++_Classes_Templates/1157_33_0.txt | Name | |
C++_Classes_Templates/15079_397_0.txt | [ @TonyValenti ](https://github.com/TonyValenti) Yeah, it would be great if
the JIT would take advantage over this feature and do what the compiler can't
do at compile time for farther optimization. | |
C++_Classes_Templates/1157_212_0.txt | # {{title}} | |
C++_Classes_Templates/15079_152_0.txt | Copy link | |
C++_Classes_Templates/1157_335_0.txt | Quote reply | |
C++_Classes_Templates/15079_545_0.txt | Now, I don't have issues using the source generators feature in order to
perform calculations like so: | |
C++_Classes_Templates/15079_343_0.txt | 👍 2 Unknown6656 and SunnyWar reacted with thumbs up emoji | |
C++_Classes_Templates/15079_755_0.txt | ### | |
C++_Classes_Templates/Constexprlikekeyword_68_0.txt | **Posted** 26-Jul-19 20:43pm | |
C++_Classes_Templates/15079_240_0.txt | Sorry, something went wrong. | |
C++_Classes_Templates/1157_312_0.txt | --- | |
C++_Classes_Templates/15079_788_0.txt | ## Footer | |
C++_Classes_Templates/15079_775_0.txt | [ Sign up for free ](/join?source=comment-repo) **to join this conversation on
GitHub** . Already have an account? [ Sign in to comment
](/login?return_to=https%3A%2F%2Fgithub.com%2Fdotnet%2Froslyn%2Fissues%2F15079) | |
C++_Classes_Templates/172624_74_0.txt | using standard_scale = scale<7> ;
using intervals = std::array<int,7> ; | |
C++_Classes_Templates/Constexprlikekeyword_103_0.txt | Ruby | |
C++_Classes_Templates/1157_321_0.txt | Something went wrong. | |
C++_Classes_Templates/Constexprlikekeyword_147_0.txt | [ what is object keyword ](//www.codeproject.com/Questions/240640/what-is-
object-keyword) | |
C++_Classes_Templates/15079_342_0.txt |
--- | |
C++_Classes_Templates/15079_642_0.txt | All reactions | |
C++_Classes_Templates/15079_559_0.txt | --- | |
C++_Classes_Templates/15079_363_0.txt | Sorry, something went wrong. | |
C++_Classes_Templates/15079_628_0.txt | All reactions | |
C++_Classes_Templates/1157_54_0.txt | # {{title}} | |
C++_Classes_Templates/15079_368_0.txt | Hi Eyal,
As I've thought about it, I think you're right about caching and constants
being two different things, however, I was thinking that there might be
plenty of use cases where we want non-pure consts as well. | |
C++_Classes_Templates/1157_50_0.txt | [ 
GeirGrusom ](/GeirGrusom) | |
C++_Classes_Templates/15079_34_0.txt | Query | |
C++_Classes_Templates/Constexprlikekeyword_151_0.txt | [ Keyword not supported: 'datasource'.
](//www.codeproject.com/Questions/274613/Keyword-not-supported-datasource) | |
C++_Classes_Templates/15079_409_0.txt | 1. Completely sure that entity is constant.
2. Completely sure that entity is not constant. | |
C++_Classes_Templates/15079_319_0.txt | [ @redknightlois ](https://github.com/redknightlois) oh, now I get what you're
saying I thought that you somehow imagined a world where the C# compiler
actually runs the program and somehow pulls values out of it. :) | |
C++_Classes_Templates/1157_384_0.txt | Yes. That's why i literally said: So, if you wanted this, it would likely be
wishywashy, just like nullable reference types :) | |
C++_Classes_Templates/15079_117_0.txt | **Revised answer.** | |
C++_Classes_Templates/Constexprlikekeyword_12_0.txt | * [ Visual Basic ](/Forums/1646/Visual-Basic)
* [ Web Development ](/Forums/1640/Web-Development)
* [ Site Bugs / Suggestions ](/suggestions.aspx)
* [ Spam and Abuse Watch ](/Forums/1652005/Spam-and-Abuse-Watch)
* * [ features features ](/Feature/)
* [ Competitions ](/script/Contests/CurrentCompetitions.aspx?cmpTpI... | |
C++_Classes_Templates/15079_593_0.txt | I want duck-constants. If it walks like..., talks like... I want to use it I'm
my duck soup recipe. | |
C++_Classes_Templates/C++_Classes_5_4.txt | ---|---
#### [ [ edit
](/mwiki/index.php?title=cpp/language/using_declaration&action=edit§ion=2
"Edit section: In namespace and block scope") ] In namespace and block scope
[ Using-declarations ](/w/cpp/language/namespace#Using-declarations
"cpp/language/namespace") introduce a member of another namespace i... | |
C++_Classes_Templates/Constexprlikekeyword_124_0.txt | ### ...or Join us | |
C++_Classes_Templates/15079_358_0.txt | In my mind, caching and constants are two different things, how do you propose
this to work? also, how do you imagine const and non-const to mix? I mean if
the arguments are non-const then the function would return different result
each time so what would you _cache_ ? can you elaborate on this? :) | |
C++_Classes_Templates/1157_266_0.txt | 1. It's implemented externally. | |
C++_Classes_Templates/172624_37_0.txt | Concerning the question regarding local iterators; I actually didn't realize I
had so many options with how I iterate until your question prompted me to do
another google search. Originally I was going to iterate using a simple for
loop or while loop. | |
C++_Classes_Templates/15079_118_0.txt | [ @Unknown6656 ](https://github.com/Unknown6656) Yeah, this is the reason I
created this post to discuss all of these and maybe come up with a generalized
solution. :) | |
C++_Classes_Templates/15079_86_0.txt | --- | |
C++_Classes_Templates/15079_23_0.txt | # Search code, repositories, users, issues, pull requests... | |
C++_Classes_Templates/1157_105_0.txt | That attribute is already used extensively in the BCL. I don't think it makes
much sense to introduce another one. | |
C++_Classes_Templates/Constexprlikekeyword_51_0.txt | [ Patrice T ](/script/Membership/View.aspx?mid=4072603) 27-Jul-19 16:12pm | |
C++_Classes_Templates/15079_85_0.txt | Take a look at these following issues. This feature is also (partly) mentioned
in them.
[ #12238 ](https://github.com/dotnet/roslyn/issues/12238)
[ #14665 ](https://github.com/dotnet/roslyn/issues/14665)
[ #10506 ](https://github.com/dotnet/roslyn/issues/10506)
[ #11259 ](https://github.com/dotnet/roslyn/issues/11259)
... | |
C++_Classes_Templates/15079_201_0.txt | [

](/iam3yal) [ iam3yal ](/iam3yal) changed the title ~~How would you imagine
constexpr in C#?~~ [Umbrella] How would you imagine constexpr in C#? Nov 9,
2016 | |
C++_Classes_Templates/15079_759_0.txt | p.s. I think that we were discussing too many ideas for a single post so I'm
closing it for now. | |
C++_Classes_Templates/1157_476_0.txt | [ @Richiban ](https://github.com/Richiban) , | |
C++_Classes_Templates/15079_98_0.txt | [ 
](/vbcodec) | |
C++_Classes_Templates/15079_382_0.txt | Should all get reduced down into one line: | |
C++_Classes_Templates/15079_618_0.txt | > Basically you want a super smart compiler than can understand what the
> rather complicated serializer code is doing and simplify it. The main
> problem is that nobody figured out how to write such a super smart compiler.
> Any takers? | |
C++_Classes_Templates/15079_222_0.txt | * 👍 1 reaction | |
C++_Classes_Templates/15079_761_0.txt | --- | |
C++_Classes_Templates/Constexprlikekeyword_129_0.txt | This email is in use. Do you need your [ password
](https://www.codeproject.com/script/Membership/SendPassword.aspx?rp=/) ? | |
C++_Classes_Templates/15079_561_0.txt | Sorry, something went wrong. | |
C++_Classes_Templates/15079_176_0.txt | Templates and Macros are two different beasts in C++ and are used for
different things but we don't really need them in C# and so declining them was
reasonable beyond that they are completely orthogonal to ` constexpr `
suspport. | |
C++_Classes_Templates/15079_605_0.txt | What do you mean here? I probably don't understand you but the _elements_ of
the ` enum ` are basically constants and you can pass the type in the form of
typeof(SomeEnum). | |
C++_Classes_Templates/15079_13_0.txt | * [ CI/CD & Automation ](https://github.com/solutions/ci-cd)
* [ DevOps ](https://github.com/solutions/devops)
* [ DevSecOps ](https://resources.github.com/devops/fundamentals/devsecops) | |
C++_Classes_Templates/1157_319_0.txt | Comment options | |
C++_Classes_Templates/Constexprlikekeyword_16_0.txt | [ Ask a Question ](/Questions/ask.aspx) | |
C++_Classes_Templates/1157_30_0.txt | Cancel Submit feedback | |
C++_Classes_Templates/1157_511_0.txt | Something went wrong. | |
C++_Classes_Templates/15079_159_0.txt | Sorry, something went wrong. | |
C++_Classes_Templates/C++_Classes_5_9.txt | ration&oldid=169372 "Permanent link to this revision of the page")
* [ Page information ](/mwiki/index.php?title=cpp/language/using_declaration&action=info)
* In other languages
* [ Deutsch ](http://de.cppreference.com/w/cpp/language/using_declaration "cpp/language/using declaration")
* [ Español ](http://es... | |
C++_Classes_Templates/1157_495_0.txt | 1. Methods declared ` const ` shall not modify instance fields. Except when those fields are explicitly declared ` mutable ` .
2. Methods declared ` const ` can only call ` const ` methods on itself or on its instance fields.
3. Any variable declared ` const ` cannot be reassigned.
4. Any variable declared ` const ` ca... | |
C++_Classes_Templates/1157_34_0.txt | Query | |
C++_Classes_Templates/172624_8_0.txt | Vector or C-style array? | |
C++_Classes_Templates/15079_17_0.txt | * [ GitHub Sponsors Fund open source developers ](https://github.com/sponsors) | |
C++_Classes_Templates/15079_27_0.txt | # Provide feedback | |
C++_Classes_Templates/15079_674_0.txt | Copy link | |
C++_Classes_Templates/15079_311_0.txt | --- |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.