--- Log opened Fri May 31 00:00:38 2019 | ||
-!- wiking [~wiking@huwico/staff/wiking] has quit [Remote host closed the connection] | 04:44 | |
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun | 04:50 | |
-!- mode/#shogun [+o wiking] by ChanServ | 04:50 | |
-!- wiking [~wiking@huwico/staff/wiking] has quit [Ping timeout: 248 seconds] | 04:55 | |
-!- TheMoatman [~Moatman@pool-108-45-140-154.washdc.fios.verizon.net] has joined #shogun | 05:14 | |
-!- Moatman [~Moatman@pool-108-45-140-154.washdc.fios.verizon.net] has quit [Read error: Connection reset by peer] | 05:14 | |
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun | 05:31 | |
-!- mode/#shogun [+o wiking] by ChanServ | 05:31 | |
-!- wiking [~wiking@huwico/staff/wiking] has quit [Ping timeout: 258 seconds] | 05:36 | |
-!- lambday [a7dcee98@gateway/web/freenode/ip.167.220.238.152] has joined #shogun | 06:01 | |
-!- mode/#shogun [+o lambday] by ChanServ | 06:01 | |
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun | 06:34 | |
-!- mode/#shogun [+o wiking] by ChanServ | 06:34 | |
-!- wiking [~wiking@huwico/staff/wiking] has quit [Remote host closed the connection] | 07:30 | |
-!- TheMoatman [~Moatman@pool-108-45-140-154.washdc.fios.verizon.net] has quit [Quit: Leaving] | 08:51 | |
-!- gf712 [9052726e@gateway/web/freenode/ip.144.82.114.110] has joined #shogun | 09:03 | |
-!- geektoni [973e0080@gateway/web/freenode/ip.151.62.0.128] has joined #shogun | 09:43 | |
-!- gf712 [9052726e@gateway/web/freenode/ip.144.82.114.110] has quit [Ping timeout: 256 seconds] | 11:10 | |
-!- geektoni [973e0080@gateway/web/freenode/ip.151.62.0.128] has quit [Ping timeout: 256 seconds] | 11:13 | |
-!- gf712 [bcd58b26@gateway/web/freenode/ip.188.213.139.38] has joined #shogun | 11:44 | |
-!- gf712 [bcd58b26@gateway/web/freenode/ip.188.213.139.38] has quit [Ping timeout: 256 seconds] | 13:10 | |
-!- gf712 [bcd58b26@gateway/web/freenode/ip.188.213.139.38] has joined #shogun | 13:57 | |
-!- gf712 [bcd58b26@gateway/web/freenode/ip.188.213.139.38] has quit [Quit: Page closed] | 14:09 | |
-!- HeikoS [~heiko@103.pool85-48-188.static.orange.es] has joined #shogun | 15:13 | |
-!- mode/#shogun [+o HeikoS] by ChanServ | 15:13 | |
-!- gf712 [c13cdcfd@gateway/web/freenode/ip.193.60.220.253] has joined #shogun | 15:27 | |
gf712 | HeikoS: ping | 15:27 |
---|---|---|
@HeikoS | gf712: pong | 15:27 |
@HeikoS | hi | 15:27 |
@HeikoS | I actually have a q for you :) | 15:27 |
gf712 | sure :) | 15:27 |
@HeikoS | if a function returns std::pair<LabelMap&&, LabelMap&&> | 15:27 |
@HeikoS | and then inside i construct a LabelMap on stack, populate it and return it using make_pair | 15:28 |
@HeikoS | and then I call the function elsewhere and assign the result to member variables | 15:28 |
@HeikoS | will the LabelMap be copied? | 15:28 |
gf712 | hmm good question, I don't think so | 15:29 |
@HeikoS | gf712: basically, see https://github.com/shogun-toolbox/shogun/pull/4650/files | 15:29 |
gf712 | but I am not sure what std::pair<LabelMap&&, LabelMap&&> would be used for? | 15:29 |
gf712 | why an r value ref? | 15:29 |
@HeikoS | I would like to avoid that the LabelMaps created in create_mapping are copied | 15:29 |
@HeikoS | but directly assigned to member | 15:29 |
@HeikoS | https://github.com/shogun-toolbox/shogun/pull/4650/files#diff-013a46d146cf036527c80c257a36fe93R105 | 15:29 |
@HeikoS | here | 15:29 |
@HeikoS | I'd like to directly assign to the member here: https://github.com/shogun-toolbox/shogun/pull/4650/files#diff-013a46d146cf036527c80c257a36fe93R107 | 15:30 |
@HeikoS | maybe just pass a reference to the maps to the function instead? | 15:30 |
gf712 | right, but you aren't copying the underlying data in pair right? | 15:30 |
gf712 | the pair has the pointer? | 15:30 |
gf712 | which then is copied | 15:30 |
gf712 | you can also do a move | 15:30 |
@HeikoS | LabelMap is just std::map | 15:31 |
gf712 | but that would be std::pair<>&& | 15:31 |
@HeikoS | but I want to create two of them | 15:31 |
@HeikoS | and all I really want is to avoid them being copied | 15:31 |
@HeikoS | the two LabelMap instances that is | 15:31 |
gf712 | you should try it on compiler explorer | 15:31 |
gf712 | I am not sure right now] | 15:31 |
gf712 | HeikoS: https://github.com/mattgodbolt/compiler-explorer | 15:32 |
@HeikoS | in general, how would I do this for a single return element | 15:32 |
@HeikoS | like I have a function that returns std::map somehow | 15:32 |
@HeikoS | and I want to assign that to a class member | 15:32 |
gf712 | well a single element you would just return T&& | 15:32 |
gf712 | which would invoke move constructor | 15:33 |
gf712 | if there is one | 15:33 |
@HeikoS | that's what I thought when I made the return type | 15:33 |
@HeikoS | std::pair<T&&, T&&> | 15:33 |
@HeikoS | oh chaning the return type makes the unit tests crash ... | 15:37 |
gf712 | HeikoS: I just tried it in compiler explorer | 15:39 |
gf712 | std::pair<T&&, T&&> | 15:39 |
gf712 | calls move constructors :) | 15:39 |
gf712 | no copies made! | 15:39 |
@HeikoS | stack overflow | 15:40 |
@HeikoS | maybe I call it wrongly | 15:40 |
@HeikoS | let me try again | 15:40 |
gf712 | HeikoS: did you hear back from ati yet btw? | 15:40 |
@HeikoS | gf712: no, that's why I came online actually | 15:41 |
@HeikoS | but nothing yet | 15:41 |
@HeikoS | I can ask James | 15:41 |
gf712 | that's annoying! | 15:41 |
@HeikoS | but I thought they are probably just delaye | 15:41 |
@HeikoS | shall I ask? | 15:41 |
gf712 | up to you :) | 15:41 |
gf712 | meant to have my exit interview today | 15:41 |
@HeikoS | lol | 15:42 |
@HeikoS | well | 15:42 |
gf712 | but there's been complications... apparently when you say attend a meeting they expect you to confirm by email... | 15:42 |
@HeikoS | with whom would that be? | 15:42 |
gf712 | some hr person | 15:42 |
@HeikoS | i see | 15:42 |
gf712 | anyway | 15:42 |
gf712 | I just wanted to give the laptop back | 15:42 |
gf712 | going away for the weekend in a few hours so don't have much time | 15:42 |
@HeikoS | haha | 15:43 |
@HeikoS | just keep it I guess | 15:43 |
@HeikoS | (until this is figured out) | 15:43 |
gf712 | HeikoS: https://pastebin.com/Hx2D1ARE | 15:43 |
@HeikoS | just changed it to this | 15:43 |
gf712 | what I tested | 15:43 |
@HeikoS | https://github.com/shogun-toolbox/shogun/pull/4650/files#diff-013a46d146cf036527c80c257a36fe93R108 | 15:43 |
@HeikoS | now it rashes | 15:43 |
@HeikoS | maybe I call it wrong? | 15:43 |
gf712 | mhhh im not sure | 15:44 |
@HeikoS | does an asisgnment invoke move ctor? for T&& type? | 15:44 |
@HeikoS | https://github.com/shogun-toolbox/shogun/pull/4650/files#diff-013a46d146cf036527c80c257a36fe93R108 | 15:45 |
@HeikoS | this one ^ | 15:45 |
gf712 | the assignment will invoke copy though | 15:45 |
gf712 | the result->m_to_internal = mapping.first; | 15:45 |
@HeikoS | internal = LabelMap(mapping.first) ? | 15:46 |
gf712 | HeikoS: so the T&& is not needed | 15:46 |
gf712 | move semantics is used automatically | 15:46 |
@HeikoS | can you explain? | 15:46 |
gf712 | and to get the value use std::move(mapping.first) | 15:46 |
@HeikoS | ah | 15:46 |
gf712 | not sure how, but just tested on compiler explorer | 15:47 |
gf712 | and the | 15:47 |
@HeikoS | so just leave the return type as std::pair<T,T> | 15:47 |
gf712 | it works! | 15:47 |
gf712 | yup | 15:47 |
@HeikoS | and then just do the std::move after the call | 15:47 |
@HeikoS | ok | 15:47 |
@HeikoS | lemme try | 15:47 |
gf712 | yes | 15:47 |
gf712 | you just can't use pair.first again right? pretty sure the move is destructive | 15:48 |
gf712 | anyway, got to go! | 15:48 |
@HeikoS | yes | 15:48 |
@HeikoS | got that | 15:48 |
@HeikoS | ok | 15:49 |
gf712 | have a nice weekend! | 15:49 |
@HeikoS | have a nice weekend | 15:49 |
@HeikoS | and: pleasure working with you the last months! :) | 15:49 |
gf712 | let me know if you find about the ati! | 15:49 |
@HeikoS | let's hope it continues | 15:49 |
gf712 | no worries! | 15:49 |
gf712 | me too | 15:49 |
gf712 | looking forward to Berlin :) | 15:49 |
@HeikoS | me too | 15:49 |
@HeikoS | see you there! | 15:49 |
-!- gf712 [c13cdcfd@gateway/web/freenode/ip.193.60.220.253] has quit [Quit: Page closed] | 15:49 | |
-!- HeikoS [~heiko@103.pool85-48-188.static.orange.es] has quit [Ping timeout: 245 seconds] | 16:14 | |
-!- gf712 [bcd58b26@gateway/web/freenode/ip.188.213.139.38] has joined #shogun | 16:45 | |
-!- gf712 [bcd58b26@gateway/web/freenode/ip.188.213.139.38] has quit [Client Quit] | 16:45 | |
-!- HeikoS [~heiko@45.pool85-48-188.static.orange.es] has joined #shogun | 17:02 | |
-!- mode/#shogun [+o HeikoS] by ChanServ | 17:02 | |
-!- HeikoS [~heiko@45.pool85-48-188.static.orange.es] has quit [Ping timeout: 245 seconds] | 18:46 | |
--- Log closed Sat Jun 01 00:00:39 2019 |
Generated by irclog2html.py 2.10.0 by Marius Gedminas - find it at mg.pov.lt!