comp.lang.c++
  Home FAQ Contact Sign in
comp.lang.c++ only
 
Advanced search
December 2007
motuwethfrsasuw
     12 48
3456789 49
10111213141516 50
17181920212223 51
24252627282930 52
31       1
2007
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.c++ Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  references to functions         


Author: Rahul
Date: Dec 31, 2007 23:49

Hi Everyone,

I was wondering about references to functions, so i tried this,

int (& p[10]) (); // doesn't work as array of references is
illegal as memory is not allocated for references,

next, i tried a single reference to the function,

int ( & p ) ();

int incomplete_function(void)
{
// #error *** Nigel - Function incomplete. Fix before using ***
printf("testing testing testing done...\n");
return (0);
}

int sample(void)
{
printf("sample\n");
return(0);
}
Show full article (0.94Kb)
9 Comments
  A problem about explicit instantiation of class template         


Author: yuanhp_china
Date: Dec 31, 2007 22:35

I define a class in A.h:

template class A{

public:
void get_elem( const T&) ;
};

Then I give the implementation in A.cpp (and do an explicit
instantiation ):

template void A::get_elem( const T&)
{...}

template class A; //explicit instantiation

I have another two files: main.cpp and B.cpp. I would like to reuse
the explicit instantiation of A of A.cpp in the two files. Do I
need to declare class A in the two files? I am not sure how to do
it?

Any help are appreciated.

Hua
3 Comments
  jerseys nfl and nba mlb ,t-shirt ,hoodies,shoes         


Author: sellnfltrade
Date: Dec 31, 2007 17:53

www.nfl-trade.com wholesale soccer jerseys nfl reebok jerseys MLB NBA
jerseys
no comments
  What does this mean?         


Author: brettcclark
Date: Dec 31, 2007 13:18

This define is from the Vista SDK from propidl.h:

#ifdef __cplusplus
#define REFPROPVARIANT const PROPVARIANT &
#else
#define REFPROPVARIANT const PROPVARIANT * __MIDL_CONST
#endif

and again in propkeydef.h:

#ifdef __cplusplus
#define REFPROPERTYKEY const PROPERTYKEY &
#else // !__cplusplus
#define REFPROPERTYKEY const PROPERTYKEY * __MIDL_CONST
#endif // __cplusplus

OK, so I know what PROPVARIANT and PROPERTYKEY are, but I'm afraid
that I don't understand what REFPROPVARIANT and REFPROPERTYKEY refers
to.
What exactly is being defined? How does REFPROPVARIANT and
REFPROPERTYKEY relate to the original PROPVARIANT and PROPERTYKEY,
respectively. I've not seen this same syntax before.
Show full article (0.72Kb)
4 Comments
  Re: volatile keyword for C++ member functions         


Author: Tristan Wibberley
Date: Dec 31, 2007 11:05

On Mon, 2007-12-31 at 10:46 -0500, Pete Becker wrote:
> On 2007-12-31 05:10:56 -0500, Tristan Wibberley maihem.org> said:
>> Unfortunately, a programmer that actually gets paid makes assumptions
>> all the time. A competent programmer that actually gets paid makes
>> assumptions but hates it :)
>>
>> The reason is that most useful APIs are not documented well enough to
>> both use them and avoid making assumptions about them (such as "I assume
>> that this function always does what it did today").
>
> If you don't know what it does, don't use it. There's always another way.
>

"Another way" that makes the product cost five times more than the
market will pay for it. If the market wants slightly less confidence for
greatly reduced price a smart programmer, competent or not, gives it to
them. I offer stakeholders the choice, I'll take longer but be damned
sure it's right, or do it quickly with some uncertainty over what
happens in bizarre corner cases.
Show full article (1.37Kb)
2 Comments
  References and pointers         


Author: Simon Saize
Date: Dec 31, 2007 10:31

Hi -

What's the point of having references (&)? Why don't we just use
pointers (*)?

Thanks.
29 Comments
  Problem : cross reference between classes         


Author: xdli888
Date: Dec 31, 2007 09:03

I have two classes , say A and B. A contains methods named f1() ,
f2() and B contains methods named g1(), g2().
f1() will invoke g2() and g1() will invoke f2(). This situation is
kinda like two things interact with each other.
But the program couldn't pass the compliation. g++ says " invalid use
of undefined type of ......" .
As far as I know, forward declaration couldn't solve this problem, and
I have tried. Both of the definition of the two classes has to come
first which is not possible.
This can be solved by redesign A and B, but I wish I can find some
other solutions here, any advice will be welcome .
3 Comments
  Big annoyance in TR1         


Author: Mirco Wahab
Date: Dec 31, 2007 08:55

Best wishes for 2008!

After studying the fine print
for the "Next Big Thing (tm)"
I *still* found no word about
one big issue, the "raw string"
or "verbatim string" etc.

Whats so complicated with this
little detail? After working
a while with the Boost::Regex
(which goes into TR1), I have
to say - it's like to repaper a
room through the keyhole in it's
door - i end up writing and testing
the regular expression in Perl and
converting the result then by doubling
it's length by added backslashes - to
C++ strings.
Show full article (0.76Kb)
1 Comment
  Extremely large numbers in c++         


Author: Todd.Branchflower
Date: Dec 31, 2007 08:21

Hey everyone,

I am new to c++ and the group and would appreciate your help.

I was doing a problem on projecteuler.net in which you had to find the
largest factor of an extremely large number. Unfortunately, I didn't
know how to accommodate a number of this size in c++. After
developing my algorithm and writing it in c++, I wrote the program in
ruby (a bit easier for large numbers) and found the answer. Looking
in the forum at other people's code, I was able to change mine to
work:

#include
#include
using namespace std;

int main() {

long long N=317584931803LL;

for (long long int i=2; i<=sqrt(N); i++) if (!(N%%i)) N/=i;

cout << N;

string wait;

cin >> wait;
Show full article (1.17Kb)
4 Comments
  STL map or hash map using struct as data and find it         


Author: kl
Date: Dec 31, 2007 02:48

Hi,

I'm trying to learn some STL using map or hash_map would maybe even
better to use but I don't really know how to find a specific struct
depending on a DWORD value that is in range of two DWORD values (see
below for more).

So what I trying to achieve is creating a look up table of a IP adress
with a start adress (a DWORD value) and a end adress (a DWORD
value) which I would like to look up to the get the Country name
using a specific IP adress (also in DWORD) which is random access to
the table.

It is easy to use vector, linked list but I would like to try to use
map or hash map for more effecient way to look up or at least test it
out to compare some.

The code is basicly looks like this:
Show full article (1.97Kb)
7 Comments
 
1 2 3 4 5 6 7 8 9