« first day (3289 days earlier)      last day (1642 days later) » 

12:29 AM
You are right. Funny thing is (maybe just unintuitive) it is the people hard of hearing that is most difficult to educate. Blind is easy to educate, paraplegic, easy. Autistic, I love those guys(this is the gender neutral guys). Spastic, reasonably easy, a bit of patience goes a long way. Hard of hearing, quite impossible. My sample size is 4.
#1: tried to cheat. VAC banned from course. Left.
#2 & #3. 2: Wanted leniency because of said handicap. Microphones and transmitters were installed in the lecture halls. #2 and #3 said they heard fine but just left after around a year.
 
@CaptainGiraffe I have moderate hearing loss in my left ear--probably part of why I've always been more comfortable learning from books than lectures, videos, etc.
 
@JerryCoffin Are YOU the laziest one, he also has hearing loss in his left ear??? QUICK, "What datatype has msg in the declaration "JCFromGOD msg;".
 
@CaptainGiraffe Uummmm...could you repeat the question after I turn my head a bit?
 
@JerryCoffin I'm curious about this. I'm also a book guy. Talks fatigue me. I never talk more than 15 minutes with concentrated info during lectures.
The 45 min lecture is usually 15 mins, 5 mins jokes and silliness, 10 mins "The virtual keyword", 5 minutes "Only friends can see your private parts". And then bla bla...
 
12:56 AM
@CaptainGiraffe Seems reasonable to me.
 
1:22 AM
I'm trying to use a brute-force algorithm to solve a puzzle called Instant Insanity
 
@DarkRunner You go crazy with that...
 
Essentially, you have 4 cubes. A cube has 6 faces. Every face of the four cubes is colored either Red, Green, Blue, or Yellow. You have to arrange the cubes in a column where every side of the column have four different colors.
That's the puzzle. Obviously, as my first step, I asked the user for the colors of each face of each cube using cout and cin. I then mapped those values into four arrays (one for each cube)
But now I'm stuck
I know how to solve the puzzle using Graph Theory, but I don't know how to translate that knowledge into a algorithm
@JerryCoffin If you could help, that would be great
Here's my code so far: repl.it/join/hmzwknqm-refathbari1
 
@DarkRunner I'd like to kiss your forehead.
 
@DarkRunner I probably could, but I'm still at work so I shouldn't.
 
Oh ok. So I'll probably ask on the StackOverflow site
Well shucks for me
 
1:30 AM
I've made a big mistake. I've engaged my brothers wife in a discussion about lyrics. Religious lyrics. In particular youtube.com/watch?v=sDcDCZGcZj8
I regret everything.
 
@CaptainGiraffe Any time/effort spent on the Beatles is regrettable (IMO).
 
@CaptainGiraffe Computer Science & Engineering are slightly different. But for discipline such as physics and economics, the university I have attended taught us that studying in uni is not for getting a better paid job but improve your way of thinking.
A lot of things taught as truth in high school has been disproven in Uni, at least partially.
Studying in a good university may not make your richer later on in life, but it will help you to see from a higher ground.
 
1:53 AM
For example, the Hong Kong protest, it's labelled as 'pro-democracy' demonstration. But what really it is about? It could be something to do with democracy, but a deep layer maybe despair because there is little hope for young people due to dim job aspects and high costs of living. And then the Chinese communist party mix the concept of country, race, government and political party, this makes the people in main land support its government's decision.
In a way I think the western media and Chinese communist party are both manipulative in their description of the event. Vast majority of people do not see the whole picture.
Then let's take this 'pronoun' chain of event. Was it really about the pronoun? No! If it's just the use of he/him & she/her, vast majority of people would agree. But this whole event was about transexuals online rights in disguise of 'pronoun'. Like just how dumb does stackoverflow higher management think their audience to be??!
 
@TelKitty Do you honestly believe somebody needs to attend a university to realize that politicians of all stripes are manipulative?
 
You can fool all the people some of the time and some of the people all the time, but you cannot fool all the people all the time.
@JerryCoffin No.
 
@TelKitty I'm relieved to hear that. :-)
 
In fact I know people who have attended university and still as dumb as a stick.
@JerryCoffin It's all about ignorant people like me need to be educated to become less ignorant :p
Personally I respect transexuals online rights.
 
@TelKitty Most schools I attended did far more to participate in indoctrination than they did in exposing it.
 
2:09 AM
But stackoverflow's insult of my intelligence with this pronoun thing and its manipulative behave just totally angers me.
 
@TelKitty I'm not sure exactly what rights are involved here. Regardless of sexual orientation, I don't see where I have a right to make any demands about your behavior toward me. If you dislike me, that's your business (regardless of why that might be). I don't think it's reasonable for me to demand (or others to enforce) your acting friendly toward me, regardless of why you might dislike me.
 
@JerryCoffin Well, at the start of my higher education, I was taught of classic physics and classic economics. The later on, they taught me that what I was told were not 100% accurate, then they taught me quantum mechanics and neo-classic/keynesian economics.
 
Now, there are certainly some limits--if you openly threaten me, or tell others they should hurt me, that's clearly illegal in most civilized countries, and I agree that it's out of line. Demanding that you act friendly, however, goes well past that. Demanding that I can dictate the terms you use to refer to me is well into the "ridiculous" range, IMO.
@TelKitty Fair enough--essentially everything we "know" about things like physics is basically a guess based on reverse engineering. But at least with physics there is some real, underlying law/principle we're approximating. With economics, we're pretty much just guessing. Yes, when we have lots of people, we stand some chance that the zigs and zags even out and our guesses are sort of close to reality. But in the end, there's no real underlying law to approximate.
 
2:37 AM
Also, I was told multiple times that the reason to study major such as finance is not to find a good job, but to provide self with more knowledge in the area. It took me years to understand the true meaning of this. Looking back, I was quite ignorant.
 
@Jerry You bring me a pint of Guinnes unless I "auto i = i ++i;"
 
2:56 AM
@TelKitty I can't imagine any level of thinking that would justify spending years studying finance.
 
@JerryCoffin Financial independence (without employment) before middle age so you can spend the rest of your life building your own empire?
Trying to build your empire ... not quite the point.
Money is a tool, not a goal, albeit a very good tool.
 
Hi folks. I asked a question regarding how to algorithmically solve a "simple" puzzle.
It would be great if anyone could take a look
@JerryCoffin Hi, sorry to ping, but if you could take a look, that would be great
This is the current state of my code: repl.it/join/hmzwknqm-refathbari1
 
3:11 AM
@DarkRunner You should write a good post on SO main.
 
That's what I did.
1
Q: Instant Insanity algorithm using Graph Theory

DarkRunnerI'm trying to create an algorithm in C++ to solve the following puzzle: You have 4 cubes. A cube has 6 faces. Every face of the four cubes is colored either Red, Green, Blue, or Yellow. You have to arrange the cubes in a column where every side of the column have four different colors. I kn...

Any ideas, folks?
I've been wrangling with this problem for the last few hours
 
@DarkRunner just look at any of the hundreds of codes online
 
3:27 AM
Hm, let me take a look
 
@DarkRunner This task of yours is over-stated. Read between the lines and it becomes quite simple.
 
@CaptainGiraffe Am I missing something? Because there is no way there's a 10-line solution to this
 
@DarkRunner I'm pretty sure I have a 5 line solution to this.
 
4 lines of nested loops + 1 line test condition?
 
for o1 in OrientationOptions {
for o2 in OrientationOptions {
for o3 in OrientationOptions {
for o4 in OrientationOptions {
if (isValidChoice (c1.o1, c2.o2, c3.o3, c4.4o)) {
outputChoice();
return;
}
}
}
}
}
 
3:38 AM
@TelKitty You're a bloody idiot =)
 
But then what is orientation options? There's 24 ways to orient each cube: 6 faces to choose from, and four rotations for each face
 
@DarkRunner The next step would be that I would require you do give proper names to anything youre describing.
 
You know what, let me figure this out
I'll come back with a solution dammit
 
We're more about encouraging you unlock your darkside of the force powers than helping directly.
fuck
too little sleep
can't write
SfN special talk in a few days, absolutely nothing analyzed
manual annotation of hundreds of cells puts the anal in analysis
 
 
2 hours later…
5:45 AM
Err, every time I am trying to test something on arduino, my robot tries to run away.
 
@TelKitty Do you know how to find subgraphs of a graph?
I think I'm really close to the solution
I searched up how to find connected components, DFS, and BFS, but will those help me find the subgraphs of a graph?
 
 
1 hour later…
7:13 AM
@DarkRunner It's demanding that I log in, and I don't have an account. If you want people to look at your code, I'd recommend posting the code where it's a bit easier to get to.
 
7:44 AM
Also fuck Chicago schools and teachers, they are paid more than other shitty school districts (for example NYC) but perform worse or the same.
When I was in school it was less than $8k and we were shit, and now its $18k and we're still shit
 
Maybe just pay all teachers more and buy fewer iPads
 
Illinois has a budget problem, a retiring teacher in Chicago can make ~100k
Also, its not clear if spending more actually makes schools better - especially in low income schools where students aren't particularly willing or able to learn.
For example, outside of Berlin, school teachers make around 3500 eu which is almost the same as in Chicago. But have substantially better academic outcomes.
 
8:16 AM
If I had enough $, I would hire teachers, start free schooling for the kids and grow my cult members - better start young </trollololo>
 
 
2 hours later…
9:56 AM
Also wtf is up with people wasting time converting std::string to std::string_view, do developers really not have anything better to do? Did some static analysis tool add a new check?
 
Feels weird. I mean replacing std::string& with string_view is one thing, blankly doing it for full strings seems just like a recipe for dangling pointers
 
 
1 hour later…
11:19 AM
@Mikhail it does if you spend it in the right places, IIRC the Chicago strike isn't about just salaries
but congrats you bought the koch propaganda hook line and sinker
 
 
2 hours later…
1:38 PM
Naser Jason Abdo - Serving 2 life sentences plus 60 years. U.S. Army private who refused to deploy to Afghanistan and went AWOL; convicted in 2012 of attempted use of a weapon of mass destruction for plotting to detonate a bomb at a restaurant near Fort Hood in Killeen, Texas, when it was filled with soldiers in 2011.
Apex loser ... Serving 2 life sentences plus 60 years for not have accomplished anything
 
 
1 hour later…
3:00 PM
@TelKitty do you try to be the worst a person can be?
 
 
1 hour later…
4:04 PM
Anyone know anything about fortran in here >.<
 
4:29 PM
@Mikhail I suspect spending more will (somewhat indirectly) improve results, at least a little. Spending more (at least eventually) translates to higher taxes. There are undoubtedly at least some people who send their children to private schools, but can barely afford them. Higher taxes puts more pressure on them to move their children to public schools. And since they're (mostly) going to be parents who care about their children's education, the results at the public schools improve.
Of course, there's (always) more complexity than just that. Given the crime rates in some parts of Chicago, it's almost certainly true that getting teachers to work at some schools requires little short of outright bribery.
 
@JerryCoffin When I was growing up, my parents fought over whether to send me to public/private. Mom thought that private schools were better because it weeded out the "bad people". Dad thought that private schools were not better because weeding out the "bad people" presents a distorted view of the world and blinds the child to many realities of life.
 
I don't recall having checked specifically about Chicago Public Schools, but most public school systems have taken to building "magnet" schools. Many (most?) of these really are good to excellent schools--but there aren't enough of them to let the potentially good students all go to good enough schools that they achieve even close to their potential. Of course the magnet schools achieve their excellent results in much the same way private schools do: turn away anybody who doesn't do well.
@Mysticial To varying degrees, they were probably both right. But if you look at things primarily (or exclusively) in terms of the objective measurements, such as how well students do on SAT/ACT tests, and how many go to college, it's almost certainly going to favor your mom's point of view.
Then again, simply growing up where you did gives a somewhat distorted view of life. Until or unless we travel outside the US, nearly none of us ever sees anything even approaching the abject poverty in which many people live. In the US, being "poor" correlates (pretty strongly) with being overweight, not with starvation.
 
I went to private school for most of my life and then went to public school for one year (my senior year). The curriculum I learned in my senior year at the public school was equivalent to what I was taught during my freshman year in the private school.
@JerryCoffin that is a very interesting point regarding being "poor and also being overweight
 
4:44 PM
@JerryCoffin The Cause-and-effect isn't clear as there are other factors involve. Public schools have shittier SAT/ACT scores partially because of all the underprivileged students - not necessarily because the teachers are better. Under this argument, it doesn't really matter where you go. If anything, going into a magnet school can easily backfire - for example, my high school (while public) had a lot of suicides by (very above average) kids who couldn't live up to expectations due to...
everybody being affluent.
@JerryCoffin Yeah. I traveled a lot when I was growing up. So I got to see what 3rd world looks like (minus the dangerous places which we obviously avoided). So whenever I got overly bitchy about something stupid, my dad would just remind me about what I saw on X trip.
 
@Mysticial Undoubtedly. At the same time, everything I've seen says that the greatest influence parents can have on their kids (especially as teenagers) is to get them among a group where the peer pressure is at least somewhat positive. But you're undoubtedly correct that it can go overboard, and make people think of themselves as failures even thought they're really quite successful.
 
@JerryCoffin Fun fact: state supported child care can increase school performance more than direct funding to the schools!
 
@Mysticial My guess is that has a lot more influence than the (comparatively minor) difference between public and private schools.
@Mgetz Interesting point that I hadn't considered--but it doesn't surprise me either.
 
@JerryCoffin tbf, someone did a study that showed that 90% of the issues students have in schools or some such is more directly fixed outside school by removing stress on both the parent and child than direct classroom spending beyond a point.
Things like giving parents time to actually focus on their kids apparently makes the biggest difference
Childcare is an indirect because it removes a need to do extra work to pay for child care
healthcare and lunches are another
 
@Mgetz I'm not sure I entirely trust the number (in fact, I'm not sure how you'd even measure percentages in a lot of cases), but the general idea certainly seems reasonable enough.
 
4:57 PM
@JerryCoffin no do I and I don't think the researchers did either. They basically said it was very situational.
But the point was that money to classrooms isn't always the answer when students are stressed etc.
 
@Mgetz Undoubtedly true, at least in many cases. As I said (or at least implied) above, I think in Chicago's case, most of the improvement in school results from increased school spending will be quite indirect (such as getting parents to move children from private to public schools). But it's also almost certainly true that Chicago could probably achieve better results by spending that money differently than they are now.
 
agreed
also making certain benes only available to parents at public schools
 
@JerryCoffin Come to think of it. I'm not sure any of the places I've been to as a kid (or even now) truly classify as 3rd world.
I guess if I go by this map, then I've been to plenty of them:
If you're gonna count Mexico, most of South America, SE Asia, and Northern Africa, then yes. I've been 3rd world.
 
@Mysticial Sweden is a third world country
 
During the Cold War, the term Third World referred to the developing countries of Asia, Africa, and Latin America, the nations not aligned with either the First World or the Second World. This usage has become relatively rare due to the ending of the Cold War. In the decade following the fall of the Soviet Union and the end of the Cold War in 1991, the term Third World was used interchangeably with developing countries, but the concept has become outdated as it no longer represents the current political or economic state of the world. The three-world model arose during the Cold War to defin...
Oh, that map is stupid.
 
5:06 PM
@Mysticial Well, most of us (at most) only see kind of the very "edges" of real poverty. I've seen (for example) some of the "shanty town" part of Manila, but only near the edges. Undoubtedly not even close to the worst parts.
 
fuck that.
@Mgetz Yeah, hence why the map is stupid.
 
@Mysticial well it was based on political alignment in the cold war. France was briefly 'third world' after they pulled out of NATO
 
Then the only one I've been to is Laos.
And Cambodia.
 
@Mgetz makes sense lol
 
@Rick tbf at the time the tap water in france wasn't safe to drink
 
5:11 PM
@Mgetz does flint Michigan make us 3rd world too :-)
 
@Mgetz Though, of course, even if it was safe, a properly French snob would never stoop to drinking tap water anyway. Other than the minor detail that they have something else in mind when they say "toilet water", most would find the idea as foreign as it was in Idiocracy.
 
I have a feeling that you're not in a 3rd world unless you fear for your safety.
 
@Rick if you ask the very angry residents: yes
because they are tired of being treated like that
@Mysticial so inglewood chicago?
 
That happened maybe twice. Once in Rio when we drove by the Favela. And once in Cambodia due to mosquito/malaria threat.
 
@Mysticial At least according to your map, you may not be even when you have good reason to fear for your safety. In the Philippines, I certainly didn't go out and about on my own--though if I had, the real fear would have been kidnapping, not murder.
 
5:15 PM
@JerryCoffin my favorite kidnapping story is from georgia, where some UN peacekeepers got kidnapped and were treated so well they were found drunk and very well fed
basically they got dragged into a georgian house party
 
@Mgetz In the Philippines, you probably won't be treated terribly either--but the gang that kidnapped you probably will have connections with the banks, so if you still have money in your accounts after being ransomed, there's a serious chance that they'll kidnap you again to get the rest (this honestly happens semi-regularly).
 
That is crazy
 
@Mgetz Objectively speaking, that would count. But I’ve never been in that neighborhood.
 
@JerryCoffin not surprised, the banks in mexico are thoroughly compromised.
@Mysticial you'd probably be searched if you ever did and put on some sort of police watch list
there really isn't any good reason to go there given how badly the city has treated it
 
@Mgetz Both of which are still better than being another statistic for heyjackass.com.
 
5:19 PM
@JerryCoffin hasn't Duterte turned the tables on drug dealers and kidnappers in the Philippines.
 
@Rick lol no
he's targeting the ones that don't pay bribes
 
@Mgetz I thought that's what corruption was, those who don't pay taxes.
 
@Rick Consensus seems to be that things have gotten quite a bit better overall, but much more improvement vs. drugs than kidnapping.
 
@Rick "taxes"
yeah... not really taxes when it doesn't go to the treasury
 
@Mgetz Rick's closer to right than you may realize. Much of it is a matter of paying what were collected as taxes. Just in the past the government was corrupt enough that everybody knew that much of what was collected in taxes wasn't spent as it was supposed to be.
 
5:24 PM
@Mgetz well if cops are not paid enough to make a living while also risking their lives to enforce the law
 
It does lead to an interesting difference in attitudes. For example, my tendency is that if I think unemployment is a problem, that (primarily) controls how I vote (and I think most Americans are similar). In the Philippines, it's taken for granted that if you have enough money to do so, you should hire people to help out around the house and such, because the only way to battle unemployment is to hire people.
 
@Rick then they become a gang just like any other
 
Indeed, that was an apt and true reply which was given to Alexander the Great by a pirate who had been seized. For when that king had asked the man what he meant by keeping hostile possession of the sea, he answered with bold pride, "What do you mean by seizing the whole earth; because I do it with a petty ship, I am called a robber, while you who does it with a great fleet are styled emperor".

This story also appears in John Gower's Confessio Amantis[3] III.2363-2438 and in a poem by François Villon.[4]
 
Oh, and when I say the government was corrupt in the past, I'm not trying to imply the corruption has been entirely wiped out, by any means (though at least among my wife's friends, there seems to be a pretty strong feeling that things have gotten at least a little better).
 
@Rick philosophical debates aside, when you stop enforcing the law and start enforcing your privilege for your personal benefit you become a gang. I'll leave the LAPD in the mid 1990s as an example
 
5:33 PM
@Mgetz a strong police force prevented east cost mafia from establishing roots in California.
 
@Rick I'd argue that was more RICO and the FBI
 
@Mgetz I don't think there's usually a clean break between the two. Even obviously dirty cops enforce the law to some degree, and even reasonably decent cops expect that being a cop carries some privileges. They may not enforce them (exactly), but it's still often pretty clear that failing to give them what they want will have consequences.
 
/shrug
 
@Mgetz California has a unique policing system. It def needs updating but for the most, it has done a good job. I def think they need more power to go after new types of international crime in the state.
Also, LA needs to be under more aggressive policing and monitoring.
 
@Rick I think most of it was simpler than that: for quite a while, the western arm of the mafia let LA come to them (in Vegas).
 
5:45 PM
@JerryCoffin LA is a real problem latimes.com/local/california/…
 
So.. uh.. is there any c++ talk that goes on here?
 
@the_one_neuron Sure, once in a while. But most discussion of C++ happens here.
 
Ahh I see. So this really is a lounge :p
 
@Rick Oh, there's no question it's corrupt as hell. But at least from what I've seen, most of the corruption is home-grown, not imported.
 
5:59 PM
@JerryCoffin In general I subscribe to the opinion that all core problems are internal.
but California does have a real Mafia problem.
 
@Rick I'm not sure exactly what that means.
 
@JerryCoffin it just means that we cause these problems by implementing bad policies, or not inforcing the law etc...
 
6:20 PM
Hi!! I have a little question.
I hope that someone clarify for me is
about string_view is not clear to me how memory is used in this case
if I have this function definition:

void foo(std::string_view format);
and I use the function like this:

foo("Hello World")
passing the string like this is save? I mean the lifetime of the string "Hello World" is ok inside of the foo function?
 
@YosefMac what do you mean by save
 
safe* sorry
 
@YosefMac what do you mean by safe? and lifetime?
 
I mean if the string_view points to a valid memory address
 
sure
but that is not a very meaningful
statement
 
6:32 PM
Thanks! :)
I just want to be sure that I'm not causing a invalid memory access with this code
 
@YosefMac String literals have static lifetime, so any reference to a string literal remains valid permanently. For example, it's even legitimate to have something like: char const *foo() { return "this is a string"; }, and continue to use the pointer after the function has returned.
 
@JerryCoffin Thanks so much! It's all clear now
 
@YosefMac Take care, however, that this applies only to string literals themselves. In the example above, we returned the address of the string literal itself, so it's fine. If we use a variable like char const *s = "some string literal"; return s;, that's still fine--but if we change that to char s[] = "some string literal"; return s; that's a completely different story, and using the returned pointer gives undefined behavior.
In the last case, we're defining an array (that's local to the function) that's initialized from the string literal, and returning the address of that local array, not the address of the string literal itself--and like other locals, the array ceases to exist when the function returns.
 
Yes, I got it! thanks for the detailed answer and the time! :)
 
7:08 PM
Lol, more string_view cargo cult
 
7:47 PM
@JerryCoffin Technically string literals are never valid.
Unless you can prove that the lifetime of a string literal has a start...
 
@curiousguy "An ordinary string literal has type “array of n const char” where n is the size of the string as defined below, has static storage duration (6.6.5),[...]". "All variables which do not have dynamic storage duration, do not have thread storage duration, and are not local have static storage duration. The storage for these entities shall last for the duration of the program (6.8.3.2, 6.8.3.4)."
So yes, string literals are valid "for the duration of the program."
 
@JerryCoffin There is no doubt that storage of a string literal outlast any possible use of that memory.
No. String literal have no lifetime. They are always invalid.
 
@curiousguy What part of "static storage duration" did you fail to understand?
 
@JerryCoffin What word in "lifetime" do you refuse to read?
 
8:02 PM
I'm not refusing to read anything. I'm simply ignoring it because it's nonsense. "The lifetime of an object of type T begins
when:
(1.1) — storage with the proper alignment and size for type T is obtained, and
(1.2) — its initialization (if any) is complete (including vacuous initialization) (9.3),". For an object of static storage duration, both of those happen before execution of main begins.
The lifetime of an object o of
type T ends when:
(1.3) — if T is a non-class type, the object is destroyed, or
(1.4) — if T is a class type, the destructor call starts, or
(1.5) — the storage which the object occupies is released, or is reused by an object that is not nested within
o (6.6.2).
That happens after returning from main (or exiting via abort, uncaught exception, etc.)
So a string literal (like anything else with static storage duration) has a lifetime that covers the entire life of the program, from before entry to main until after main exits. The only part that's even marginally interesting with static storage duration objects is when/if you get into the relative initialization/destruction of globals.
 
Except Jerry is right
 
@Mikhail I may not be as far left as some, but I resent any implication associating me with a soon to be impeached president (among others). :-)
 
@Mgetz Hey! The Koch propaganda thing is mean. I live in Illinois and went to Chicago public schools. Civil service employees hired at a specific time get paid a lot more than they should. This caused a freeze for people who weren't hired at a specific time or don't have effective union protection. For example, at UIUC we had a salary increase freeze.
Chicago is getting bad bang for their buck for their investment in education. Every time they spend more they get nothing. The money could be better spent.
 
8:19 PM
@JerryCoffin "has a lifetime that covers the entire life of the program, from before entry to main until after main exits"
Are you saying that the lifetime of any static object is guaranteed from before main start to after main ends?
@JerryCoffin When is a character in a string literal initialized?
@JerryCoffin Are you saying that malloc(maxsizeofscalars) starts the lifetime of objects of all scalar types, at the same address?
Note that this one is a real Q, unlike my silly remark about str literal being never valid.
 
@curiousguy No, you have to both obtain storage and initialize objects (which malloc definitely doesn't). If memory serves, somebody wrote this up as a defect. To officially use that storage (even as elementary types like int) in C++, you currently have to use placement new to create objects there (so almost any C code that uses malloc technically has UB when compiled as C++).
 
"its initialization (if any) is complete" If you don't need to initialize the object, and don't want to initialize it, the second condition doesn't seem to apply.
 
@curiousguy That's static initialization which happens before almost anything else. To be technical, even static initialization has phases, so first the storage is zeroed, then the other static initialization happens. For example, static int i = i+1; actually has defined behavior, because i is first initialized to zero, then the i+1initialization happens, so it's initialized to 1.
 
@JerryCoffin And static init is defined for str literals?
 
@curiousguy Yes. "Variables with static storage duration are initialized as a consequence of program initiation."
 
8:31 PM
@JerryCoffin Where does it say what "static init" means fora string lit?
A lit isn't a variable.
 
@curiousguy I'm looking at that. In fact, I think we may have stumbled across a defect in the standard. It should probably talk about lvalues or objects here instead of variables (but the new standard has been reorganized enough I have a hard time finding what I'm looking for, so give me a few minutes).
There's one more piece that makes the intent clear, but it's not normative: "[Note: For every object of static storage duration, static initialization (6.8.3.2) is performed at program startup before any other initialization takes place. In some cases, additional initialization is done later. — end note]"
 
8:48 PM
CWG DR 2026 deals with similar subject matter, and it looks like its resolution resulted in the current wording, but I don't see any more recent pointing out the problem with initialization of string literals, so I think we've found a genuine defect.
 
@JerryCoffin it’s [expr.prim.literal] for the value category of a string literal, if that’s what you’re looking for
 
9:07 PM
@LucDanton No, what I was looking for was the note I quoted. I remembered wording like that, but didn't remember its being a note.
@curiousguy So going back a ways in the conversation, I think (at least as of N4810) you're actually correct. I apologize.
 
 
1 hour later…
10:22 PM
why does deque not have a find method, I know I can use an std::find, I just find it strange that it does not have it as a property accessor
 
10:39 PM
@thecoshman Speaking truth makes me sound worse than I really am. But I am constantly help people and animals. I just can not stand ignorant people and hypocrites.
 
Also, the deque erase is linear. So not only do you have to traverse the deque to find the element you want to delete, you have to traverse it again just to delete it.
This seems like double works to me.
 
@Rick Much of the point of the basic design of the original STL was to keep containers and algorithms that operated on them separate as much as possible.
 
I wonder how much British royal pays the media to paint a great picture of themselves.
 
@Rick A deque acts pretty much like an array. If your data is sorted, you should be able to find the element with a binary search (so O(log n) instead of linear). If it's not sorted, you may be able to swap the element you want to remove with the first or last element, then remove that (O(1) instead of linear).
 
@JerryCoffin how about when you need a structure where you need to operate on both sides of the data structure based on the insertion order
for example, Least recently used cache
remove unsed old item <-[ ] <- add new item
[item touched] < add as new item
| |
->move to back
 
11:00 PM
@Rick Give us a good example of this.
 
@TelKitty compacity 2 put[1,1] put[2,2] get[1]->returns 1 put[3,3]->get[2] -> not found get(3,3)-> returns 3
 
Don't think deque is designed for random access.
List and array are better choices.
 
@TelKitty arrays won't update the index for you, and Deque is fine for this type of operation, I can't think of anything else even with these performance pitfalls. If I were to use an array I would need to walk it more than once to update the indexes for each value any time an element gets touched
also, deque has better performance than a vector in many instances
 
@Rick just use array size in inverse way for index
 
@TelKitty elaborate
I have an array [0,1,2,3,4,5] of length 6 elements 2 gets touched it now needs to be behind 5 how would you do that?
you would need to swap 2 with 3 then 2 with 4 and then 2 with 5
 
11:20 PM
If you touch 0-5 in turn, then you don't need to swap anything. But if you only want to touch 2 and send it to the back, then it's random access which deque is not designed for.
deque is the best for accessing the front or the back, not the middle
 

« first day (3289 days earlier)      last day (1642 days later) »