Aug 10, 2019 17:21
@krisz How does it work?
 
Jun 15, 2019 04:57
So by "inverse" you really mean "shift the array to the right twice"?
Jun 15, 2019 04:57
What do you mean by inverse? Give us an example of the input and expected output.
 
Aug 19, 2018 23:45
The move-constructor for std::string is designed to leave the moved-from string in a valid but unspecified state. This could mean leaving the string empty.
 
Mar 12, 2015 17:35
Either that or do away with the stream classes and go with passing around stream buffers.
Mar 12, 2015 17:32
Maybe have the user append a control sequence like, for example, header data on a packet or the byte order mark on a utf8 document.
Mar 12, 2015 17:26
Overloading operator<< still isn't the way to go since it will call the base class version when invoked from a reference or pointer of type std::iostream. Anyway, everything should be done at the stream buffer level. The user should have to add an terminating byte at the end of the character array.
Mar 12, 2015 17:11
Then just don't overload operator<<. Call write directly from bb: bb.write(buf, sizeof buf);.
Mar 12, 2015 17:06
Does your char array not have a terminating '/0'?
Mar 12, 2015 16:57
What different behavior are you seeing when overloading operator<< and when not?
Mar 12, 2015 16:53
Thanks. I am reading the question
Mar 12, 2015 16:46
Are you sure it's calling underflow()? That member is called by input stream functions. write() calls overflow().
Mar 12, 2015 16:46
@mewa What do you mean by it doesn't work? By your question is sounds like operator<<() wasn't being called in the first place. Also, that is not an mcve. Give us a minmal program that we can run ourselves to reproduce the same behavior.
Mar 12, 2015 16:46
It doesn't look like that operator<<() overload is needed at all.
Mar 12, 2015 16:46
Then you shouldn't overload the inserter for this. The std::streambuf will be fine. Can you give us an mcve?
 
Jan 17, 2015 21:30
Nevermind, I understand what's going on now!
Jan 17, 2015 21:14
ADL has to do with function arguments, right? But where are function arguments being used in the OP's initial example?
Jan 17, 2015 21:06
In your answer here you said that ADL was the culprit, how so?
Jan 17, 2015 21:05
Ok done.
Jan 17, 2015 21:04
You want to delete the comments from that thread?
Jan 17, 2015 21:03
Sorry, I was referring to this question you answered. Maybe I should've commented on your answer there. lol
Jan 17, 2015 21:03
In your answer to that question you reference a clause on ADL which says that "the sets of namespaces and classes is determined entirely by the types of the function arguments". Where exactly are function arguments being used in the OP's initial example. Are you referring to the implicit this parameter?
Jan 17, 2015 21:03
So the compiler looks at the associated namespaces of the template arguments? Woah, just learned something new!
Jan 17, 2015 21:03
How does the #2 hack work?
 

Lounge<C++>

Today we're daydreaming about C++26 reflection
Jan 11, 2015 20:00
@AndyProwl If you have a gold badge on that topic you can close with one vote.
Jan 1, 2015 05:12
Year new happy!
Sep 29, 2014 13:43
Morning
 
Nov 8, 2014 03:38
No problem! :)
Nov 8, 2014 03:22
Is this good? The size still has to be known at compile time -- rextester.com/RHE41527
Nov 8, 2014 03:11
I believe there's a way. I'm working on it right now. please hold
Nov 8, 2014 03:07
Yes, and the code that causes the error.
Nov 8, 2014 03:06
Can I see that code where you do that?
Nov 8, 2014 03:05
That's okay, just use a std::reference_wrapper -- en.cppreference.com/w/cpp/utility/functional/reference_wrapper
Nov 8, 2014 03:03
Hmm... can you consider using std::array or a container with a compile time size?
Nov 8, 2014 03:00
How did that work out for you?
Nov 8, 2014 02:59
@DaveStance Maybe you can use iterators instead and have your fn_ function be function template that takes two template arguments as iterators. Then you can pass in your range without writing out every argument.
Nov 8, 2014 02:59
@DaveStance I don't think that's possible since the size of the vector isn't known at compile time, there's no way you can unpack a parameter pack v[I]... without knowing the size of v beforehand.
Nov 8, 2014 02:59
@DaveStance Correct me if I'm wrong, but the user can specify the number of parameters with N, and then calling the function would be as simple as passing in the elements of the vector func(v[0], v[1], ...), correct?
Nov 8, 2014 02:59
@DaveStance What was the N template parameter for if you wanted to know the arguments at runtime?
Nov 8, 2014 02:59
Probably just a small mistake on my part, I see it working in your demo.
Nov 8, 2014 02:59
I couldn't get C& to work for some reason. Replacing the second T parameter to function_maker to T& in the primary template worked, as did changing Args... to Args&... in the specialization.
Nov 8, 2014 02:59
Change Args... to Args&... since he wants references.
 

JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...
Sep 24, 2014 03:18
@JHawkins
Sep 24, 2014 03:18
Goodnight.
Sep 24, 2014 03:17
@GGB667 Sorry but I don't use node. I actually haven't touched on JS in two years and I actually used to be quite knowledgeable.
Sep 24, 2014 03:14
Befause typeof returns a string, always.
Sep 24, 2014 03:13
Nevermind. You didn't lol
Sep 24, 2014 03:12
Oh, you wrote that post, Jhawins??
Sep 24, 2014 03:11
Oh yes, it should. Sorry.
Sep 24, 2014 03:08
I don't think undefined would be in quotes.