« first day (558 days earlier)      last day (4392 days later) » 

5:00 PM
but note that they might not offer a dedicated class on every language they use/teach. Some classes might just happen to use some alternative language, without it being mentioned explicitly on the course list
 
so it's just a rule of thumb
 
@jalf My college was almost entirely C++, but for one class we had to write our own interpreter for a new language, and we had at least two classes in C#, one in VB, and one in Python.
After the first two years, they didn't even care what language we used, as long as they could run it (anything MSVC9 or Python/Perl)
 
@Jordan have you got any experience already?
 
For T = U& what's T const&?
And why don't I just try it?
 
5:16 PM
it's actually U&
I ran into this little gem previously
 
Yeah, looks like I'm gonna need some gymnastics.
 
try decltype(*container.cbegin()) instead
that's what I had to do
 
Ah, not the same scenario :)
 
same principle :P
 
What I really need is to understand better how this should really work. Maybe write some tests first.
 
5:19 PM
well, I thought that it was supposed to decay to const U&
 
@DeadMG I don't have a container, only a template parameter. If it's a reference, I think I want T const& to really be U const&.
 
it seems completely unintuitive to me that you can take an explicitly const parameter and end up with a non-const type
 
But I'm getting confused with the damn ref-qualifiers in functions.
 
poonta
 
@DeadMG Yeah, I'd think so too.
If T = U&& then T const& is U&. :S
 
5:22 PM
Does boost have a function that prints contents of object?
 
@RMartinhoFernandes That's supposed to happen.
 
Like what? Boost.Serialization?
@DeadMG But I want the const to stick!
 
oh
I meant the other part about the result being an lvalue reference :P
 
@RMartinhoFernandes Yeah, I think that's it
 
Or maybe not. I'm being stupid.
I don't need a T const& to call a R (T::*)(A...) const on it.
 
5:25 PM
member function pointer?
 
Yeah.
So, cv-qualifiers work fine.
But ref-qualifiers fuck up.
Because I can't call a R (T::*)(A...) && on a U&.
I think I'll need three overloads.
 
OK
here's one problem
my set<NodeType> is failing rather hard
apparently, it does not contain (66, 20, 67), even though the debugger clearly says otherwise
 
yeap
 
oh, nm
 
5:34 PM
How do you know it doesn't contain it?
 
I said "apparently"
and because I broke on the if (open_set.find(shit) == open_set.end()) line
 
@RMartinhoFernandes What's going on?
 
and I just realized why this is a fail
no wonder my goddamn set is breaking, I keep changing the order of the elements
by over-writing them with newer g_scores
 
@LucDanton I'm trying to implement a bound mem_fn like yours, but I haven't looked at your code yet.
 
Doesn't invoke take care of all that stuff already?
 
5:37 PM
It's fun.
 
no, wait, I didn't do that yet
 
@RMartinhoFernandes Now that you mention it, my unit tests haven't really prodded around with cv- and ref-qualifiers.
 
And now that you mention it, it's not like I can test ref-qualifiers.
GCC doesn't have them, and clang SFINAE is still broken.
 
                if (open_set.find(neighbour) == open_set.end()) {
                    auto pair = open_set.insert(neighbour);
                    assert(pair.second);
 
Meh, my make_invoke unit tests check for that so it's all a matter of mem_fn_type to properly forward to invoke.
 
5:39 PM
how can this assertion ever fail? :(
 
What's the type being compared?
 
pair.second is a bool indicating whether an insertion was made
if false then that element already existed in the set
but as you can see, the assert is only ever checked if find is end() - which is when the element doesn't exist in the set
 
Good, mem_fn accepts a Signature Class::*. I think it's fine.
 
Oh, wait.
> Fixed in r155621.
They fixed it!
 
I'll build tomorrow.
@DeadMG So, what's the type being compared?
 
5:43 PM
a tuple<int, int, int>
 
Using the default ordering?
 
no, a custom comparator
it's a SWO
 
Sorry for sending two replies without content

Transmitted from space
 
more accurately, it's actually not and rather bugged, but that bug does not occur in that specific bit of code
 
I'm being spammed by my own friends!
 
5:46 PM
@RMartinhoFernandes So you admit to having robot accomplices in orbit biding their time?
 
Erm.
I admit nothing, deny everything, and launch counterattack.
6
 
i love this chat group you guy sare so active
:)
 
@RMartinhoFernandes Doesn't #3 kinda make the first two kinda pointless?
 
@DeadMG He won't admit that and will deny it as well.
 
DENY ALL THE THINGS
 
5:50 PM
Man, I keep getting sidetracked onto "but what if" scenarios.
 
meh
you can go on forever if you keep doing that
just WRITE CODE
say it all
 
Yeah. It's just a little jarring to want my smart pointer to be "as good as" std::shared_ptr, wonder "so how does shared_ptr handle ..." and find out "... oh. it doesn't"
 
@aschepler Learn to draw the line. There's a point where the answer to "but what if?" is "you're on your own".
 
@aschepler what examples have you found so far of things shared_ptr doesn't handle? When you make two shared_ptrs to a single resource seperate from each other?
 
@Mooing exactly. and then actually shared_ptrbehaves exactly as I expect, but enable_shared_from_this blows up.
 
5:57 PM
boo
 
@Bryan nah, I'm passive.
 
@aschepler There's a constructor to tie an std::shared_ptr to another.
 
ah well. I got to post another interesting question, and can now go back to the actual goal knowing I dealt with the issue the same way shared_ptr did.
@LucDanton It doesn't allow a different deleter though.
 
Well no. Which one would be used?
 
( questions/10338606 )
 
6:03 PM
@aschepler just post a hyperlink.
 
1
Q: Multiple shared_ptr storing same pointer

ascheplerConsider this program: #include <memory> #include <iostream> class X : public std::enable_shared_from_this<X> { public: struct Cleanup1 { void operator()(X*) const; }; struct Cleanup2 { void operator()(X*) const; }; std::shared_ptr<X> lock1(); std::shared_ptr&l...

ooo
 
@aschepler You're using shared_from_this on an object that is not held by an std::shared_ptr.
 
Yes it is, p1 is still alive and owns &x.
 
@RMartinhoFernandes i love the brevity of the exchange: no back and forth, just "Fixed in rXXXXX"
 
x.shared_from_this()
 
6:07 PM
@sehe What else did you want? I made a perfect description, they saw the issue and fixed it. Communication at its best.
 
> Requires: enable_shared_from_this<T> shall be an accessible base class of T. *this shall be a subobject of an object t of type T. There shall be at least one shared_ptr instance p that owns &t.
Emphasis mine. You failed to honour this precondition.
 
p1 doesn't meet that requirement?
 
To be fair it all depends on the meaning of 'owns'.
 
Question. I have a set<set <int>> and I'm writing it out to Python by traversing the structure with iterators in the obvious way. Now, I was wondering if the structure will always present itself in the same order. For the set<int> I think it is clear that it will just be in increasing order of int, but how does C++ handle ordering integer sets?
Not sure if this is suitable for SO proper - it is a pretty trivial question.
 
set<set<int>> is not valid.
 
Xeo
6:10 PM
What the robot says
 
Just to be clear, I'm not that bothered what the order is as long as it is consistent.
 
You need to write a comparator yourself.
 
Xeo
If you provide a comparator, the order will always be as defined within there
 
@LucDanton If you're going to claim that std::shared_ptr(p, d) does not own p, then every implementation of enable_shared_from_this out there is wrong for adjusting the weak_ptrfrom that constructor.
 
@RMartinhoFernandes But what order does it traverse by default? I didn't provide anything.
@RMartinhoFernandes Sorry, don't follow.
 
6:11 PM
@FaheemMitha There's no default.
 
@aschepler Well the answer is to look at what the Standard requires, not what implementations do.
 
Xeo
For a std::set to work, it needs to be able to order its elements
 
Ok, let me double check.
 
Ideally it wouldn't even compile.
 
Xeo
A std::set itself, however, has no rules on how it has to be order in relation to other sets (of its kind)
 
6:11 PM
There is a std::operator<(const std::set&, const std::set&).
 
Xeo
No, there is not.
 
(appropriately templated)
 
Nope, I just looked at my defn, and I don't see any ordering.
 
Xeo
Or atleast there shouldn't be.
 
6:12 PM
I'm looking at N3242 23.4.3.
 
You're saying it shouldn't work at all?
 
Xeo
The fuck?
 
It does lexicographical comparison.
 
@RMartinhoFernandes Hmm. I see.
 
6:13 PM
So { 1, 4, 5 } comes before { 1, 6 }, and that comes before { 2, 3 }.
 
When this is meaningful, I suppose.
 
@RMartinhoFernandes I didn't want anything else, I was expecting something else. Like I said, I love the brevity
 
@Xeo I honestly didn't knew there was.
 
Xeo
Me neither
 
@aschepler The constructors used for p1 and p2 do make the pointers own x.
 
Xeo
6:14 PM
And I'm not sure if I like it
 
I don't see an issue with it.
 
@RMartinhoFernandes Right, that is in line with what I see here.
Thanks.
 
If there's a std::lexicographical_compare already, why not take advantage of it?
 
Is cppreference.com a standard reference place?
 
It's not normative, but it has good quality.
And unlike other reference sites, you can fix the mistakes on this one.
 
6:16 PM
it's not endorsed by ISO/IEC, if that's what you mean.
 
@RMartinhoFernandes What does normative mean?
 
@FaheemMitha It's not official.
 
@RMartinhoFernandes Ah, Ok. Is there such a thing as an official site?
 
It's the best such site I know of.
 
@FaheemMitha there's an official pdf
 
6:17 PM
@MooingDuck Ok. For the standard?
 
@FaheemMitha You can grab an draft of the standard document (open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf), or buy the real thing.
 
Why won't this work? cmmt.date = decltype(cmmt.date)::clock::now(); clang says "expected expression".
 
@RMartinhoFernandes Ok, thanks.
 
cmmt.date is of type std::chrono::time_point<std::chrono::system_clock>.
 
6:18 PM
Web pages are really more handy anyway.
 
@classdaknok_t Old grammar.
 
@FaheemMitha Oh, yeah, there's the link the duck posted, which I build regularly from github.com/cplusplus/draft.
 
decltype(...) is not a legal construct to appear before :: in some draft Standard, when many decltype implementations were written
 
It has typographical mistakes fixed :)
 
fixed in C++11's final Standard but many implementers haven't updated yet
 
sbi
6:19 PM
The people of Norway deserve universal congratulations for showing us all how to deal with terrorism : http://www.guardian.co.uk/world/2012/apr/26/thousands-sing-anders-breivik-hates
 
Great, thanks.
 
Ah. That sucks, so I need to use a local typedef, right?
 
sbi
That reminds me of this:
G.W. Bush, 9/11: "We're gonna hunt you down." Stoltenberg, 22/7: "We will retaliate with more democracy". I'm proud to be Norwegian.
 
@classdaknok_t Alias<decltype(foo)>::blah
FTR, both Clang 3.1 and GCC 4.7 have this fixed.
 
using CmmtDateT = decltype(cmmt.date);
cmmt.date = CmmtDateT::clock::now();
 
sbi
6:20 PM
> Harald Foesker ... said he lost 80% of his vision and his face had to be restored afterwards, but added he was proud to live in a country that treated criminal defendants with dignity. — guardian.co.uk
 
Thanks, @DeadMG and @RMartinhoFernandes!
 
@aschepler So far the only promising lead I have is the non -normative note that says "The shared_ptr constructors that create unique pointers [...]", as apparently there is a possibly implicit assumption about the std::shared_ptr objects that own this. Or maybe I'm reading too much into that.
 
@sehe woof woof
 
Xeo
6:24 PM
I personally don't think there's any meaningful comparision between containers, except (un)equality.
 
@LucDanton Yeah, I wasn't sure what to make of that phrase. I ended up figuring it was meant to exclude constructors that copy another shared_ptr or weak_ptr.
 
@Xeo And lexicographical order :P
 
sbi
@JamesMcNellis What a wonderful domain name you got yourself there! http://seaplusplus.com/
 
It's an SWO if the element comparison is an SWO, which it is, because it is required.
 
Yeah, I think that the point of set's operator< is not that set1 < set2 itself has much meaning, so much as it creates a SWO and therefore allows things like set<set<int>>
 
6:27 PM
typedef Windows::UI::Xaml::IDependencyObject IDependencyObject; oh God.
using Windows::UI::Xaml::IDependencyObject; FTFH
 
Exactly. It's usable. Meaning is something only you can attribute to it.
 
Man if std::string can have an ordering then so can std::vector<char> and then so can std::vector<T>. Then why not go all the way in?
 
@classdaknok_t Is that using WinRT or something?
 
@RMartinhoFernandes Yes.
 
@RMartinhoFernandes it's from here: seaplusplus.com
 
6:30 PM
Is it possible for a compiler to use pimple/d-pointer internally for every class?
Or is there something in standard that wouldn't allow it to work?
 
Doesn't work for Standard-layout I think. Other stuff is probably fair game.
 
I think standard layout classes have to work as expected with memcpy etc.
 
What Luc said.
 
What's standard layout again?
 
6:32 PM
a big technical definition that mostly comes down to "the sorts of things you can do in C"
 
34
A: What are Aggregates and PODs and how/why are they special?

R. Martinho FernandesWhat changes for C++11? Aggregates The standard definition of an aggregate has changed slightly, but it's still pretty much the same: An aggregate is an array or a class (Clause 9) with no user-provided constructors (12.1), no brace-or-equal-initializers for non-static data members (9.2),...

 
What can you do in C? :S
 
there's a more correct answer
 
Standard layout is not what gives the memcpy guarantee btw. That's from triviallly copiable.
 
Is there some kind of framework available for VC++ enabling proper OO-interaction with systems such as FS, networking, etc?
 
6:33 PM
@RoelvanUden Boost.
 
@RMartinhoFernandes Ooh, C++ draft in LaTeX. Cool.
 
@DeadMG Thank you. Will be checking this out.
 
@RMartinhoFernandes Wait, so isn't trivial copy the thing that prevents it?
 
If a class is trivially copyable, you can freely memcpy it.
 
@FaheemMitha kinky, huh?
 
6:35 PM
@RoelvanUden Sounds like you would want to start with the docs for boost::asio.
 
@classdaknok_t Well, personally I use LaTeX for everything. Aside from ordinary text, that is. So it gets a +1 from me.
 
@RMartinhoFernandes But why does standard layout prevent compiler from doing automatic pimpl?
 
@Pubby Because that would change the layout. Duh.
 
aaaaaargh
 
I've cloned it, now let's see if I can get this puppy to compile.
 
6:36 PM
I fixed two bugs in my pathfinding and it just made things worse!
 
@RMartinhoFernandes But what is the layout? I can't find a definition of it :S
Well, other than restrictions, but I don't see ordering/padding
 
It's how the objects are laid out in memory.
 
He should have included a build file.
 
Size, alignment, padding.
@FaheemMitha There is one. cd source; make full;
Alternatively, just grab my build.
 
But what is the alignment and padding? :S
 
6:37 PM
@aschepler Seems like it. Seems like a massive framework, somehow quite intimidating and quite verbose. I will have to invest some time to get down with this.. :D
 
@Pubby Oh, you don't know alignment?
 
I'm confused
Is there a standard alignment/padding for 'standard layout'?
 
Basically, an int cannot be placed at an address that isn't a multiple of 4 (I'm using my implementation's values, don't assume these are mandated).
@Pubby Yes, the one dictacted by the C ABI.
 
@RMartinhoFernandes Oh, I see. The top README does not reference it.
@RMartinhoFernandes Does your build do things differently?
 
6:40 PM
@RMartinhoFernandes That's not 'as specified by the C Standard' Standard.
 
Yeah, all the C++ standard says is that they have the same layout as the equivalent C ones.
Basically, if I compile struct foo { int x; }; void f(foo); in C, I can pass struct foo { int x; void g(); }; from C++ to the function f.
 
Somehow. I'm still not sure how that's supposed to work, Standard-wise.
 
@RMartinhoFernandes that's a confusing example, since you have two function fs.
 
@MooingDuck Ooops.
@LucDanton That's quite vague to be honest.
 
Aha, "offsetof" needs to work for any standard-layout type. Which definitely rules out pimpl.
 
6:43 PM
So, what is the difference between this github repos and the official standard document?
 
I'm quite glad they made the distinction between POD and standard-layout, simplified a ton of C API code.
 
@RMartinhoFernandes I think there's a problem with your example still, that for f to be declared, struct foo must be defined, which means that C++ can't redefine struct foo to have a member function. But that doesn't invalidate your point.
 
@FaheemMitha the official standard document is older.
 
@FaheemMitha official is official, but has typos.
 
@classdaknok_t : But this repos is basically tracking the standard? If they sell the standard, I'm surprised they allow this.
I'm not complaining, obviously.
 
6:46 PM
@MooingDuck You can declare struct foo; void f(foo);.
 
@RMartinhoFernandes wait, can you?
wouldn't the function require a foo*?
 
> All ISO standards are "open standards" in that they’re developed in an open, inclusive process. All member nations of ISO are eligible to participate, send experts, contribute material, vote on ballots, and so forth.
> Additionally, some working groups, including C and C++, make all of their papers and all working drafts freely available on the web, as with the link above; the only thing a working group is not allowed to make freely available, except with special permission from ISO, is the text of the final standard it produces, because ISO reserves the right to charge for that.
 
@FaheemMitha Buying the standard is for legitimacy, mostly. Like say, when you're making a compiler.
 
@RMartinhoFernandes ideone.com/Fk6YC, hmm, you can.
 
6:47 PM
@MooingDuck Only if you're going to call it before the full definition.
 
@FaheemMitha The repo is maintained by the committee editor, and it gets minor mistakes fixed once in a while.
@MooingDuck Yes, you can! Ain't it amazing?
 
@RMartinhoFernandes that seems like bugs waiting to happen
 
(I had the same reaction when I learned that)
@MooingDuck Why? You can't define the function.
 
@MooingDuck You can't use a foo without the type being defined so you can't even start to misuse f.
 
@RMartinhoFernandes two TUs having different foo definitions
 
6:49 PM
Thanks for the explanations, everyone. And the sutter link, @classdaknokt.
 
@MooingDuck Why would that happen because of this?
 
@MooingDuck That breaks the ODR. UB even before f comes into play.
 
Oh, if you mean the definition from C and the one from C++, then the answer is to ditch the one from C. The compatibility here is at the binary level (hence the ABI).
 
@RMartinhoFernandes The more I think on it, the less likely it seems that someone could work themselves into undefined behavior. I guess it's fine then.
@LucDanton I'm aware it breaks the ODR, I was trying to think of how likely it is that someone will get into that UB without an error. Seems unlikely
 
It's as likely as doing it with f(foo*).
 
6:54 PM
@RMartinhoFernandes true
 
I can't say it's a feature of the language I take advantage of seeing as I don't have declarations for everything. (That are not definitions etc.)
 
I only do pure declarations when really forced to break a cycle.
Oh, and primary template declarations, even though I should probably make them definitions with a single failing static_assert in it.
 
This is the sort of horror that Clang is supposed to save us from: we will be able to have tools that automatically write a header_fwd.hpp for us and fix our includes.
 
why would you bother? Clang has module support, iirc
 
Erm, AFAIK that's an experimental branch.
 

« first day (558 days earlier)      last day (4392 days later) »