Questions tagged [move]
Usually refers to move semantics; consider using that tag instead. Move semantics is a programming language feature that allows a copy operation to be replaced by a more efficient "move" when the source object is a temporary or an otherwise expiring object.
3,239
questions
-1
votes
0
answers
26
views
Moving a component with arrow keys in React
I'm learning react and I'm experimenting with the code, yesterday I wanted to make a ball that moves when arrow keys are pressed, I saw some tutorials and made it with js, very easy, then I wanted to ...
0
votes
1
answer
53
views
Is std::move of shared_ptr thread safe? [duplicate]
The following snippet runs fine:
#include <memory>
#include <cassert>
int main()
{
auto ptr1 = std::make_shared<int>(10);
assert(ptr1.use_count() == 1);
auto ptr2 = std::...
-1
votes
0
answers
18
views
Moving/copying files from multiple subfolders to new destination, but maintaining folder structure
$srcRoot = (Get-ChildItem -Path 'C:\Users\Nick\Documents\*\* Archive' -Directory).FullName
Above is what I am using to get all of the files under multiple subfolders with the same name of "* ...
0
votes
0
answers
43
views
C++ Move vs Copy a local stl container to a list inside a loop
In the lower fictitious code example (C++17) I ask myself whether I should optimize here with std::move or better not. The last emplace_back seems to be a suitable candidate, since "idsLocal"...
0
votes
2
answers
25
views
How to move array from parent folder to new destination, while keeping same folder structure?
$srcRoot = (Get-ChildItem -Path 'C:\Unsigned Items\*\*\* Archive' -Directory).FullName
Above is what I am using to get all of the files under multiple subfolders with the same name of "* Archive&...
0
votes
2
answers
73
views
g++ : detect use after std::move
I just found an error in my code due to using an std::vector after having moved it. The code was something like :
std::vector<SomeObject> v1;
//fill v1;
this->v2=std::move(v1);
for(unsigned ...
0
votes
3
answers
21
views
Remove/move rows that have matching values in an other dataframe
I'm currently working on managing refunding of products after some systems errors occured.
I have a huge xlxs list (table 1) with all pending refunds of a couple of weeks. However, some of the records ...
0
votes
0
answers
9
views
Return React child element from pressed to idle state, when user start move parent element with mousemove
Child element is dynamic, without access to code, has 100% parent size, has own onClick on whole element. It has pressed state (when user hold mouse button).
Parent element must listen mouse events ...
0
votes
2
answers
50
views
Calling move constructor when returning an rvalue-reference
This is a follow-up question of my previous question.
Consider the following toy code:
#include <iostream>
using namespace std;
class X
{
public:
X() { }
X(X&& x)
{
...
0
votes
1
answer
31
views
Why do I get an implicit move constructor in a class with a user-defined destructor
I am confused with some aspects of the implicit move constructor.
My understanding is that the implicitly-declared move constructor are provided by the compiler for a class iff there are no user-...
-1
votes
0
answers
39
views
Move shapes using visual studio C++
I'm working on a project in visual studio C++ by using bgi library and I drew a cloud using a midpoint circle algorithm, and I want it to move, I don't want to use cleardevice, if you have ideas I ...
1
vote
2
answers
41
views
Moving multiple items from one list to another in single line in Python
I'd like to move multiple items from one list to another.
The items are to be removed from the first list and inserted at the end of the second list.
The value of the items are unknown but the indexes ...
-1
votes
2
answers
69
views
How to avoid "move occurs because `v` has type `Vec<char>`, which does not implement the `Copy` trait" within loop
It appears that a prohibited borrow is occurring here but I am not seeing a way around it to do what I'd need to do. It looks like the problem occurs when after setting the mut value within the loop I ...
1
vote
1
answer
20
views
Phaser 3: Make object movement on the slope
I am trying following with this post:
https://cedarcantab.wixsite.com/website-1/post/phaser-coding-tips1-2-revisited-part-1-creating-a-game-like-tanks---worms
and now I want to make the tank move on ...
2
votes
1
answer
47
views
Moving the last element of a vector
What is the most efficient way to obtain the last (heavy) element from a vector and remove it, and make as few copies as possible?
Is it
template <typaname T>
T moveLastElement (std::vector<T&...
2
votes
1
answer
54
views
Shouldn't there be a copy ctor invocation here? Elision disabled (no named return value optimization)
struct Test {
int field = 30;
Test() { cout << "In ctor" << endl; }
Test(const Test &other) { field = other.field; cout << "In copy ctor" << ...
1
vote
1
answer
32
views
Getting out of a loop, but it needs to remain running?
I've made a circle move around (in a circle), but now my application won't move on to the other tasks as I got myself caught in a loop.
How do I get out of this and still have my circle moving in the ...
1
vote
3
answers
58
views
Move elements while reallocation elements in vector
I have the following code:
#include <vector>
#include <iostream>
struct Data
{
Data() = default;
Data(const Data& other)
{
std::cout << "copy ctr" ...
0
votes
1
answer
26
views
Netlogo: update a list after each movement
I need help with the following problem. I have turtles located in 3 different zones A, B, C. They have some properties
turtle-own[place-to-go]
patch-own[n-of-empty-places]
Turtles move to one patch ...
2
votes
0
answers
55
views
Rust type annotation on left side of let pattern matching [duplicate]
The compiler will complain that z is moved and can not be referenced anymore:
Rust playground
let mut x = 100 ;
let z = &mut x ;
let z1 = z ;
*z1 = 200 ;
println!("{}", z) ; // <=...
-1
votes
1
answer
20
views
.bat file to move other files based on file name
I have two folders. "Folder one" in which "folder two" is located. In "folder two" are .png files which carry the names of the files I would like to move from "...
0
votes
1
answer
24
views
Netlogo: move to a specific patch
I am gonna ask a simple question. I have workers and patches. Workers want to go to a specific patch, labeled by an id. I tried the following code, but it does not work. Can someone help me? Thanks
...
1
vote
1
answer
63
views
MOVE files from list found in folders/subfolders to same folder structure in another folder
I have this Excel VBA script that move files from one folder to another based on a list in Excel. However, I have to go subfolder by subfolder to get the files. I wanted to modify the script such that ...
1
vote
1
answer
48
views
Too many copies of the function to use std::move in C++
I have 2 classes: A and B. I need to pass instances of them to a function that will push them into a vector. I want to have good efficiency in my program, so I try to use move semantics. So in that ...
0
votes
1
answer
30
views
Netlogo: move turtles to non-occupied patches and print it
I want to move turtles to one of patches not fully occupied (n-jobs-to-fill != 0). The code is
ask turtles [move-to one-of patches with [n-jobs-to-fill != 0]
After each allocation turtle-patch, n-...
0
votes
0
answers
16
views
Netlogo How to export "turtle movements" matrix
I am looking for a way to generate an origin-destination matrix in Netlogo. Let's say my model have 3 areas A, B, C and 10 turtles. At time 0, 5 turtles are in A, 3 in B and 2 in C. Then, I allow all ...
2
votes
3
answers
106
views
Is there a STL algorithm or a C++ idiom that moves an item from one std::list to another based on a predicate?
I have a workflow in which I start with a std::list of movable objects and I want to traverse this list, MOVING elements which meet a certain condition (i.e. a unary predicate returns true) to a ...
2
votes
0
answers
84
views
Why vector.tcc implement _M_fill_insert by __uninitialized_move_a?
In gcc vector.tcc::_M_fill_insert function (line524), the implementation uses
case 1: __uninitialized_move_a(line562) for case of uninitialized but existing memory;
case 2: ...
5
votes
1
answer
92
views
Should I move the value out of an optional or move the whole optional?
Is there an effective difference between std::move(*optional) and *std::move(optional)? Which one is preferable?
Full example:
#include <optional>
#include <vector>
void foo()
{
std::...
0
votes
0
answers
26
views
When moving files into Termux from downloaded drive files the names end up preserving version number. How can I avoid this or mitigate it?
When downloading files from Google Drive onto my phone I can then pulldown the notification bar and choose locate files, then select them and click the sandwich in the upper left hand corner to move ...
2
votes
1
answer
79
views
Basic forward list using unique_ptrs
As an exercise in learning C++, I want to build my own forward list using raw pointers and using unique_ptrs. Using raw pointers, I have:
struct node_raw {
node_raw(int data_, node_raw *next_) : ...
0
votes
0
answers
65
views
How Copy trait is implemented under the hood in rust [duplicate]
I wanted to make copy of object i created so writed this code
struct values{
value:i32,
}
impl values{
fn returner(self)->values{
return self
}
}
fn main(){
let mut data =...
0
votes
0
answers
14
views
Force move folders matching pattern to another location with same name
I am trying to move some directories/files matching the pattern /path/to/dir/*/YYYYMMDD to a junk path using the mv -f command:
mv -f /path/to/dir/*/YYYYMMDD /path/to/junk/
Within those folders in /...
0
votes
0
answers
30
views
PowerShell Move Duplicates to Dup Folder
Below is what I currently have and it is working. However, If I have a duplicate is just spits out an error and doesnt move the file.. obviously. How can I implement to move said duplicate file(s) to ...
0
votes
0
answers
24
views
Is there a way to move files without closing python?
I have a program that makes calculus, converts different data and plots it while saving it in different directories. So far, so good BUT. Whenever I want to move the files generated to another folder ...
0
votes
0
answers
23
views
Move files to folder in same directory but for 2,000 separate directories
I've searched all over and seen many similar questions but nothing I was able to tweak and make work for my situation.
I have files in a folder like this
C:\music\unknown-folder-name\*.*
And I want to ...
2
votes
1
answer
63
views
How to move items excluding certain folder using PowerShell?
The question is an oversimplification of the real issue.
I have a folder let's call it "ParentFolder". Within this folder are files and subfolders. I want all the files and subfolders moved ...
0
votes
2
answers
106
views
Why is std::move generating instructions here?
I heard time and again that std::move(t) is more or less only a fancy way of saying static_cast<T&&>(t) and would not generate any instructions.
When I was playing around now with std::...
0
votes
0
answers
41
views
Move record with laravel move_uploaded_file(): Unable to move
I'm recording with script voice record and its saved to db but not moving to the public folder
i've dd every single code and its working but don't know why the method of moving not working and when i ...
0
votes
1
answer
103
views
Move the text up down when button is pressed in react native
Can someone tell me how to move the text up & down when I press a button I want to slide the text up?
1
vote
1
answer
62
views
Forwarding tuple<...> containing deleted copy constructor
I have a function wrapper for use over the network:
#pragma once
#include <tuple>
#include <functional>
struct ZPackage {
std::unique_ptr<int> m_dummy;
template<...
1
vote
1
answer
62
views
How to increment copies of a file using Powershell?
I have to move files from one folder to another every hour.
If there is a copy of a file in the destination folder I want it named FileName_1. In the next hour if the original file is copied again ...
0
votes
0
answers
16
views
test .zip/.7z/.rar if archive is bad, add prefix to file name bad_ and move to another folder
I have quite a few archives that I need to test.
Archives are in parent folders with many sub folders.
I am a Windows 10/11 user.
I have used 7z file manager easy enough, checks a folder for me and ...
-1
votes
1
answer
35
views
Move a rectangle drawn inside a canvas [duplicate]
I am trying to move a rectangle drawn inside a canvas. When I run my code I get an error which basically says 'Canvas.Top' is not a supported property. Any ideas? Thanks in advance.
Here is my code:
&...
0
votes
0
answers
30
views
customized drag command on Livecode
I'm trying to create a special drag command for a game.
For the question's sake, my card contains only a draggable button (on mouseDown drag me end mouse down)
I want that after I dragged the button ...
-1
votes
2
answers
47
views
Javascript Object move object key into value array
how can I transfer a key to a value which is an object.
I would like to move key which is the product ID level down to a value as "id"
I have an array like this:
const products = [
{
&...
0
votes
0
answers
126
views
How to move button in pysimplegui
hello I have to make a game for a school project but I'm stuck on a part
I use py simple gui to display my window and create the game interface only I get stuck or I have to move buttons randomly, ...
0
votes
1
answer
23
views
How to move multiple files in multiple folder in a simple method
I have three images named Apple, Banana, Orange
and I also have three folders according to the same name.
And all the files and all the empty folders are on the same path.
Now I want to create a way ...
-1
votes
1
answer
36
views
Batch Moving Folders based on their content
How would one batch move folders to another location based on the type of content they have.
eg: I have 1000 folders, some containing .zip's some containing .jpg's some containing .txt etc.
So based ...
-1
votes
1
answer
47
views
Python Tkinter should use default directory, if I don't specify the directory
I have the following program: https://i.stack.imgur.com/TgzXz.png. Now if I press the Download Location Button, then it should download the song to the chosen directory, this works perfectly. But if I ...