I'm a C++ amateur. I'm writing some Win32 API code and there are handles and weirdly compositely allocated objects aplenty. So I was wondering - is there some wrapper class that would make resource management easier?
For example, when I want to load some data I open a file with CreateFile() and get a HANDLE. When I'm done with it, I sho...
Ok. here's the operations i successfully code so far thank's to your help:
Adittion:
polinom operator+(const polinom& P) const
{
polinom Result;
constIter i = poly.begin(), j = P.poly.begin();
while (i != poly.end() && j != P.poly.end()) { //logic while both iterators are valid
if (i->pow > j->pow) { //if the cu...
In unmanaged c++ dll i have a function which takes constant std::string as argument
Prototype : void read ( const std::string &imageSpec_ )
I call this function from managed c++ dll by passing a std::string.
When i debug the unmanaged c++ code the parameter imageSpec_ shows the value correctly but does not allow me to copy that value...
Hello!
I'm writing a C++/OOP wrapper for Lua. My code is:
class LuaState
{
boost::shared_ptr<lua_State> L;
LuaState(): L( luaL_newstate(), LuaState::CustomDeleter )
{
}
}
The problem is lua_State is incomplete type and shared_ptr constructor requires complete type. And I need safe pointer sharing. (Funny thing bo...
Hi Experts,
I would like to execute a R script simply as
R --file=x.R
It runs well on the command line. However when I try the system call in C++ by
QProcess::execute("R --file=x.R");
or
system("R --file=x.R");
the program R runs and quits but I can't see the output the program is supposed to generate. If a program uses no std...
Here is the code in C++ dll:
extern "C" _declspec(dllexport) int testDelegate(int (*addFunction)(int, int), int a, int b)
{
int res = addFunction(a, b);
return res;
}
and here is the code in C#:
public delegate int AddIntegersDelegate(int number1, int number2);
public static int AddIntegers(int a, int b)
{
return a + b;
}
...
I have a QTableView which I am setting a custom QStyledItemDelegate on.
In addition to the custom item painting, I want to style the row's background color for the selection/hovered states. The look I am going for is something like this KGet screenshot:
Here is my code:
void MyDelegate::paint( QPainter* painter, const QStyleOptionVie...
Hello
What was the munch library (or program?) from cfront package?
What is was used for ?
Thanks
...
Hello,
I have written the majority of my project in C++. However there are several "filters" or folders which need to be compiled as C and linked to the project. How can I configure this within VStudio? Thanks.
...
Hello,
I want my VC++ code to be executed as fast as possible. Does anybody know what I should change or set in project properties and settings?
...
What is the cheapest way to initialize a std::vector from a C-style array?
Example: In the following class, I have a vector, but due to outside restrictions, the data will be passed in as C-style array:
class Foo {
std::vector<double> w_;
public:
void set_data(double* w, int len){
// how to cheaply initialize the std::vector?
}
...
C++ has several types of styles: MFC, Boost, Google, etc. I would like to examine these styles and determine which one is best for my projects, but I want to read from the official style guidebook. Does anyone have an official guide that they typically use?
Here are two that I found. I bet there are more:
http://google-styleguide.g...
Hello all,
I want to implement something where I will get an URL which will be a link to JSON db, now I need to get the json from this URL and convert it to std:string in a c++ file. Is there any easy way to do this.
...
I can't figure out how to forward declare a windows struct. The definition is
typedef struct _CONTEXT
{
....
} CONTEXT, *PCONTEXT
I really don't want to pull into this header, as it gets included everywhere.
I've tried
struct CONTEXT
and
struct _CONTEXT
with no luck (redefinition of basic types with the actuall struct in winn...
Hi,
I am trying to send a proto over a socket, but i am getting segmentation error. Could someone please help and tell me what is wrong with this example?
file.proto
message data{
required string x1 = 1;
required uint32 x2 = 2;
required float x3 = 3;
}
xxx.cpp
...
data data_snd, data_rec;
//sending data ...
I want to specifically invoke the base class method; what's the most concise way to do this? For example:
class Base
{
public:
bool operator != (Base&);
};
class Child : public Base
{
public:
bool operator != (Child& child_)
{
if(Base::operator!=(child_)) // Is there a more concise syntax than this?
return true;
/...
Hi! I am newbie in English, sorry :)
How to create something like Expander control in WPF using only WinAPI (ATL/WTL)? Are some experince avaliable?
Thank for answers!
...
I'm going through exercises of a C++ book. For each exercise I want to minimize the boilerplate code I have to write. I've set up my project a certain way but it doesn't seem right, and requires too many changes.
Right now I have a single main.cpp file with the following:
#include "e0614.h"
int main()
{
E0614 ex;
ex.solve();
}
...
Question
I'm trying to create a basic wxWidgets program with a text entry box, in the constructor there is a variable wxTextCtrlNameStr - in researching I can't seem to find wxTextCtrlNameStr? any help?
Given Code documentation:
wxTextCtrl(wxWindow* parent, wxWindowID id, const wxString& value = "", const wxPoint& pos = wxDefaul...
During many, sometimes inundating, debugging sessions using DDD, I stumble upon loops. And I keep pressing next to get past it, and if there are many iterations, I just set a break point right after it, and press "continue." Is there any other way to go past loops?
...