suppose that MyClass has methods with the following prototypes:
void method1(MyClass & object1);
MyClass * method 7();
What will be this method destructor, constructor, copy constructor, overloaded= or default constructor?
This is one of question in my homework.
I think the first one is default constructor and second one is copy...
Hi , i have template class that I did , and i want to do pointer to function:
#ifndef __DATABASE_H_
#define __DATABASE_H_
#pragma once
#include "Heap.h"
#include <string>
#include <map>
#include <iostream>
using namespace std;
template<class S,class T> class Database {
public:
bool IsEmpty() const { return (m_map.size() == 0); }...
I'm trying to compare 2 strings by "==" operator.
when i print the string both are identical.
but length of one is bigger by one, i figured it is the null terminator.
any way to ignore this when comparing??
Thanks!!
City* Adjutancy::FromStringToCity(string cityName) const
{
for (list<City*>::const_iterator it=m_citiesList.begin();it...
Hi,
I am having trouble getting to grips with programming using templates in C++.
Consider the following files.
C.h
#ifndef _C_H
#define _C_H
template <class T>
class C {
public:
C();
virtual ~C();
}
#endif _C_H
C.cpp
#include "C.h"
template <class T>
C<T>::C() {
}
template <class T>
C<T>::~C() {
}
I try instantia...
Can I call select before recv_from on a socket that is blocking?
...
How i return iterator form function :
i worte this :
.
..
template<class S,class T> class Database {
public:
.
..
map<S,Node<T>*> m_map::iterator Find (S keyToFind);
.
..
....
private:
.
..
map<S,Node<T>*> m_map;
..
.
};
.
..
template<class S,class T>
map<S,Node<T>*> m_map::iterator Find (S keyToFind) {
map<S,Node<T>*>::iterator ...
I need to use (not implement) an array based version of Dijkstras algo .The task is that given a set of line segments(obstacles) and start/end points I have to find and draw the shortest path from start/end point.I have done the calculating part etc..but dont know how to use dijkstras with my code.My code is as follows
class Point
{
pub...
I was wondering whether the following setup would work for a small game:
Lets assume I have the following functions registered to Lua like so:
lua_register(L, "createTimer", createTimer);
lua_register(L, "getCondition", getCondition);
lua_register(L, "setAction", setAction);
Where: (leaving the type checking behind)
int createTimer(...
How can I cut off the leading digits of a number in order to only display the last two digits, without using the library. For example:
1923 to 23
2001 to 01
1234 to 34
123 to 23
with only
#include <iomanip>
#include <iostream>
Thanks!
...
I'm running a PHP front end to an application that does a lot of work with data and uses Cassandra as a data store.
However I know PHP will not give me the performance I need for some of the calculations (as well as the management for the sheer amount of data that needs to be in memory)
I'd like to write the backed stuff in C++ and ac...
Possible Duplicate:
C++ template gotchas
Hi,
I am just in to my second month on SO, and I have seen enough number of posts on SO related to several common issues with templates. Is it a good idea to make a small Wiki on this (sadly I don't know how to make one)?
The idea is to provide a reference as definitive as this (GMan'...
Hi guys,
I'm currently trying to figure out how to use the Generic Image Library included in Boost. Right now, I just want to use the library to store pixel data and use the Image IO to write PNGs. I'm having trouble understanding just how to set up the object however.
The hpp says
image(const point_t& dimensions,
std::size_t al...
I am a student and after taking some introductory programming courses in Java, C, and just finishing up a book on C++, I would like to start developing applications for Windows.
I have done my best to page through google and find the answers I need, but I seem to be at a loss.
When would I need the Windows SDK over just the regular API...
how do I cast void *something to an object in standard C++?
Specifically I want want to cast void *userdata
to std::map<String, void*>
Is this possible? I am trying:
//void *user_data is a parameter of this function (callback)
std::map <String, void*> user_data_n; //this line is ok
user_data_n = static_cast<std::map<String, void *>>(*u...
I am trying to include several third-party libraries in my source tree with minimal changes to their build system for ease of upgrading. They all use CMake, as do I, so in my own CMakeLists.txt I can use add_subdirectory(extern/foo) for libfoo.
But the foo CMakeLists.txt compiles a test harness, builds documentation, a shared library wh...
Hi
I'm trying to write a program to disable the Bluetooth service on computers (so, forbid users from connecting to Internet via Bluetooth)
I've tried following methods:
Disable the "bthserv" service (Bluetooth Support Service). It works on Windows Vista and 7, but there is no such service in Windows XP (I haven't tested, but I think ...
Hi,
maybe this is the continuation of this thread,
The program compiles without errors or warnings but when I run it, and the handler function is called, I get EXEC_BAD_ADDRESS
void MainController::show_color_trackbars(int *h, int *s, int *v){
String winName = "HSV Trackbars";
namedWindow(winName, CV_WINDOW_AUTOSIZE);
std:...
hi ,
I am using SSDP to send discover request using M-SEARCH to get list of services present.
My requirement is like i want to get list of share folders also which are present in that server.
Currently , i am sending this request in this format :
"M-SEARCH * HTTP/1.1\r\n"
"Host: 239.255.255.250:1900\r\n"
"Man: \"ssdp:discover...
I just ran into this line of code;
if( lineDirection.length2() ){...}
where length2 returns a double. It kind of puzzles me that 0.0 in this case is equivalent to 0\NULL.
Is this part of the C++ standard or is it undefined behaviour?
...
I spend most of my time in Eclipse these days, so I thought I would check out what Eclipse's C++ support was like (I usually use Xcode on Mac and Visual Studio for Windows).
I found the CDT package for Eclipse 3.5, so I installed it.
Everything installed properly and the default C++ "Hello World" project compiled nicely, however for th...