Searching in the second value of a map i use somthing like the following:
typedef std::map<int, int> CMyList;
static CMyList myList;
template<class t> struct second_equal
{
typename typedef t::mapped_type mapped_type;
typename typedef t::value_type value_type;
second_equal(mapped_type f) : v(f) {};
bool operator()(co...
Well, I'm trying to solve the following problem, and almost done:
http://acm.pku.edu.cn/JudgeOnline/problem?id=1007
Here's my code:
#include "stdafx.h"
#include<iostream>
#include<string>
using namespace std;
/*
int compare(size_type pos1, size_type n1,
const charT* s, size_type n2 = npos) const;*/
int * sort(string *w, int n, int l, ...
Helo guys,
I am working wid CStringArray and i want to know how to find the number of datas added in a CStringArray . in the below i have a defined the size of the array as 10 but i have added only three 3 data,So i want to know the number of data's added to the array.(here its 3).Is there any way we can do it in CStringArray to...
I'm not sure if this is even possible, but given an executable file (foo.exe), with has many libraries which has been linked statically.
Is there any software that extract from this file the .lib ( or .a ) that lay inside the executable ?
Thanks.
...
I've this class
namespace baseUtils {
template<typename AT>
class growVector {
int size;
AT **arr;
AT* defaultVal;
public:
growVector(int size, AT* defaultVal ); //Expects number of elements (5) and default value (NULL)
AT*& operator[](unsigned pos);
int length();
void reset(int pos); //Reset...
I am doing some maintenance on a C++ windows dll library that is required to work with different VC++ compilers (as I don’t want to address different mangling schemes).
I have already eliminated any use of the STL in the interface.
I have insured that heap corruption will not occur from mixing different new/delete’s.
The final item i...
template<typename AT>
class growVector {
int size;
AT **arr;
AT* defaultVal;
public:
growVector(int size , AT* defaultVal); //Expects number of elements (5) and default value (NULL)
AT*& operator[](unsigned pos);
int length();
void reset(int pos); //Resets an element to default value
void ...
I have setup a small shooter game as a tutorial for myself in SDL. I have a struct of a projectile
struct projectile
{
SDL_Surface* surface;
int x;
int y;
};
And I put that into a vector.
vector<projectile> shot;
projectile one_shot;
And when I press space I create a new projectile and add it to the vector and then they...
Should there be a reason to preffer either getline or istream_iterator if you are doing line by line input from a file(reading the line into a string, for tokenization).
...
ATL END_COM_MAP macro is defined as follows:
#define END_COM_MAP() \
__if_exists(_GetAttrEntries) {{NULL, (DWORD_PTR)_GetAttrEntries, _ChainAttr }, }\
{NULL, 0, 0}}; return _entries;} \
virtual ULONG STDMETHODCALLTYPE AddRef( void) throw() = 0; \
virtual ULONG STDMETHODCALLTYPE Release( void) throw() = 0; \
STDMETHOD...
Can a windows message box be display using the cout syntax?
I also need the command prompt window to be suppressed / hidden.
There are ways to call the messagebox function and display text through its usage, but the main constraint here is that cout syntax must be used.
cout << "message";
I was thinking of invoking the VB msgbox co...
I creating a small desktop application using Qt and Poco on Mac OS X Snow Leopard.
Qt works fine, but once I started linking with Poco I get the following warning:
ld: warning: in /Developer/SDKs/MacOSX10.6.sdk/usr/local/lib/libPocoFoundation.8.dylib, file is not of required architecture
Also when I link against the 10.5 SDK:
ld: wa...
or a VB6 - compatible - collection object.
The title says it all, here's the background.
We provide hooks into our .net products through a set of API's.
We need to continue to support customers that call our API's from VB6, so we need to continue supporting VB6 collection objects (simple with VBA.Collection in .net).
The problem is s...
Hi,
I need to finish others developer work but problem is that he started in different way...
So now I found in situation to use existing code where he chooses to inherit a non-abstract class (very big class, without any virtual functions) that already implements bunch of interfaces or to dismiss that code (which shouldn't be to much wo...
I have a numerical library coded in C++.
I am going to make a UI for the library. I know some MFC. So one solution is to use MFC and make a native application.
The alternative is C#. I know nothing about C#. But I think it should be easy to learn.
Some tutorial for mixed programming of C++ and C# would be very helpful to me.
Thanks...
I'm the network programmer on a school game project. We want to have up to 16 players at once on a LAN. I am using the Server-Client model and am creating a new thread per client that joins. However, a lot of CPU time is wasted just checking on each thread if the non-blocking port has received anything from the client.
I've been read...
Hello everyone,
I'm currently developing a syntaxic analyser class that needs, at a point of the code, to sort structs holding info about operators. Each operator has a priority, which is user-defined through public member functions of my analyser class. Thus, when sorting, I need my sorting function to order elements based on the prior...
What is the difference between "header" and "convenience header" in boost?
...
How can I specify "pick any available port" for a TCP based server in Boost?
And how do I retrieve the port once a connection is accepted?
UPDATED: By "available port" I mean: the OS can pick any available port i.e. I do not want to specify a port.
...
Hi, I'm playing with dynamic memory allocation "by hand" and I wanted to see how placement new is implemented by guys from MS but when debugging I "stepped into" it moved me to code:
inline void *__CRTDECL operator new(size_t, void *_Where) _THROW0()
{ // construct array with placement at _Where
return (_Where);
}
Could anyone explain...