« first day (417 days earlier)      last day (2660 days later) » 

00:20
Hey, I see in the boost proto library specs: proto::terminal<placeholder<0> >::type const _1 = {{}};. What the heck is {{}}?
it's a pair of braces inside a pair of braces
obviously, google removes these characters from its search engine, so I'm lost :/
@milleniumbug thanks for the c++ search tip I got this
no, seriously, it's a pair of braces
just like int a[2] = { 1, 2 };
except nested
and empty
... So from what I'm aware of, {} just calls the empty ctor of the implicitly defined class
does that mean {{}} calls ... empty ctors of a class initialized by empty ctor of a vector or something?
00:28
@milleniumbug I found this page after hopping a couple times: en.cppreference.com/w/cpp/language/aggregate_initialization was pretty helpful.
struct S {
    int x;
    struct Foo {
        int i;
        int j;
        int a[3];
    } b;
};
S s1 = { 1, { 2, 3, {4, 5, 6} } };
14 messages moved from Lounge<C++>
00:55
Hi I had a small question
I have this question: Write a single C++ statement to assign the smallest value that can be represented by an integer variable.
So how would I do something like this in a programmatic way without hard coding in a number?
int minimal_value = std::numeric_limits<int>::min();
(you need to #include <limits>)
Oh! I didn't know about that numeric_limits.
Thank you :)
01:17
If I might ask, what is the difference between mingw and gnu toolchain?
I've read that TDM-GCC combines GCC toolset, a few patches for Windows-friendliness, and the free and open-source MingW or MinGW-w64
http://tdm-gcc.tdragon.net/about
Does gnu toolchiain and gcc toolset in that context different?
@Unknown123 tdm-gcc.tdragon.net/quirks <- Have you seen their page on where they explain how different they are?
now, my answer would be "I don't know, I haven't used TDM-GCC"
@milleniumbug I got it, they make their own version of gnu toolchain
So what is the difference between mingw and gnu toolchain?
Can gnu toolchain also work in windows? or partially? or something?
02:11
Hi, so after a long peruse over boost::proto, I got a headache and wanted to stop reading the user docs(probably because I haven't taken the compiler class at my college yet). I was wondering if anyone has experience with this library and has a more gentle introduction.
Somewhat familiar with template metaprogramming
 
1 hour later…
03:19
hi hi?
 
4 hours later…
06:56
hi
anyone here?
nwp
nwp
People appear once you ask a decent question.
07:12
i have been giving c++ library files. my app need to be build in c# , thus i am creating a wrapper so as to call the c++ functions then call the function from a class ,at the end i will be calling it from my from my form.
The function i am calling need to be passed with some parameters, when i am hardcoding the parameters, it works
but if i am passing it through a form the application crashes with error messages : AccessViolationException was unhandled. Attempted to read or write protected memory.This is often an indication that other memory is corrupt.. Any idea
??
 
3 hours later…
10:09
@milleniumbug How do you mean? (Note: I know, that a lot of time passed over this, but I've just now read the rules, so I can talk about it).
 
4 hours later…
13:47
@MuhamedCicak Do you know Rule of Zero? Then it's clearly self-explanatory, and it's an special case of Single Responsibility Principle
Basically if you have a class with a member field that needs a special treatment by any of the Big Five, you refactor this responsibility into a separate class
- char* pointing to a null-terminated string in a dynamically allocated memory area that needs to be freed in a destructor? Replace with std::string.
the only time when you need to implement a BIG5 function is in a class that wraps a low level resource that doesn't already have a wrapper somewhere
^ and to highlight this point: that class does nothing else except implementing Big Five
implement or =delete (for non-copyable resources)
though if it's non-copyable you could co-opt unique_ptr for that with a custom deleter, with the deleter::type::pointer being customizable to hold the resource handle. Perhaps more trouble than it's worth though
Just use std::unique_ptr for pointer-type resources, yes
though it's more of a hassle when the handle isn't an actual pointer.
14:03
Yes indeed, I wrote this to make this less of a hassle
Ron
Ron
What's the rationale behind std::thread::id returning a hexadecimal value? Shouldn't it be some long int?
are you sure that isn't your debugger simply displaying the int in hex
It doesn't return a "hexadecimal value"
numbers are numbers
Ron
Ron
Could be.
Ah I see.
If you pass one to std::cout it will do whatever it does
now, let me guess, you're on Windows
Ron
Ron
14:09
Yes.
it's probably a pointer then
oh wait
Ron
Ron
I see... This reference got me confused. Why does it pipe hexadecimal values to std::cout by default?
nope, I confused it with native_handle
disregard all of my comments above
Ron
Ron
Does it modify the ostream with hex internally or something?
@Ron probably
string representations are generally only good for debugging
14:13
en.cppreference.com/w/cpp/thread/thread/id/operator_ltlt basically gives no guarantees whatsoever except for repr(id1) == repr(id2) <=> id1 == id2
Ron
Ron
@milleniumbug Awesome. That's what I was looking for. Appreciate.
so basically it could return a Base64 value, a textual representation of a number, hex, decimal
14:28
Heyyo
So I currently have that code.
3 messages moved from Lounge<C++>
@Xariez Why a screenshot
Because its on a virtual computer that i got running.
@Xariez posting screenshots of code ends in 3 years of hell added to your sentence
@milleniumbug Because "pretty"! It's IDE-disease
14:30
@Xariez so what
And im on this stackoverflow chat via my "actual" OS
can your virtual computer copy text
Cant copy content over, so i figured thats one way of doing it
It can, but seemingly it cant "cross-copy"
why can't you copy content over from a virtual pc
You tell me
Different clipboards?
14:31
@Xariez what virtualization solution are you using?
Oracle VirtualBox
VirtualBox can do this if you have Addons installed on the guest and copy/paste enabled in Machine settings
@Xariez do you have guest additions installed and bidir clipboard turned on?
Doubt it, to be honest. I just installed a distro in it and went on my day, so havent touched a lot of settings
anyway, what's the question about
14:32
My goal is to, for example, enter the digits "1, 2, 3, 4, 5", which will populate the array. Works.
However, later on in the code I need to turn this to "12345", not "15" that it becomes right now.
@Xariez step 1: stop using C
protip: 5 + 10*4 + 100*3 + 1000*2 + 10000*1 == 12345
I'd know how to do this in C#, but we're not using that in school, and its not like i'll be able to change that on a day as a first year student
step 2 is accumulate(numbers.begin(), numbers.end(), [](string accum, int num) { return accum + std::to_string(num); })
Oh yeah, that's actually a thing we went through not long ago @milleniumbug
That feels awfully complicated for such a "easy" task though @BartekBanachewicz
14:34
@Xariez C++ is awfully complicated
Neeeeeeeeeext
if you want the digits separately then just treat them as separate digits: printf("%d%d%d%d%d", numArray[0], numArray[1], numArray[2], numArray[3], numArray[4]);
2 mins ago, by Bartek Banachewicz
@Xariez step 1: stop using C
plz
> I'd know how to do this in C#, but we're not using that in school, and its not like i'll be able to change that on a day as a first year student
you can use C++
I suppose, at least, since you've asked in the C++ chatroom.
@BartekBanachewicz std::cout << numArray[0]<<numArray[1]<< numArray[2]<< numArray[3]<< numArray[4];
14:36
@ratchetfreak also fine.
I could, but it needs to be stored in a "result" variable, so cant quite do it @ratchetfreak
@Xariez std::stringstream
Aug 26 at 19:01, by milleniumbug
@Blue is in the tag list of this room, so you may ask. But if you are asking, explicitly tell you're asking a C question, so the people who answer won't waste time by giving you a C++ answer.
does the result need to be an int or a string?
int
14:39
5 mins ago, by milleniumbug
protip: 5 + 10*4 + 100*3 + 1000*2 + 10000*1 == 12345
^ use a loop and an accumulator variable
 accumulate(numbers.begin(), numbers.end(), [](int accum, int num) { return 10*accum + num; })
yep
@milleniumbug In this case I'd advocate for accumulate, using a loop is going unnecessarily low-level
yes but it's likely the prof/lab assistant won't know what it is
@milleniumbug so what?
at least they'll learn something new
also OP never mentioned whether they're using C or C++
14:44
true that, but he said he can use cout
I thought I did, but C is what i'm using currently
so can you or can you not use C++?
Well, I guess I can
there's little point in using C when you can use C++
But I'd prefer to use C.
14:47
oh seems you already know what to do
good luck then
I'd love a solution that would just cast a datatype in the correct place, so that it "formats" it into a string rather than integer, and just makes the string longer instead of using actual "math"
But..
I'd love world peace.
There's that as well
computers are dumb calculators, not magic robotic servants
I feel like we're not going towards that, though
14:49
so there's that too
@Xariez ^ there you go
There's the reason to use high level languages.
That being said, i'll need to ask
Does C not have any..string variable? Does it only manage numbers as far as variables go?
no, there's no string type
there's only char buffer and null terminated char sequences
Sep 11 '16 at 12:21, by milleniumbug
No one likes C strings
14:53
3 mins ago, by Bartek Banachewicz
computers are dumb calculators, not magic robotic servants
and C is dead set to keep that image in your head
1 min ago, by sehe
There's the reason to use high level languages.
Quoting our teacher:

" We'll be using C because it's basic, simple and a good place to start"
Ehh, I'm not sure if i can agree anymore
It's a subjectively good place to start.
C# was a rough start, not as rough as this though
Just. Deal with it. Accept that simple things are error prone and tedious. That is a good place to start, in a way
14:54
Well, in it's own way, you're not wrong
@Xariez C# is not rough by /any/ measure
When it's the first "script" language you ever touch, it is
it's not a "script" language by any measure
I guess at least you're not writing x86 assembly :P
So what would you call it? @BartekBanachewicz
14:55
that was fun, I should try doing it again
@Xariez Well. That makes "moist cake" a rough start in gastronomy
@milleniumbug My start too. Writing it using DEBUG.COM.
@Xariez compiled, statically typed, garbage-collected general purpose language targetting MS CLR
@BartekBanachewicz don't forget about the DLR :/
Ah, fack this for right now. It's friday and i'll enjoy it as the friday it is
I.. guess i'll need to ask before i go though
@sehe oh, I haven't actually started my programming experience with x86 assembly, it was my 3rd semester course
still quite fun
14:57
@Xariez That's the spirit. Might I suggest setting your own goals and just meeting the challenges given by teachers as posed? That's the way to learn
also omg DEBUG.COM
@sehe While it is one of the more difficult ones, this IS a task given by our teacher, so it needs to be done, but i guess i have made somewhat progress afterall
Another task I've got that I'd love advice with if possible, is to get the average value of a int array, using only two variables , one for input and one for output
stupid puzzles
@milleniumbug Ew. I learned BASIC (BASICA, GWBASIC) and MSX Basic/Amiga Basic (because those were the books the library had and I didn't have a computer). Also learned Z80 assembly because of similar reasons, before buying my first-ever book on 8088/8086 assembly myself.
@Xariez sum up and divide?
14:59
I've found a lot of solutions and i've tried a lot, but the problem is, you always need more than two variables
@Xariez Indeed. Accepting the complexity is step 1
@BartekBanachewicz I guess they're trying to make you come up with a solution you wouldn't think of otherwise, but still, I don't think this is a good way to do this
@Xariez Well, I assume the array is one variable?
Yep
As far as variables go, I got:

int input[5];
int average = 0;
@sehe lel create a struct and call it one variable
15:00
you can do it in place
By saying "most solutions", thats the thing @OneRaynyDay , they got a input variable and a output, but also the sum variable. The sum variable i'm not allowed to create.
what is the output variable?
An int?
int average = 0;
for (int x : input){
    average += x;
}

average /= 5;
Am I missing something?
woops, I assumed input was an std::vector. Adjust foreach to just a plain for loop :P
"two variables requirement" by the prof, I guess
15:03
Aye
@OneRaynyDay 3 variables (input, x, average)
Is a literal considered a variable? average += input[0]; average += input[1]...
^ True, but i'm not sure if he includes variables made by for loops, actually?
I feel like thats somewhat silly
I mean like there's only so much you can do. I'm sure the professor didn't want you to write out accessing each individual element
don't be too sure. Though it might help to present it as a pedantic "correctest" answer
15:06
I know we've been through putting code in images
But thats what i made out of it
And it very well might be working, actually
It makes "10, 10, 10, 10, 10"'s average to 10
And "10, 20, 30, 40, 50"'s average to 30
@sehe has happened to me pretty often when I assume specs for a large project, causes a avalanche effect
Fair enough, but if you reckon the code in that image works, i think i'll leave it at that. Afterall, we've only had the programming course two days now in school, so i feel like its unnecessary to make it all too complicated
I once implemented the DNS stack using TCP for a class project instead of UDP, had to redo the entire thing
@OneRaynyDay me too
15:10
@Xariez you should be good :)
I don't think it's valid to have int average (what's the average of 3,3,3,3,4?)
Oh yeah, it is supposed to be double, now that you say it
Fuck
Gladly
With some luck, it'll be as simple as changing the variables from int to double
The variable*
15:11
indeed it is^
It was brief so no offense meant if you don't
Alright, yeah, it was that simple. Awesome!
Thanks a bunch for the help! :D
15:55
should I move this convo back to Lounge?
No need
It seems I missed a spot
should I bug you here or on lounge?
depends on the topic, here for C++ related topics, lounge for everything else
15:58
Depends what it is. If it's lounging, go there. If it's q&a you could do it here
I see, it's a q&a, I'll keep it here :)
But pretty much I wanted to implement something with this interface:
matrix x; // perform init later
matrix y; // similarly
matrix z;
...
graph = exp(sum(x * y + z));
graph.forward(); // gives me the answer
graph.back(x); // gives me the partial w.r.t x
graph.back(y); // gives me the partial w.r.t y
This is obviously a DSL, but I'm not sure if boost::proto is the best way to go, or should I just implement my own wrappers over placeholders like matrix, etc over blas and overload the operators?
Hello

I am trying to use a function in C++, provided by openCV. But I don't understand why the compiler generates an error in my case:
Ptr<Dictionary> cv::aruco::getPredefinedDictionary(PREDEFINED_DICTIONARY_NAME name)
What I tried:
Ptr<aruco::Dictionary>markerDictionary = aruco::getPredefinedDictionary(aruco::PREDEFINED_DICTIONARY_NAME::DICT_4X4_50);
What my compiler says:
cameraCalibration.cpp:27:81: error: ‘cv::aruco::PREDEFINED_DICTIONARY_NAME’ is not a class or namespace
 o::Dictionary>markerDictionary = aruco::getPredefinedDictionary(aruco::PREDEFINED_
One thing that I'm doing that some other autodiff places are not doing, is that during forward() and back() I would create a concurrent queue of operators to evaluate and concurrently take elements from that std::queue and execute it
This will eventually generalize to bigger expressions like convolve(x, y), which takes a long time, and can be taken as a single task inside of the concurrent polymorphic std::queue<op>
@privetDruzia As far as I understand this, cv::aruco::PREDEFINED_DICTIONARY_NAME is a regular enum, not a scoped enum (that would be enum class)
so try aruco::DICT_4X4_50 instead of aruco::PREDEFINED_DICTIONARY_NAME::DICT_4X4_50
@OneRaynyDay over blas?
The rest I agree with. I'd say proto is heavy machinery you don't need with c++17
16:06
@sehe arbitrary. Wrapper matrix abstracts that away. I'm hoping ublas and blas.
@milleniumbug Thank you! :D
Yeah, looking at proto is just headsplitting. I've only done basic TMP, it's too much to take in
@OneRaynyDay Niebler has a c++11 variant here: github.com/ericniebler/proto-0x
@sehe It has no documentation; I imagine the process of getting that to work will be to stare down at source code until my eyes bleed, no?
16:22
@OneRaynyDay If you intend to implement your own, you might as well.
Odds of success are slightle better.
@sehe Hmm, but do I really need DSL's or is operator overload good enough though?
one is a DSL/parsing, and another is a purely OOP wrapping idea
@OneRaynyDay What is the difference. EDSL in C++ is by definition based on operator overloading
@OneRaynyDay Nah. graph = exp(sum(x * y + z)); is NOT parsing. graph = "exp(sum(x * y + z))"_g; would be parsing
@sehe well, I guess one is using template meta to make everything work, and another is evaluating during runtime for a fixed set of classes to interact with
(ironically, you can do constexpr parsing at compiletime: boost.org/doc/libs/1_65_0/doc/html/metaparse.html)
at leas that's what I thought the difference was
16:27
@OneRaynyDay huh, those two things are deffo orthogonal
Are they? tmp is compile time resolution, meanwhile I resolve them, by hand
Anyhoops. It seems you have to read up on eDSL, Template Expressions, and evaluation a bit. Or get your hands dirty on One To Throw Away
Ah okay :P probably. Thanks for the discussion, I'll be back after I read up on it more
@OneRaynyDay Stop being vague. TMP "is" not compile time "resolution". "Meanwhile" (during what?) "I resolve them" (you do? where?) "them" (what?), "by hand" (how)
You make it seem as if you have a whole body of code that we don't know about. I suspect there's just some notions inside your head, though.
@sehe in ::proto, you define some placeholders, a context, and an expr that allows specific operators. These are all done during compile time, no?
16:30
Sure
In my case, if I define what specific operators do on specific classes, like Foo& operator=(const Foo&);, I would be coding up what ::proto is generating, right
I believe it's ::proto::equals<...>, during the expression generation
Not exactly. But yeah, you could do without proto. We've been over that already
I see, but I was just addressing the c++11 variant link, since there were 2 alternatives posed(either proto or not), and I was arguing for the case for without proto
So we're on the same page in terms of discussion :)
On the other hand of arguing for proto, I'd agree that it's much more expressive and allows me to pretty much forego writing a large portion of the function defs myself
and I don't have a whole body of code :P just the basic setup. I'm stuck in that awkward crossroad scenario and not really progressing much
 
4 hours later…
20:29
> Or get your hands dirty on One To Throw Away

« first day (417 days earlier)      last day (2660 days later) »