« first day (943 days earlier)      last day (3988 days later) » 

8:00 PM
why would you explicitly disallow it?
but instead allow something that makes no sense?
 
Can't you just use a good old vector instead of a unique_ptr to an array?
 
The wording is taken from 20.9.1.4 N3690
 
Yes, I can see that
I'm questioning why it's in there in this form
 
8:02 PM
I had to look it up to see where it came from
 
posted on May 16, 2013 by Herb Sutter

Effective reuse is an important part of good software engineering. To demonstrate how much better off you can be by using standard library algorithms instead of handcrafting your own, let’s reconsider the previous question to demonstrate how many of the problems could have been avoided by simply reusing what’s already available in the standard library. […]

 
@LightnessRacesinOrbit size. My guess is typo.
 
TIL, mods (probably just devs) can edit chat messages without being in the room.
 
@LightnessRacesinOrbit You can do make_unique<T[]>(n), but not make_unique<T[N]>(), basically.
Don't ask me why :S
 
OK I get it -- a bounded array is allocated. Just the template parameter to make_unique shall be T[] (an unbounded array type)
 
8:04 PM
Yes.
 
and then they ban using T[n] instead to avoid mangling shit up, because the T[] approach already does what one might expect from the former
 
@R.MartinhoFernandes Oh cool.
 
how fucking batshit complicated
if nothing else, 20.9.1.4 needs way more exposition
 
Okay.
Got an allocator and non-allocator version.
 
Would you say that this means that make_unique unavoidably commits type erasure on all array types (w.r.t the array dimension)?
 
8:06 PM
It's all good in the neighborhood.
 
@LightnessRacesinOrbit Only on runtime allocated ones.
I am not sure if dynamically allocating an array of a statically known size is a common thing.
Though I still don't see why it was forbidden.
(And std::vector...)
 
@R.MartinhoFernandes Can you provide an example of make_unique working with non-runtime-allocated ones?
 
I want it ^
Too bad I live in a developing country :/
 
@LightnessRacesinOrbit Sorry, it's my fault, but we need to be a bit more precise in the terms. I am getting confused...
 
@BartekBanachewicz Poland?
 
user142019
8:08 PM
@BartekBanachewicz -1 needs more DualShock.
 
@LightnessRacesinOrbit yeah. Delivery from US is gonna kill me
 
@BartekBanachewicz How is Poland a "developing country"?
 
@rightfold there's a clip for Sixaxis too
@LightnessRacesinOrbit do you mean it's not developing at all?
 
@BartekBanachewicz Poland is a developed country. It's firmly entrenched within the first world.
 
user142019
Sixaxis is DualShock's least interesting feature.
 
8:09 PM
@rightfold it's still called Sixaxis not Dualshock anymore
 
The only way in which Poland is backwards is that you idiots drive on the right-hand side of the road
 
user142019
They changed the name?
 
@R.MartinhoFernandes never mind :(
 
@LightnessRacesinOrbit T[N] represents an array that is created immediately in the place it is invoked. This is usually the stack, which means it self-cleans. To allow make_unique<T[N]> would be to imply that a stack-based, self-cleaning array is allocated on the heap with a known-at-compile-time size. This is an impossibility, so it's not allowed.
 
user142019
Sixaxis is the feature that detects the orientation.
 
8:10 PM
Sixaxis (trademarked SIXAXIS) is a wireless gamepad produced by Sony for their PlayStation 3 video game console. It was introduced alongside the PlayStation 3 in 2006 and remained the console's official controller until 2008. The Sixaxis was succeeded by the DualShock 3, an updated version of the controller that, like the DualShock and DualShock 2 controllers, incorporates haptic technology – also known as force feedback. A Sixaxis controller can also be used with Sony's PSP Go via Bluetooth after registering the controller on a PlayStation 3 console. The DualShock 3 was originally intend...
 
user142019
Seriously?
 
user142019
TIL.
 
> is a wireless gamepad
 
The other way to translate it would be to pass N to the size version and allocate an array that's like it, dynamically. But it wouldn't be the same.
 
Shake your controller
 
8:10 PM
@ThePhD I don't think it implies anything to do with any stack whatsoever, nor automatic storage duration. int* ptr = new int[5];
 
anyway, "The Sixaxis was succeeded by the DualShock 3" @rightfold
 
user142019
> Announced at the 2007 Tokyo Game Show, the DualShock 3 wireless controller (SCPH-98050/CECHZC2) is a gamepad for the PlayStation 3. It replaces the Sixaxis wireless controller originally released with earlier versions of the console.
 
yeah.
so we were both right, sort of
 
@ThePhD make_unique<T> doesn't imply that a T is "stack-based on the heap" (whatever that means)
 
@LightnessRacesinOrbit The result of new int[5]; is still an array that you can't sizeof(), where as int ptr[5] can be.
 
8:11 PM
@ThePhD That sounds perfectly reasonable. The only reason not to do that is to make all unique_ptrs that wrap an array compatible with each other
@ThePhD huh? what's sizeof got to do with it? new returns a pointer to your array, not the array itself. This is completely non-relevant
 
My pad had rumble, so I guess it was indeed a DS3
 
@ThePhD The result of new int is an object that you can't sizeof to get the size of the int, either
 
IMHO it's a lot more important than accelerometer
 
@LightnessRacesinOrbit The return value for std::unique_ptr would fail utterly, though: std::unique_ptr<T[50]> <--- What?
 
@ThePhD What's wrong with that?
 
~Sigh~ Okay then.
 
Yet:
> [n3690: 14.1/8]: A non-type template-parameter of type “array of T” or “function returning T” is adjusted to be of type “pointer to T” or “pointer to function returning T”, respectively.
Could this be the reason?
 
@LightnessRacesinOrbit No. It is a type parameter in this case.
 
@R.MartinhoFernandes Oh yes, oops
That was dumb of me
 
@R.MartinhoFernandes Okay, see, in your implementation, you're heap-allocating it and doing what I said: forwarding the N to a new call. You're making it a runtime array.
 template <typename T,
              EnableIf<std::is_array<T>> = _,
              typename Pointee = RemoveExtent<T>,
              std::ptrdiff_t Extent = std::extent<T>::value,
              typename Pointer = std::unique_ptr<Pointee[]>>
    Pointer make_unique(std::ptrdiff_t size = 0) {
        return Pointer { new Pointee[Extent == 0? size : Extent] };
    }
^ That's a runtime-array.
 
8:18 PM
So what.
T x[10]; is a runtime array.
 
But it's also a compile-time array.
 
Compile-time arrays are not terribly common.
@ThePhD No.
It's inside a non-constexpr function.
 
Okay, fine: it's a size-known-at-compile-time array, which does not appear on the stack. E.g., the compiler can look at it and tell you (with two sizeof's) what it's size is, before the program runs.
You cannot do the same with your implemention in wheels.
 
@ThePhD So what?
 
T x[ N ] implies the property of getting the size of the array before the program runs.
This is impossible when given to a unique_ptr. Therefore, implicitly converting it so that operation is no longer possible is a degradation of its original properties.
 
8:22 PM
Anyway, std::unique_ptr<T[10], custom_deleter> would work fine
 
Also:
std::unique_ptr<int[50]> ptr;
int x[50] = ptr.release(); // What?
 
posted on May 16, 2013 by Herb Sutter

How good are you at the details of writing classes? This item focuses not only on blatant errors, but even more so on professional style. Understanding these principles will help you to design classes that are easier to use and easier to maintain.   Problem JG Question 1. What makes interfaces “easy to use correctly, […]

 
Better yet:
std::unique_ptr<int[50]> ptr;
int (x *)[50] = ptr.release(); // Err....
You can provide a template argument to build an array, sure, but the expected semantics of int[50] or int[5] on a unique_ptr do not hold up.
 
Erm what?
@ThePhD Yes, they do.
@ThePhD Why would that fail?
@ThePhD That was never supposed to work.
The only reason I don't return std::unique_ptr<T[10]> is that it has the wrong interface.
Nothing the standard could not fix (I cannot, though).
 
@R.MartinhoFernandes Because it's not possible, valid C++ code?
You can't make a pointer to T[50].
 
8:32 PM
@ThePhD ERm, Why the fuck not?
 
T[50] by itself can't be a pointer type.
 
@ThePhD Yes, you can.
 
0
Q: Why is `unique_ptr<T[N]>` disallowed?

Lightness Races in OrbitAssume namespace std throughout. The C++14 committee draft N3690 defines std::make_unique thus: [n3690: 20.9.1.4]: unique_ptr creation    [unique.ptr.create] template <class T, class... Args> unique_ptr<T> make_unique(Args&&... args); 1 Remarks: This function shall not participate ...

 
@ThePhD Just like int cannot.
T(*)[50], however, is a perfectly valid pointer type.
IOW The C++ does not make up stupid exceptions in this point.
 
<tomalak> { T(* ptr)[50]; cout << TYPE_DESC(ptr); } struct T {};
<geordi> lvalue pointer to an array of 50 Ts
nothing wrong with a pointer to T[50]
 
8:34 PM
typedef int50[50];
int50* p;   // in case you don't speak cdecl
@R.MartinhoFernandes "The C++" sounds really funny.
 
@LightnessRacesinOrbit lol, lvalue pointer.
 
@R.MartinhoFernandes no?
 
There are no rvalue pointers...
 
@R.MartinhoFernandes okay
ITT ThePhD is confusing "what types can exist" for "what new returns in various scenarios"
@R.MartinhoFernandes the result of postfix ++ is prvalue, no ([n3690: 5.2.6/1])?
 
8:37 PM
@LightnessRacesinOrbit Yes, unless you write a crazy overload with a strange return type :)
 
@R.MartinhoFernandes Then I give you char const* ptr = "hi"; f(ptr++);
The argument to f is an prvalue pointer...
 
That's a pointer prvalue, not a prvalue pointer.
 
:(
What's the difference? (Other than one not existing)
 
a prvalue pointer would point to a prvalue, no?
 
Well, you cannot point to rvalues, because that would look like ImaginaryType p = &functionReturningByValue(); but & does not work on rvalues.
 
8:40 PM
@LightnessRacesinOrbit Hmm. Ok maybe that is it. I thought of it in the sense of lvalue reference/rvalue reference.
 
@FredOverflow Oh I see - no I am not introducing pointees at all
 
@FredOverflow That's not really true. You can simply go through a wrapper function that takes by const&.
 
@FredOverflow And geordi's output is "<value category> <type description>" - it's a passive construction of English
e.g. lvalue int
 
@DeadMG You would probably end up with a dangling pointer that way.
 
@R.MartinhoFernandes okay. yeah, it's lvalue pointer as distinct from pointer-to-lvalue. Personally I think the term "{l,r}value reference" is fairly retarded, essentially for just this reason
 
8:41 PM
as long as the object was still alive, you could point to that prvalue.
you could do g(point_to_argument(f()));
 
What is the return type of point_to_argument?
 
could legally be T* or const T* that points to the result of f()
assuming that f() does not do that silly return const T thing.
 
1
A: Why is `unique_ptr<T[N]>` disallowed?

JoeIn your example T[N]* ptr = new T[N] if N is a constexpr, there actually already is a solution: std::array<N>* ptr = new std::array<N>. T[N] by itself is not actually a type in C++ (this was inherited from C, at least we got the addition of sized array refs).

>.<
 
Anyway, sleepy time. See you later folks.
 
T[N] isn't a type? TIL, or WTF?
 
8:44 PM
it is a type.
 
@LightnessRacesinOrbit WTF
 
thanks
@R.MartinhoFernandes night!
 
@LightnessRacesinOrbit Confusion probably stems from that business with parameter declarations.
 
@R.MartinhoFernandes probly
 
Meh.
T[N] doesn't obey the same rules, whatever they are.
If it was it's own, full type, I'd be able to return T[N] from a function.
 
8:47 PM
er, no.
you can't return abstract types from functions either but they are types.
 
Hm. Are abstract types considered "incomplete" types?
 
no, those are different things.
 
I wonder if T[N] is an incomplete type.
 
@ThePhD It is its "own, full type". That you can't pass it around into and out of functions is non-relevant to that fact.
 
8:49 PM
it is not.
 
@ThePhD It is not. int x[5]; ffs
 
Rails routing is annoying like hell
 
@LightnessRacesinOrbit Just wondering. I don't vigorously read the standard.
 
user142019
@CatPlusPlus Rails is terrible no matter what part of it.
 
user142019
(Except for the Ruby part, which is awesome.)
 
8:50 PM
No
 
@ThePhD 10.4 doesn't claim so, though indeed they're very similar!
 
Also I have to write CSS ;(
 
user142019
Use Sass or LESS you scrub.
 
27
Q: Is CSS turing complete?

Adam DavisCSS isn't, insofar as I know, Turing complete. But my knowledge of CSS is very limited. Is CSS Turing complete? Are any of the existing draft or committees considering language features that might enable Turing completeness if it isn't right now?

 
T[N] is obviously its own type, since you can have a reference to T[N].
That's probably the only argument for it you might ever need.
 
8:51 PM
@Griwes T(&)[N]
 
@FredOverflow That's what I am talking about.
 
user142019
okok, validate.
 
@rightfold Yeah, that helps a lot
Like, almost but entirely not
 
@ThePhD You can return it by reference or by pointer:
int (&foo())[50]
{
    static int a[50];
    return a;
}

int (*bar())[50]
{
    static int a[50];
    return &a;
}
 
Christ, that syntax is ugly.
 
8:52 PM
It's C++
 
Welcome to C declarator syntax hell.
 
@CatPlusPlus Oh, c'mon.
 
What? C++ has one of the worst syntaxes in history
 
@FredOverflow I know, I didn't expect anything pretty from the language there, but I just had to state it.
 
@FredOverflow So int[50] is a non-copyable, non-moveable type?
 
user142019
8:54 PM
> This user has been automatically suspended for posting inappropriate content and cannot chat for 1 hour 59 minutes.
 
user142019
Victory!
 
@ThePhD Is a in int a[50]; copyable or movable?
 
Not that I know of.
 
@ThePhD I'd say that answers your question :P
 
user142019
8:56 PM
@ThePhD It's copyable but you can't assign to it for moronic reasons nobody can explain.
 
@Griwes Here is an alternative syntax for pussies:
std::add_lvalue_reference<int[50]>::type foo()
{
    static int a[50];
    return a;
}

std::add_pointer<int[50]>::type bar()
{
    static int a[50];
    return &a;
}
 
> Rough development outline
 
@rightfold C- nuff said.
 
Does that sound redundant?
 
Yeah, and it is not much better :D
 
8:57 PM
@FredOverflow Count me in the pussies
 
user142019
@FredOverflow std::array<int, 50> and std::array<int, 50>* shrimp.
 
user142019
ALL PROBLEMS SOLVED NEXT TOPIC.
 
user142019
> Love's the Funeral of Hearts
 
@rightfold Where would the fun in that be?
 
user142019
@FredOverflow It's C++; there's never fun.
 
user142019
8:59 PM
I want to make software.
 
@rightfold Uh?
You don't consider template meta wankery "fun" or what?
 
user142019
Go FTW.
 
Compensating for C#'s shortcomings - one patch at a time.
 
0
Q: Are C++ abstract classes incomplete types?

Lightness Races in OrbitIncomplete types cannot be instantiated, and abstract classes (that is, those with pure virtual member functions) also cannot be instantiated. struct incomplete_type; struct abstract_class { virtual void foo() = 0; }; By any chance are abstract classes themselves considered to be incomplet...

yeaaah
also, lol:
@LightnessRacesinOrbit sorry, but you are mistaken. T[N] cannot be treated like a regular type, as N is in fact not part of the type which is why array references are the only way to pass a regular array to a function — Joe 7 mins ago
 
btw the proper tag would be c++1y no?
 
9:13 PM
If they're sure it's C++14 then it should be C++14
 
I guess
 
@ThePhD Sorry. Fixed now.
 
@LightnessRacesinOrbit, It's kind of too bad it got removed last time it was created. I had it match the C++11 tag wiki, with a list of approved proposals. I'll bet some sort of list of new and changed features is going to have to work its way on there again. — chris 1 min ago
FFS SO
 
I played 4 out of 5 routes of Ever17 now. Finally I can start the main route.
 
Why is SO insisting on when the committee itself says C++14? Seems authoritative enough.
 
9:21 PM
SO is made of assholes.
3
 
iunno
 
I just favorited that tag, hope it will stay there
 
@ScottW Asshole!
 
Anyway there aren't that many additions to C++14 to warrant a new tag
 
Btw is there a way to filter questions by logical disjunction of tags? Like C++ or C++11 or C++14?
 
9:22 PM
So c++1y is probably used because it'll encompass the future C++17 one which would arguably have more content.
just my two cents.
 
@Rapptz What.
 
?
 
By that logic, and are the same.
 
Xeo
Holy shit, my whole body hurts.
 
c++98 has 48 questions, c++03 has ~100 some
 
9:23 PM
So?
 
those seem better encompassed in :S
 
But they are specific to specific revisions.
 
I suppose.
 
By this logic, none of is allowed.
 
Actually, thank you. I just remembered to update my question again with . It got removed from my question after I added it when the proposal got accepted .
Removed because of the tag being deleted mind you.
 
9:25 PM
turns out I need to learn MATLAB - where do I start?
 
Xeo
Wait, we have a tag now?
 
@Xeo We know what's coming. Why not have one?
 
@Johann Poke it here and there.
 
Apparently.
 
Xeo
@chris Because C++14 is only the plan
 
9:26 PM
what is the syntax like?
most similar to taht is
 
Xeo
Like C++11 was originally destined for 2009
We should keep , IMO
 
@Xeo 99,99% sure that C++14 will be on time.
 
Xeo
So? It's not there yet.
 
There are already three components that are in the "c++14" window that didn't make it
 
@Xeo Okay, true. I hope the months of voting go well for it.
 
9:26 PM
The committee is doing everything to make it in C++14.
 
Xeo
We also used C++0x although it was clear that it was going to be C++11
Until C++11 was officially finished
 
I used C++0x till late 2012.
Because it looks better.
 
Xeo
It has the "x", right?
 
But that ain't a sane argument :P
 
Xeo
:P
 
9:27 PM
@Xeo I wasn't really involved with C++ when that was going on :(
 
Xeo
So, yeah, I personally am against
 
Anyway I'm with Xeo on that one
 
Xeo
A rare phenomen!
 
phenomenon?
 
Xeo
Maybe
The German word is "Phänomen"
 
9:29 PM
cool
 
Xeo
Also, my body hurts... I should just go to sleep
 
Naps are good
 
Xeo
I wouldn't call 7h a nap, but...
 
Ell
What features didn't get into c++14?
 
Xeo
Also, seems a coworker of mine had the strange idea that the destructor of a class automatically becomes virtual when any other function in the class is virtual.
 
9:32 PM
@Ell Not enough.
 
@Ell Filesystem, Concepts Lite, and Networking were pushed outside to "around c++14"
 
Ell
Besides those, what is even.in c++14?
Make_unique
 
Xeo
generalized lambda capture, polymorphic lambda
make_unique
 
Ell
Oh yeah
 
Xeo
greater<>
 
Ell
Return type deduction?
 
overview thing
 
Xeo
ya
optional, stupid dynarrays
Quite a lot, really
 
@Xeo Then we have to replace all of the tags with one day. If we start with , then that is only a vague possibility (and a small one, by the looks of things)
@Xeo Oops!
 
there aren't enough things in c++1y to warrant a mass amount of retagging like c++0x
 
9:36 PM
You mean there aren't enough things to warrant calling the retagging that we must do a "mass retagging" :)
 
Oh lame..
the Filesystem proposal still has operator/ overloaded to concatenate paths together.
 
Xeo
I like it
 
seems a bit off tbh
Why not operator+?
 
Xeo
because a path is not simply a string
 
user142019
Time to really learn Clojure.
 
Xeo
9:39 PM
also, a/b/c <=> path("a") / "b" / "c"
 
user142019
Maybe I'll use it in my Android app.
 
@Rapptz +usr+local+include?
 
@rightfold its java don't do it man
 
@Griwes Disregarding the fact that path is a class and having 3 different classes for relatively simple paths, yes
Anyway I don't really care as long as this doesn't happen
namespace std { namespace tbd { namespace filesystem {
:(
 
@Rapptz What "yes"? Have you ever written cd +usr+local+include? Or was it always cd /usr/local/include? op/ is more natural in this case, bear with it.
 
9:42 PM
I quite literally do not actually care.
It is a very minor complaint that I am arguing for based on the fact that the concept is familiar
+ is used for concatenation (and addition), so it's weird to overload a different operator to do it.
Just like << and >> are used for bitshifting and streams
 
Xeo
"+" used for concatenation is the weird part, really
 
Just like << and >> but it's become common now
I just really do not want nested namespaces :|
 
Xeo
namespace fs = std::filesystem;
 
Yeah I know it's arbitrarily easy to solve but meh, it's just annoying/noise
is std::path bad?
 
Xeo
no clue, but "resize", "remove", "copy" etc are already names in std::
Well, maybe not resize
But there's a good reason for the extra nested namespace.
 
9:48 PM
 
Ah right.
 
Ell
a path is surely just an extension of a string?
 
Xeo
It contains a string, most likely, but it is explicitly not a string
 
Ell
How is it different?
 
Xeo
Erm, it represents a path, not an arbitary sequence of characters.
 
9:50 PM
@Rapptz The existing std namespace is already ridiculously overloaded. We desperately need to introduce nested namespaces.
 
we have std::placeholders :)
 
@DeadMG They shouldn't be tedious though.
It's easy to solve though but it'd be one of those things you have to put on top
 
user142019
user=> (.length "🍌")
4
 
user142019
Clojure is dead to me.
 
@Ell Because what constitutes a path might change from platform to platform.
 
9:52 PM
@StackedCrooked And std::chrono.
 
Xeo
@StackedCrooked std::chrono
 
right
 
chrono is the worst
 
That's all I can really think of, though. Modules might help with that.
 
user142019
@DeadMG No.
 
user142019
9:53 PM
We need modules.
 
user142019
And qualified imports only.
 
Xeo
Modules are orthogonal to namespaces
 
user142019
No namespace shit.
 
modules will not change jack shit about namespces
 
user142019
import std.io;

io.cout << "Hello, world!\n";
 
9:54 PM
concepts should fix some problems with overloading
 
Qualified imports is analogous to namespaces no?
 
Xeo
Not sure how fond of overloading I am atm. It brings a bunch of trouble with it.
 
i.e. import qualified Data.Map is essentially the same as Data::Map::etc
 
Qualified imports? Like Chiquita bananas?
 
std::string is a monolithic class. std is a monolithic namespace. That's all there is to say, really.
 
user142019
9:56 PM
Introduce a new standard library and call it std2.
 
@rightfold do you like optional arguments in C#?
 
Xeo
meh, numbers in identifiers
 
user142019
@JohanLarsson I have no idea what they are.
 
@rightfold, int? i = null;
 
user142019
If you mean being able to do foo(someArg: 42), yes, that's awesome.
 
9:57 PM
Oh shoot, arguments, my bad.
 
user142019
@chris That's a nullable.
 
@rightfold std2. this time with antibiotic resistance
 
user142019
@JohanLarsson oh default arguments.
 
user142019
Yes I like that.
 
@StackedCrooked We should totally make a C++ commercial that looks like a condom commercial for most of it.
 
user142019
9:58 PM
@StackedCrooked how did you learn Clojure?
 
Xeo
And at the end just "C++: Better Safe Than Sorry"
 
@rightfold at home
 
@chris No.
 
@Xeo That works surprisingly well.
 
@rightfold worked through the book titled Programming Clojure
 
user142019
9:59 PM
@ScottW Don't do that. :(
 
user142019
@StackedCrooked OIC dankjewel.
 
user142019
Was het een goed boek?
 

« first day (943 days earlier)      last day (3988 days later) »