« first day (457 days earlier)      last day (4506 days later) » 

5:03 PM
@AlfPSteinbach there, anything I missed? stackoverflow.com/a/8883505/256138
 
user142019
@thecoshman static singleton classes.
 
maybe the clang role in windows currently is more like comeau online used to have
 
@WTP that you access via a factory class?
 
as a (reliable?) syntax checker
 
user142019
@thecoshman via a static singleton factory class.
 
5:05 PM
The next time someone asks what I do in my spare time, I'm going to say that I volunteer at an adult day care center called #StackOverflow.
4
@WTP ¬_¬ we could do this all day
 
user142019
Exactly.
 
thanks @sbi :D (for the link)
 
sbi
@thecoshman The tweet? I got it via Anna Lear.
 
@sbi and I got from you :D
 
hi to all of you! :D
 
5:09 PM
yo
 
what's up brothers?
 
user142019
I'm not your brother.
 
Of course.
 
sbi
@WTP You his sister? :)
 
user142019
@sbi no.
 
5:15 PM
I need some help.
 
shoot
 
it's about openGL, however there is no chat room for it, so I came up here.
 
good choice, few of us know a bit of openGL
 
Is it worth shooting here, I mean are you familiar with that technology?
 
just don't expect much
 
5:16 PM
nice :)
 
and for the love of god, use pastebin.com or ideone.com
 
Hey people
 
It's a tough Q. I thought no one will answer. :D
 
I'm trying to figure out a graph scaling algorithm and I feel like I've got the dots, but I don't know how to join them
 
5:20 PM
@DzekTrek you want to do something for each name in a list. well, just iterate over the list, and for each name, do the something. you have chosen to represent the list as a raw array, and then C++11 begin and end (from the <utility> header IIRC) are nice.
 
Has anyone got examples/time to explain how I might do it?
 
Danke, Steinbach! :D However I am not using C++11, but that part about iterating is not bad at all, but I do not know how to implement iteration for the objects. :(
 
@DzekTrek like Alf said, you just need to iterate over that list. I suggest pass each item into a function one at a time. This function needs to then draw it to screen. How exactly you go about this depends on what you want to do
 
user142019
@DzekTrek use a for loop, e.g. for(i = 0; i < sizeof(Texture) / sizeof(Texture[0]); ++i) { … }
 
user142019
In C++11 you can use for(auto i : Texture) { … } (ignore this if you don't use C++11)
 
5:25 PM
Das ist fantastic, WTP'--! Danke, I will try it using first proposal. :)
 
user142019
sizeof(Texture) / sizeof(Texture[0]) equals the amount of elements in the Texture array.
 
user142019
Also, the type of i using the first approach should be size_t.
 
I have figured it out. :) Danke you and all here who were involved in solving this! :)
How do you mean size_t? Like size_t i ?
 
user142019
yes
 
Danke! :)
Thank you! :)
 
user142019
5:30 PM
I ate grasshoppers today.
 
user142019
They taste like nothing.
 
Excuse me but may I ask a bit offtopic
 
user142019
everything in this room is off topic so go ahead
 
if there's a developer in this room
 
user142019
there is
 
5:31 PM
I'd like to ask him for advice
 
WTP' , like Bear Grylls. :)
 
I've been off software world for a year
 
user142019
:p
 
now I'm returning back there
 
user142019
welcome back
 
5:31 PM
I'd like to know what important technologies
and principles I should know
well that's my question
 
user142019
DRY (don't repeat yourself) and KISS (keep it simple, stupid) are totally "the best thing" these days. And functional programming becomes more and more popular.
 
that's what I did already know
 
WTP, I have implemented what you have told me to do, and it's all great for now. I want to ask you if is there any function which I can take a string from that Textures stack?
 
user142019
@DzekTrek if you have i as a size_t you can access it with Texture[i], like for(…) { char *texture_name = Texture[i]; /* do something here */ }
 
well I know my question was dumb, but thank you WTF
 
user142019
5:37 PM
no problem
 
Could someone give the OP a good response to his last comment?
 
5:55 PM
Thank you, WTP! :) It worked!!!! :D
 
talking about the evils of Singletons, what do you do if you want a registry of all instances of X that you have instantiated? for example, map< std::string, X* > by_name;? do you just create a static method and hide the static map inside? is there a better approach?
 
user142019
I don't see how that relates to singletons.
 
user142019
Having only one instance of std::map<std::string, X*> doesn't make it a singleton.
 
come to think of it, I think you're right - X can remain a plain class - just need a static method to hide the static std::map<std::string,X*> inside...
 
OK, we have done this. WTP, lets say we have two stacks, one stack for texture and one for the answer, how can I make a function, that will for each image give me one right answer and 2 random. pastebin.com/4225Aikf
I guess it will take two for but how to implement it.
 
user142019
6:12 PM
@kfmfe04 exactly, e.g. static const std::map<std::string, X*>& all_xes();
 
@WTP make that a reference at least, no need to make a copy of the static
 
user142019
@DzekTrek how would the program know which answer is the right one? You have to store that somewhere.
 
WTP, Well, answer1 is 0 element in the stack Answer, and texture1.bmp is also a 0 element in stack Textures, so I was thinking, if we could somehow reference the right answer for the right textures using this adventage. #
 
user142019
Well you would iterate over the textures like above and use `Texture[i]` for the texture and `Answer[i]` for the right answer. You can do that in the same loop.
 
morning
 
user142019
6:17 PM
evening
 
user142019
Picking two random incorrect answers is a bit trickier. You need to use a function that returns a random non-negative integer. Check if it is equal to i and if so, try again. The problem is that (in theory) this has a complexity of O(∞).
 
so something like for(size_t i; i<sizeof(Texture)/sizeof(Texture[0]);++i{
for(size_t j; sizeof(Answer)/sizeof(Answer[0];j++){
 
@DeadMG are you from Japan?
 
@WTP No, just pick from 0 to n-1, and if it's above i or equal to then add 1 to it
 
user142019
@DzekTrek No, more like this: gist.github.com/1622142
 
6:20 PM
@Bubba88 If I was, why would I tell you about it?
 
@DeadMG okay sorry
 
I see.
WTP, I could use rand() function right?
for other two, something like
 
@DeadMG just wanted to know if Jane Street Capital is still alive =)
 
I don't even know what that is
 
@DeadMG a software company in Tokyo
 
6:24 PM
even if I lived in Tokyo, why would I know one specific random company?
 
user142019
Tokio is huge.
 
most capital cities od veleoped nations are
 
@DeadMG well that's a rather specific company, known for its promotion of Ocaml
 
which is an utterly random langauge
even if I happened to be active in <insert random language>, if it were introduced t me by a friend I'd still never have heard of <insert random promotion company>
 
@DeadMG you may be right
 
6:27 PM
maybe?
^^
 
user142019
DeadMG is always right.
 
@WTP at least he always thinks he's right.
Until something like bison tells him he missed something
 
I am at least usually right
 
user142019
I'm never right.
 
user142019
Especially when it comes to C++.
 
6:30 PM
and I'm a nietzschean so I don't know what right or wrong is
2
 
@WTP I know how you feel - my % of clean compiles is rather low for C++ (esp when using templates) - I should write a script to collect stats...
 
is operator% useful for signed integer types?
 
user142019
Why not?
 
as in, no undefined behavior or anything?
 
user142019
I'll look it up in the standard brb
 
user142019
6:44 PM
"the operands of % shall have integral or unscoped enumeration type." It doesn't say anything about signedness.
 
user142019
Section 5.6 [expr.mul]
 
hmmm, but is the result defined?
I think we'll need the C standard for that
 
user142019
"The binary / operator yields the quotient, and the binary % operator yields the remainder from the division of the first expression by the second. If the second operand of / or % is zero the behavior is undefined. For integral operands the / operator yields the algebraic quotient with any fractional part discarded;81 if the quotient a/b is representable in the type of the result, (a/b)*b + a%b is equal to a."
 
WTP, what do you think about this idea? pastebin.com/vG6C3Uua :)
 
user142019
What is woChoise?
 
user142019
6:47 PM
The problem with that is that it could include the right answer.
 
yes :(
 
user142019
Also, you should use random_shuffle(answer->begin(), answer->end()); since answer is a pointer.
 
what's the motivation for std::integral_constant?
 
woChoice is supposed to be an answer. :(
How can I take next two elements from the right answer?
 
just something everything can inherit from?
 
6:51 PM
Is there any solution for that?
 
user142019
@rubenvb en.cppreference.com/w/cpp/types/integral_constant "std::integral_constant wraps a static constant of specified type. It is the base class for the C++ type traits."
 
yeah, just read that.
I should finish googling first :)
 
Ell
hey
 
user142019
hello
 
hey Ell! :)
 
Ell
6:54 PM
I need advice!
 
user142019
about what?
 
Ell
I have a Map class that should contain a 2d array, but it needs to load different chunks of the map so the entire map wont be in memory at one point
 
Is there any way to simplify SFINAE by writing type_traits in a different way?
 
Ell
hmm nevermind
 
Whee. Gonna go play D&D with friends soon.
 
Ell
6:56 PM
never played D&D
 
user142019
D&D is fun I guess.
 
Xeo
@rubenvb Not really, since the enable_if part is the problem: typename std::enable_if<X>::type* = 0, where you can only influence the X part
 
@Ell Neither have I.
 
Ell
do you think its bad practise to have a Map class that contains info about the map and a MapData class that streams the map data?
 
@Xeo because I think the ::value_type stuff is confusing
 
Ell
6:56 PM
or does that sound fine?
 
Xeo
@rubenvb Only template aliases will help at this point
 
or ::value. Wouldn't ::result or something explain better what you're trying to accomplish?
or just an operator()
 
posted on January 16, 2012 by Herb Sutter

The speakers and sessions for GoingNative 2012 (Feb 2-3, Redmond WA USA) have now been posted. With the focus squarely on C++11 on all compilers and platforms, I think this is going to be the C++ event of the first half of 2012, and I’m very pleased with the caliber of our speakers and their [...]

 
Xeo
namespace stdext{
  template<class Trait, class T = void>
  using enable_if = typename std::enable_if<Trait::value, T>::type;
}
So you can say stdext::enable_if<X>* = 0
 
but I almost never see enable_if, only is_integral, is_constructible etc..
 
Xeo
7:01 PM
@rubenvb Well, that's kinda the short part of SFINAE. Especially with my template alias above, you only need to pass is_integral<T> and not is_integral<T>::value
If you want, you can also have this:
template<class T>
constexpr bool is_integral(){ return std::is_integral<T>::value; }
 
user142019
What exactly is SFINAE? I'm new to C++. Wikipedia is a bit vague.
 
Did anyone of you hear for glui and pui libs for openGL?
 
Xeo
That should cover it IIRC
 
SFINAE is like SNAFU
 
@Xeo why didn't they make it so in the standard? Why press on with the ::value crap?
 
7:04 PM
@rubenvb Because it's easier for compilers to partially implement.
 
Xeo
Also, what if you only want the type or something?
For example tag dispatching
 
user142019
@Xeo thanks!
 
Xeo
template<class T> void foo(std::true_type);
template<class T> void foo(std::false_type);
template<class T> void foo(){ foo(std::is_pointer<T>());
 
@Xeo I'm not good at SFINAE :( What do the foos do?
 
Xeo
Whatever you want, it's just a stupid example
the important point is the dispatching on the type of std::is_pointer<T>
if T is indeed a pointer, it inherits from std::true_type, otherwise from std::false_type
 
7:09 PM
sbi has made a change to the feeds posted into this room
 
Xeo
What did you change, @sbi?
 
sbi
@Xeo I have added Scott Meyers' blog, because that would have shown us this event.
 
Xeo
Ah
 
sbi
Once the chat is done dumping the last 42 posts on us, I'll change it from a ticker to a message feed.
 
WTP, I just don't know how to do it. Is there any func that when once element is taken from the list, it doesn't iterates through that element anymore.
 
user142019
7:14 PM
@DzekTrek you can remove it from the list.
 
i.e. to somehow make a reminder and that random shuffle the remainder and pick the first two another elements.
yes?
 
user142019
going to play minecraft
 
Xeo
FWIW, @rubenvb, take a look at this answer of mine, where I used tag-dispatching
 
user142019
Später!!1
 
Tchuss!
I need grosse help!
 
Xeo
7:16 PM
@sbi Either I'm missing something or it doesn't do that anymore.
 
@Xeo OK, headache coming back. I'll just take the std:: stuff for now, see if I can enhance it somehow later.
 
sbi
@Xeo Well, it's done it for me right now.
 
Xeo
Ah, yeah
 
sbi has made a change to the feeds posted into this room
 
sbi
Another convert by @jalf. :)
 
7:22 PM
writing the copy constructor of a singleton? Isn't that just <copy-constructor-declaration> = delete;?
 
Argh, there's a big nasty feed-troll in upper left corner!
Anyway, I questioned a question. :-)
0
Q: Increment double by smallest possible valueTest

johnnyturbo3I want to increment a double value from the smallest possible (negative) value it can take to the largest possible value it can take. I've started off with this: int main() { double min(numeric_limits<double>::min()); double i(min); while(i < 0); { cout << i <&...

 
Xeo
Seriously, if your compiler doesn't warn for while(cond); or for(;;);, something is wrong.
I think even MSVC warns
"empty loop body" or something
oh, wait, it doesn't
 
i'm not sure if the passage that made an infinite do-nothing loop UB, was removed?
the most silly ever proposed paragraph
imho
 
Xeo
No, there is no such paragraph IIRC
Only that the compiler may assume that any loop eventually finishes
 
@Xeo oh yes, that's the one
 
Xeo
7:26 PM
e.g., while(1){ /*do nothing*/ } can be optimized out
 
that hurts so much
vandals in the committee
 
Xeo
Why?
It's only for empty loops IIRC
Ouch
 
because a program should do what the programmer says it should do
 
Xeo
activating /Wall in VS was a mistake
 
otherwise we could just have a DWIM based language
with the compiler guessing about the meaning
 
Xeo
7:27 PM
How many senseless warnings are there with /Wall?! "warning: XXX not inlined." "warning: N bytes padding after XXX."
 
Microsoft seems to have misunderstood the meaning of warnings, yeah
 
@Xeo yes, /Wall is ridiculous
there's even performance warnings for int to bool conversions
 
for Visual C++, use /W4, not /Wall
 
which go away if you do !!someval
 
Xeo
@AlfPSteinbach I wanted to see if /Wall picks up empty loop bodies
@rubenvb Only in some corner cases IIRC
if(43) won't trigger the warning
 
7:29 PM
bool f() { return 25; } did in some more general case
 
Xeo
> 1>src\main.cpp(18): warning C4305: 'return' : truncation from 'int' to 'bool'
that's what I get for that function
 
@Xeo note that each of these warnings also have the opposite warning. the "warning, it's inlined, for Pete's sake!" has a corresponding "warning, it's not inlined, for Jerry's sake!". it's utterly baffling.
 
@Xeo hmmm, nvm, the code that produced that warning is long gone. No way I'm gonna try to dig that up
 
Xeo
heh
 
OK, SFINAE is not my friend:
template<typename T> std::enable_if<typename std::is_integral<T>::value, T>::type
inline constexpr T mod(const T x, const T y)
{ return x%y; }
what's wrong with this?
I tried mildly copying stuff from here: generic-programming.org/languages/cpp/techniques.php
 
Xeo
7:40 PM
You have two return types
And you have a typename at the wrong position (value is not a type)
 
std::enable_if<std::is_integral<T>::value, T>::type
inline constexpr mod(const T x, const T y)
I'm guessing
 
Xeo
template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
inline constexpr T mod(const T x, const T y);
with "new-style" SFINAE
 
ok, this works:
template<typename T> typename std::enable_if<std::is_integral<T>::value, T>::type
inline constexpr  mod(const T x, const T y)
{ return x%y; }
 
Xeo
correct
 
what's the difference between this and yours?
 
Xeo
7:43 PM
Nothing really
 
ah yes, isn't that the form Howard (Hinnant) discovered and applied in libc++? Or was that something else?
 
Xeo
No, that was something else called "expression SFINAE"
 
ok, thanks, but that makes absolutely no sense to me :/
 
Xeo
The example at the bottom is really easy and explains it
struct X {};
struct Y { Y(X){} };
template <class T>
auto f(T t1, T t2) -> decltype(t1 + t2); // #1
X f(Y, Y); // #2
X x1, x2;
X x3 = f(x1, x2); // deduction fails on #1 (cannot add X+X), calls #2
 
right... I think
kind of
 
Xeo
7:49 PM
basically, if an expressions inside decltype as port of a function doesn't work out, you get SFINAE
 
Xeo, where do you come from?
 
Xeo
Germany
 
@Xeo yeah, I just have a hard time thinking where it would be that useful (don't explain, I got to go now)
cya
 
:) Nice, I have noticed that all good programmers here are coming either from Germany or NL.
 
Xeo
bb
 
7:50 PM
bb rubenvb
 
Xeo
Really? Then you haven't seen a lot of coders
 
user142019
@DzekTrek thank you!
 
Very true.
WTP ;)
WTP, what happened with you minecraf?
 
user142019
It was boring.
 
:D
WTP, do you know openGL? I guess you do, but I just want to make sure.
 
user142019
7:53 PM
@DzekTrek I have played with it but that's all.
 
Oh, I see.
I am still in trouble with the issue we have mentioned
 
user142019
That's not related to OpenGL, is it?
 
Well, yes and no
.
Would you like for me to send you my project just to see where it stuck
It's almost complete. 90%.
 
user142019
Why not simply ask on Stack Overflow? Just make sure you post only the relevant code.
 
However, I am stuck now on how to initilialize everything.
 
user142019
7:57 PM
Nobody will look through an entire project.
 
Yeah, I guess you are right. There is 1000 lines of code. :(
We have talked about how to choose one right element for one texture and 2 elements that are randomly choosen. Remember?
 
sbi
@DzekTrek Like @Alf, @jalf, @RMartinho, @CatPlusPlus, @Als...?
Oh, and I forgot the puppy. And @Kerrek.
 

« first day (457 days earlier)      last day (4506 days later) »