move

std::move Vs std::forward

怎甘沉沦 提交于 2019-12-04 12:07:37
问题 This seems to be most relavant question already asked. Whats the difference between std::move and std::forward But each answer is different and applies and says slightly different things. So I am confused. I have the following situation. Copy item into container The Copy item is C++03 so I understand that quite well. Construct item into container The Construct item into container I believe uses perfect forwarding correctly to forward the arguments through two functions to the constructor of T

How To Move (Drag and Drop) multiple Shapes with D3

跟風遠走 提交于 2019-12-04 11:58:42
How do I move (drag and drop) multiple shapes with d3. I tried putting some shapes in a svg and move the svg - this works but not smoothly. This is what I got so far <html> <head> <script type="text/javascript" src="d3.v3.min.js"></script> <title>Creating SVG groups with D3.js</title> </head> <body> <script type="text/javascript"> // http://tutorials.jenkov.com/svg/g-element.html d3image = d3.select("body"); svgcanvas = d3image.append("svg:svg").attr("width", 700).attr("height", 500); svg1 = svgcanvas.append("svg:svg").attr("x", 100).attr("y", 100); circle1 = svg1.append("svg:circle") .attr(

Draw line and move it programmatically

烂漫一生 提交于 2019-12-04 11:33:05
问题 I want to draw a line on a WPF Grid. private void InitializeTestline() { testline = new Line(); grid.Children.Add(testline); testline.X1 = 0; testline.X2 = 1; testline.Y1 = 0; testline.Y2 = 1; testline.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; testline.VerticalAlignment = System.Windows.VerticalAlignment.Top; testline.Stroke = Brushes.Red; testline.Stretch = Stretch.Fill; testline.StrokeThickness = 2; testline.Visibility = System.Windows.Visibility.Visible; } It is drawn

What makes moving objects faster than copying?

时光总嘲笑我的痴心妄想 提交于 2019-12-04 07:42:45
问题 I have heard Scott Meyers say " std::move() doesn't move anything" ... but I haven't understood what it means. So to specify my question consider the following: class Box { /* things... */ }; Box box1 = some_value; Box box2 = box1; // value of box1 is copied to box2 ... ok What about: Box box3 = std::move(box1); I do understand the rules of lvalue and rvalue but what I don't understand is what is actually happening in the memory? Is it just copying the value in some different way, sharing an

Possible to move the tmp directory of Eclipse?

送分小仙女□ 提交于 2019-12-04 06:32:39
I'm trying to speed up Eclipse by having my projects on a RAM disk (stuck with a slow laptop and a heavy kind of eclipse project at the moment). Worked great for loading the project and such, but when I'm building it seems to read and write a lot to a directory in %APPDATA% (seems to have a generated name from the name of the project). This makes it actually go slower than usual... So... is there a way I can move the tmp directory of eclipse? Preferably without moving the tmp directory of other applications in the process. May have found a way by setting a property called java.io.tmpdir in

std::move with std::make_pair

拈花ヽ惹草 提交于 2019-12-04 05:28:30
Is there any difference between: std::map <int,std::pair<T,T>> m; T t1,t2; m.emplace(1,std::make_pair(t1,t2)); and: std::map <int,std::pair<T,T>> m; T t1,t2; m.emplace(1,std::move(std::make_pair(t1,t2))); Is the std::move redundant here? Will std::map::emplace and perfect forwarding take care of allocating the std::pair directly in the std::map ? std::make_pair(...) and std::move(std::make_pair(...)) are both rvalue expressions (the first one is a prvalue, the second one is an xvalue). Since emplace takes forwarding references, both are deduced as the same type, so std::move in this case is

Powershell: Move Files recursively

◇◆丶佛笑我妖孽 提交于 2019-12-04 05:22:31
I am trying to copy all build output files and folders into a Bin folder ( OutputDir/Bin ) except of some files which stay in the OutputDir . The Bin folder will never be deleted. Initial condition: Output config.log4net file1.txt file2.txt file3.dll ProjectXXX.exe en foo.txt fr foo.txt de foo.txt Target: Output Bin file1.txt file2.txt file3.dll en foo.txt fr foo.txt de foo.txt config.log4net ProjectXXX.exe My first try: $binaries = $args[0] $binFolderName = "bin" $binFolderPath = Join-Path $binaries $binFolderName New-Item $binFolderPath -ItemType Directory Get-Childitem -Path $binaries | ? {

Javascript move multiple elements to separate div's and back

旧巷老猫 提交于 2019-12-04 04:54:58
问题 There are 3 videos, placed in 3 separate div's. There also are 3 separate div's, but in other position of a page (lets say contA and contB and contC). I want that if I click on the video1, then video2 and video3 goes to contA and contB, and video1 goes to contC. If I click video1 again, all videos go back to their original position. If I click on video2 (while its in contA), then video1 goes to contA, video3 goes to contB, video2 goes to contC. I have prepared a jsbin demo: Jsbin DEMO Anyone

smoothing mouse movement

眉间皱痕 提交于 2019-12-04 03:31:59
问题 I'm developing a software to move the mouse based on certain coordinates which i get from a depth image from kinect. but I have 30 frames/second(images/second) and those coordinates changes with every frame so the mouse keeps moving. My question is,Is there a way to smooth the movement of the mouse ? 回答1: Yes you can start tracking with some parameters that allows you to make move smoother. Below is an example code: var parameters = new TransformSmoothParameters { Smoothing = 0.2f, Correction

Resize on std::vector does not call move constructor [duplicate]

百般思念 提交于 2019-12-04 03:26:38
This question already has answers here : Closed 4 years ago . C++11 rvalue reference calling copy constructor too (4 answers) I have been playing around with std::vector to understand when objects are constructed, destructed, copy constructed and move constructed. To so do, I have written the following program #include <iostream> #include <vector> class Test { public: Test() { std::cout << "Constructor called for " << this << std::endl; } Test(const Test& x) { std::cout << "Copy Constructor called for " << this << std::endl; } Test(Test&& x) { std::cout << "Move Constructor called for " <<