void foo() {
struct Foo { .. };
std::vector<foo> vec; // why is this illegal?
}
I'm not returning foo to the outside world. It's just a temporary type that I use within the function.
So let's say I have a vector p = [1 2 3]. I want a command that looks like this:
[x y z] = p;
so that x = p(1), y = p(2), and z = p(3).
Is there an easy way to do this?
question: how can i bind the same vector, lets say o=c(1,2,3,4) mutiple times to get a matrix like
o=array(c(1,2,3,4,1,2,3,4,1,2,3,4), dim(c(4,3))
o
[,1] [,2] [,3]
[1,] 1 1 1
[2,] 2 2 2
[3,] 3 3 3
[4,] 4 4 4
in a nicer way then: o=cbind(o,o,o) and maybe more generalized…
Lets say I have a vector of int which I've prefilled with 100 elements with a value of 0.
Then I create 2 threads and tell the first thread to fill elements 0 to 49 with numbers, then tell thread 2 to fill elements 50 to 99 with numbers. Can this be done? Otherwise, what's the best way of achieving this?
Thanks
Hello,
for my application (WPF) I'd like to use the standard icons for save, open... However, I'm not aware of them being available as vector graphics? So, where can one get them, is it maybe possible to extract them from some DLL files or whatever? Thank you very much!
I have a large, dense matrix A, and I aim to find the solution to the linear system Ax=b using an iterative method (in MATLAB was the plan using its built in GMRES). For more than 10,000 rows, this is too much for my computer to store in memory, but I know that the entries in A are constructed by two known vectors x and y of length N and…
I have to draw a 20 plots and horizontally place a legends in each plots.
I gave the following command for the first plot:
plot(x=1:4,y=1:4)
legend("bottom",legend = c("a","b","c","d"),horiz=TRUE,text.font=2,cex=0.64)
then for the second plot I tried :
plot(x=1:2,y=1:2)
legend("bottom",legend =…
There is a code snippet presented in The Pragmatic Programmer on page 143 as:
public class Colada {
private Blender myBlender;
private Vector myStuff;
public Colada() {
myBlender = new Blender();
myStuff = new Vector();
}
private doSomething() {
…
I am trying to run blocking_udp_echo_client on MacOS X
http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/example/echo/blocking_udp_echo_client.cpp
I run it with argument 'localhost 9000'
But the program crashes and this is the line in the source which crashes:
`udp::socket…
is it wasteful/bad design to use a vector/list where in most instances it will only have one element?
example:
class dragon
{
ArrayList<head> = new ArrayList<head> Heads;
tail Tail = new tail();
body Body = new body();
dragon()
{
…
Our organization did invest in PRINCE2 training and certification for our Project Managers and we would like to advertise the fact that we are certified and we use PRINCE2 project management method.
Where can I get PRINCE2 logo in eps vector graphics format, usable for…
I'm a bit confused about the object references. Please check the examples below:
class ListHandler {
public:
ListHandler(vector<int> &list);
private:
vector<int> list;
}
ListHandler::ListHandler(vector<int> &list) {
this->list =…
This is a followup to this problem:
Reducing Integer Fractions Algorithm
Following is a solution to the problem from a grandmaster:
#include <cstdio>
#include <algorithm>
#include <functional>
using namespace std;
const int MAXN = 100100;
const…
I have a question about XSS
Can forms be used as a vector for XSS even if the data is not stored in the database and used at a later point?
i.e. in php the code would be this:
<form input="text" value="<?= @$_POST['my_field'] ?>" name='my_field'>
…
In my app I want show a list,and when user click in any list item ,some new items must be added to the same list.Now I use default ListField of bb and a vetcor to add or remove elements to or from it.Now I want the list to hold more than one row(an image and…
Hello, everyone!
I am implementing a text-based version of Scrabble for a college project.
I have a vector containing around 400K strings (my dictionary), and, at some point in every turn, I'm going to have to check if any word in the dictionary can be…
Hello, everyone!
I am implementing a text-based version of Scrabble for a college project.
I have a vector containing around 400K strings (my dictionary), and, at some point in every turn, I'm going to have to check if there's still a word in the…
I have a vector<unsigned int> vec of size n. Each element in vec is in the range [0, m], no duplicates, and I want to sort vec. Is it possible to do better than O(n log n) time if you're allowed to use O(m) space? In the average case m is…
I'm pretty confused. I have a point:
x= -12669114.702301
y= 5561132.6760608
That I got from drawing a square on a vector layer with the DrawFeature controller.
The numbers seem...erm...awfull large, but they seem to work, because if I…
There are generally two techniques to increase the memory throughput of the global memory on a CUDA kernel; memory accesses coalescence and accessing words of at least 4 bytes. With the first technique accesses to the same memory segment…
Hi,
I solved this problem by following a straightforward but not optimal algorithm. I sorted the vector in descending order and after that substracted numbers from max to min to see if I get a + b + c = d.
Notice that I haven't used…
Been having a difficult time transforming 2D screen coordinates to 3D isometric space. This is the situation where I am working in 3D but I have an orthographic camera. Then my camera is positioned at (100, 200, 100), Where the xz…
I'm not familiar with how these stack exchange accounts work so if this is double posting I apologize. I asked the same thing on stackoverflow.
I have added an AI routine to a game I am working on using the Negascout algorithm.
…
My SAT algorithm falsely reports that collision is occurring when using certain polygons. I believe this happens when using a polygon that does not contain a right angle. Here is a simple diagram of what is going wrong:
Here…
On Ubuntu 12.4 laptop with Gnome desktop, I tried to set an additional display through Catalyst (administrative) and slowly ended up making making a mess out of the whole thing. I tried several combinations of settings and at…