id
stringlengths
16
145
text
stringlengths
1
179k
title
stringclasses
1 value
C++_Classes_Templates/172624_36_0.txt
Thanks Ericool! I just did some additional research into the STL library. I didn't realize or consider the optimization provided by STL in processing the stored data. So thank you, that cleared some things up for me.
C++_Classes_Templates/15079_791_0.txt
* [ Terms ](https://docs.github.com/site-policy/github-terms/github-terms-of-service) * [ Privacy ](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement) * [ Security ](https://github.com/security) * [ Status ](https://www.githubstatus.com/) * [ Docs ](https://docs.github.com/) * [ Contact ](ht...
C++_Classes_Templates/1157_295_0.txt
Collaborator
C++_Classes_Templates/15079_427_0.txt
All reactions
C++_Classes_Templates/1157_301_0.txt
All reactions
C++_Classes_Templates/1157_551_0.txt
[ Create a new saved reply ](/settings/replies?return_to=1)
C++_Classes_Templates/15079_156_0.txt
[ @AdamSpeight2008 ](https://github.com/AdamSpeight2008) Yeah but how do you mean? I mean templates in C++ allows T to be any type so it's not type safe in general but then why it's an issue? I'm probably missing something. :)
C++_Classes_Templates/15079_675_0.txt
Author
C++_Classes_Templates/1157_349_0.txt
Comment options
C++_Classes_Templates/15079_567_0.txt
[ @asdfgasdfsafgsdfa ](https://github.com/asdfgasdfsafgsdfa) while the "better code" aspect is a plus, I'm thinking of something of something like a bounded- constant or conditional-constant (as in, "under these conditions").
C++_Classes_Templates/1157_151_0.txt
👍 4
C++_Classes_Templates/1157_231_0.txt
# {{title}}
C++_Classes_Templates/1157_396_0.txt
Collaborator
C++_Classes_Templates/15079_453_0.txt
###
C++_Classes_Templates/1157_206_0.txt
1 You must be logged in to vote
C++_Classes_Templates/15079_639_0.txt
can't do public ProcessAttribute(Enum route){
C++_Classes_Templates/1157_127_0.txt
###
C++_Classes_Templates/Constexprlikekeyword_94_0.txt
MIDL
C++_Classes_Templates/15079_339_0.txt
**[ TonyValenti ](/TonyValenti) ** commented Nov 11, 2016
C++_Classes_Templates/15079_503_0.txt
Alright. There are actually quite heavy limitations, to make it short:
C++_Classes_Templates/gcc_bugs_4_0.txt
GCC Bugzilla – Bug 86971 -Wabi warns it will not warn about anything. Last modified: 2018-08-22 08:52:05 UTC * [ Home ](./) * | [ New ](enter_bug.cgi?product=gcc) * | [ Browse ](describecomponents.cgi) * | [ Search ](query.cgi) * | [ [?] ](page.cgi?id=quicksearch.html "Quicksearch Help") * | [ Repor...
C++_Classes_Templates/1157_25_0.txt
Clear
C++_Classes_Templates/1157_83_0.txt
All reactions
C++_Classes_Templates/15079_377_0.txt
public static void Main(){ Console.WriteLine("Please Enter a Number:") var N = int.Parse(Console.ReadLine()); //This call does not get reduced because Fibonacci(N) is not known at compile time.. var FibN = Fibonacci(N);
C++_Classes_Templates/Constexprlikekeyword_144_0.txt
[ Number of Keywords in C and C++ ](//www.codeproject.com/Questions/181478/Number-of-Keywords-in-C-and-C)
C++_Classes_Templates/1157_283_0.txt
---
C++_Classes_Templates/1157_473_0.txt
Quote reply
C++_Classes_Templates/Constexprlikekeyword_60_0.txt
![](https://www.codeproject.com/script/Ratings/Images/star-fill-md.png)
C++_Classes_Templates/1157_363_0.txt
# {{title}}
C++_Classes_Templates/15079_598_0.txt
Copy link
C++_Classes_Templates/15079_45_0.txt
* [ Code ](/dotnet/roslyn) * [ Issues ](/dotnet/roslyn/issues) * [ Pull requests ](/dotnet/roslyn/pulls) * [ Discussions ](/dotnet/roslyn/discussions) * [ Projects ](/dotnet/roslyn/projects) * [ Security ](/dotnet/roslyn/security) * [ Insights ](/dotnet/roslyn/pulse)
C++_Classes_Templates/15079_157_0.txt
---
C++_Classes_Templates/172624_29_0.txt
The reason to use std::array and std::vector is the use of STL. It would not require from you a lot of effort for memory management , etc. STL have a lot of algorithms and compatible iterators to iterate safely.
C++_Classes_Templates/15079_171_0.txt
Author
C++_Classes_Templates/C++_Classes_6_5.txt
* 11.4 Class members [class.mem] * C++17 standard (ISO/IEC 14882:2017): * 8.10 Equality operators [expr.eq] * 8.3.3 Sizeof [expr.sizeof] * 12 Classes [class] * 12.2 Class members [class.mem] * C++14 standard (ISO/IEC 14882:2014): * 5.10 Equality operat...
C++_Classes_Templates/1157_547_0.txt
Reference
C++_Classes_Templates/15079_322_0.txt
Sorry, something went wrong.
C++_Classes_Templates/Constexprlikekeyword_131_0.txt
I have read and agree to the [ Terms of Service ](/info/TermsOfUse.aspx) and [ Privacy Policy ](/info/privacy.aspx) Please subscribe me to the CodeProject newsletters
C++_Classes_Templates/172624_7_0.txt
###
C++_Classes_Templates/15079_699_0.txt
###
C++_Classes_Templates/15079_140_0.txt
* 🎉 1 reaction
C++_Classes_Templates/1157_177_0.txt
Beta Was this translation helpful? Give feedback.
C++_Classes_Templates/15079_129_0.txt
All reactions
C++_Classes_Templates/1157_296_0.txt
> implementing something like constexpr in C#/.NET is sort of impossible
C++_Classes_Templates/1157_478_0.txt
---
C++_Classes_Templates/15079_264_0.txt
Agreed. This would invalidate my point of sorting the methods first by complexity.
C++_Classes_Templates/Constexprlikekeyword_140_0.txt
| [ OriginalGriff ](/script/Membership/View.aspx?mid=6122202) | 100 ---|--- [ merano99 ](/script/Membership/View.aspx?mid=8633029) | 50 [ Pete O'Hanlon ](/script/Membership/View.aspx?mid=213147) | 20 [ Wonde Tadesse ](/script/Membership/View.aspx?mid=1553162) | 5
C++_Classes_Templates/15079_470_0.txt
> [ @magol ](https://github.com/magol) , but I this discussion has become a > bit too unfocused > [ @CyrusNajmabadi ](https://github.com/CyrusNajmabadi) This is an > unbelievably massive feature request that ends up realistically saving > extremely little
C++_Classes_Templates/1157_118_0.txt
---
C++_Classes_Templates/1157_257_0.txt
All reactions
C++_Classes_Templates/15079_737_0.txt
Closed
C++_Classes_Templates/1157_461_0.txt
public string M() { var builder = new StringBuilder(); // Creating objects is okay in a pure method as long as the constructor is pure builder.Append("Hello world!"); // This method is semi-pure. We are allowed to call it only if we can prove that we **own** `builder` return builder.ToString(); // StringB...
C++_Classes_Templates/15079_780_0.txt
Projects
C++_Classes_Templates/1157_483_0.txt
Comment options
C++_Classes_Templates/1157_446_0.txt
1 You must be logged in to vote
C++_Classes_Templates/Constexprlikekeyword_40_0.txt
[ v2 ](/script/Articles/ListVersions.aspx?aid=5163309)
C++_Classes_Templates/15079_548_0.txt
There are two downsides to this approach a minor and major one:
C++_Classes_Templates/1157_358_0.txt
Beta Was this translation helpful? Give feedback.
C++_Classes_Templates/Constexprlikekeyword_56_0.txt
## 1 solution
C++_Classes_Templates/Constexprlikekeyword_149_0.txt
[ Virtual, Override and New Keyword ](//www.codeproject.com/Questions/769194/Virtual-Override-and-New-Keyword)
C++_Classes_Templates/15079_663_0.txt
All reactions
C++_Classes_Templates/15079_321_0.txt
All reactions
C++_Classes_Templates/Constexprlikekeyword_14_0.txt
**Search within: ** Articles Quick Answers Messages
C++_Classes_Templates/15079_620_0.txt
[ @eyalsk ](https://github.com/eyalsk)
C++_Classes_Templates/1157_264_0.txt
[ ![](https://avatars.githubusercontent.com/u/3756641?s=64&v=4) iam3yal ](/iam3yal) Nov 29, 2017
C++_Classes_Templates/15079_496_0.txt
[ ![@asdfgasdfsafgsdfa](https://avatars.githubusercontent.com/u/3814727?s=80&u=af5b47eaaf9a7ded75c53369d7da673f8ca8d559&v=4) ](/asdfgasdfsafgsdfa)
C++_Classes_Templates/15079_488_0.txt
[ ![@RandyBuchholz](https://avatars.githubusercontent.com/u/13967891?s=80&v=4) ](/RandyBuchholz)
C++_Classes_Templates/172624_14_0.txt
The largest array of this kind I would need would consist only of 12 elements all storing chars.
C++_Classes_Templates/1157_428_0.txt
You'd get that warning for literally every instance method you invoke on a ` readonly ` struct because the compiler doesn't know what methods are mutators. That includes all properties. Combined with a way to annotate/enforce method purity I agree that would be useful.
C++_Classes_Templates/15079_361_0.txt
All reactions
C++_Classes_Templates/15079_101_0.txt
**[ vbcodec ](/vbcodec) ** commented Nov 8, 2016
C++_Classes_Templates/172624_82_0.txt
[ http://coliru.stacked-crooked.com/a/ec279ce9911a910e ](http://coliru.stacked-crooked.com/a/ec279ce9911a910e)
C++_Classes_Templates/15079_375_0.txt
When having a "const function", I really think that should be shorthand for saying "Everywhere this function is called, if possible, reduce it to a constant".
C++_Classes_Templates/15079_243_0.txt
Author
C++_Classes_Templates/1157_463_0.txt
---
C++_Classes_Templates/172624_17_0.txt
I've considered other data structures (such as a circular array), but everything else doesn't seem to simplify my needs all that much, while adding extra overhead.
C++_Classes_Templates/172624_3_0.txt
* [ Tutorials ](/doc/) * [ Reference ](/reference/) * [ Articles ](/articles/) * [ Forum ](/forum/)
C++_Classes_Templates/15079_250_0.txt
I guess what I'm asking is if you sort it how does this helps optimization?
C++_Classes_Templates/1157_265_0.txt
[ @alrz ](https://github.com/alrz) Why would you think that ` Length ` is pure?
C++_Classes_Templates/15079_467_0.txt
Copy link
C++_Classes_Templates/1157_102_0.txt
###
C++_Classes_Templates/15079_400_0.txt
Sorry, something went wrong.
C++_Classes_Templates/15079_0_0.txt
Skip to content
C++_Classes_Templates/15079_783_0.txt
No milestone
C++_Classes_Templates/1157_423_0.txt
Something went wrong.
C++_Classes_Templates/C++_Classes_5_8.txt
p/language/template_specialization "cpp/language/template specialization") . (since C++11) [ Pack expansions ](/w/cpp/language/parameter_pack "cpp/language/parameter pack") in using-declarations make it possible to form a class that exposes overloaded members of variadic bases without recursion: ...
C++_Classes_Templates/1157_512_0.txt
Quote reply
C++_Classes_Templates/1157_365_0.txt
Quote reply
C++_Classes_Templates/15079_607_0.txt
All reactions
C++_Classes_Templates/15079_693_0.txt
---
C++_Classes_Templates/15079_687_0.txt
###
C++_Classes_Templates/C++_Classes_8_2.txt
ration ](/w/cpp/language/typedef "cpp/language/typedef") [ Type alias declaration ](/w/cpp/language/type_alias "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/la...
C++_Classes_Templates/15079_215_0.txt
> The calculation of the Fibonacci sequence is deterministic, as it is clearly > defined and one gets the same mathematically proven result with the same > computation and same parameters. Should it therefore be pre-computed by the > compiler?
C++_Classes_Templates/172624_26_0.txt
Thanks for the reply JLBorges! Glad my thinking wasn't too far off. Though I'm not sure how I completely forgot about the std::array<> (if I ever knew about it). I can't really remember it being discussed by teachers in any of my classes, but a single google search, as well as your link, makes me question why it hasn't...
C++_Classes_Templates/Constexprlikekeyword_28_0.txt
[ C# ](/script/Answers/List.aspx?tab=active&tags=81)
C++_Classes_Templates/1157_499_0.txt
class Universe { mutable shared_mutex Sync; // we don't care if mutex state is modified (lock, unlock) vector<Ship*> Ships; public: void KillShips(Predicate<Ship*> shouldKillShip) { lock_guard<shared_mutex> writeLock {Sync}; // exclusive lock utils::erase_if(Ships, shouldKillShip); } void DrawShips() const { shared_loc...
C++_Classes_Templates/15079_338_0.txt
###
C++_Classes_Templates/gcc_bugs_2_2.txt
ny order).", 5, &call_id_string, 1}, ^ sipp.cpp(247): error: a value of type "const char *const *" cannot be used to initialize an entity of type "void *" {"stat_delimiter"...
C++_Classes_Templates/15079_169_0.txt
[ ![@iam3yal](https://avatars.githubusercontent.com/u/3756641?s=80&u=b853037d90aa1b20e6864477d91be927aeed062c&v=4) ](/iam3yal)
C++_Classes_Templates/15079_227_0.txt
**[ Unknown6656 ](/Unknown6656) ** commented Nov 10, 2016 •