|
|
Up |
|
|
  |
Author: Saeed AmrollahiSaeed Amrollahi
Date: Apr 13, 2008 22:34
Dear All
Hi
I usually use the following function for built-in types to std::string
conversion:
// convert a type (typically built-in type) to std::string
template
inline std::string ToStdStr(const T& t)
{
std::istringstream s;
s << t;
return s.str();
}
|
| Show full article (0.70Kb) |
|
| |
2 Comments |
|
  |
Author: RobRob
Date: Apr 13, 2008 20:04
This actually compiles and works but it doesn't seem like the best
code, so I was wondering is there another way to do this?
[CODE]
template vector* addDepth(T)
{
return new vector;
}
...a templated meth...
{
//Create multi-depth vector based on length
void* vec;
int length = getLength( obj );
for ( int i = 0; i < length; i++ )
{
vec = addDepth( someValue );
}
vector* b = ( vector* ) vec;
}
[/CODE]
|
| |
|
| |
7 Comments |
|
  |
Author: myshoesbiz95myshoesbiz95
Date: Apr 13, 2008 18:24
china Wholesale New Air Jordan 12 X Air Force 1s Fusion shoes.
discount New Air Jordan 12 Fusion
cheap Air Jordan 5 x Air Force one Fusion
discount Air Jordan 5 and Air Force one Fusion,
Air Jordan 12 x Air Force One Fusion china online store
buy wholesale price Air Jordan 5 x Air Force ones Fusion
cheap Air Jordan 12 x Air Force 1s Fusion china distributor
discount Air Jordan x Air Force 1 Fusion china wholesale
customized Air Jordan 4 5 12 23 x Air Force 1 Fusion china
distributors outlets
all star air jordan 23 x nike air force ones Fusion china wholesale
for cheap
China wholesaler www.thenikeshoes.net of cheap air jordan
shoes,wholesale
jordans,wholesale jordans from china,wholesale nike jordans
www.thenikeshoes.net Buy new jordan 23 shoes, air jordan 23
shoes,jordan xx3,nike jordan
xxiii,new air jordan 23 shoes,AJ23,jordan 23
|
| Show full article (1.26Kb) |
|
no comments
|
|
  |
Author: cheapbootcheapboot
Date: Apr 13, 2008 18:16
discount, AFTFUL DODGER ,jeans ( paypal accept )
( www.sneaker-fan.com )
discount, AKA STASH HOUSE ,jeans ( paypal accept )
( www.sneaker-fan.com )
discount, APE ,jeans ( paypal accept ) ( www.sneaker-fan.com
)
discount, BBC ,jeans ( paypal accept ) ( www.sneaker-fan.com
)
discount, COOGI ,jeans ( paypal accept )
( www.sneaker-fan.com )
discount, D&G ,jeans ( paypal accept ) ( www.sneaker-fan.com
)
discount, DIESEL ,jeans ( paypal accept )
( www.sneaker-fan.com )
discount, ED ,jeans ( paypal accept ) ( www.sneaker-fan.com
)
discount, EVISU ,jeans ( paypal accept )
( www.sneaker-fan.com )
discount, Gino ,jeans ( paypal accept )
( www.sneaker-fan.com ) ...
|
| Show full article (8.70Kb) |
|
no comments
|
|
  |
Author: alexlalexl
Date: Apr 13, 2008 17:09
I have 2 classes,
class base {
public:
some virtual functions
}
class derived : public base {
public:
derived(base* b);
}
is there a simpler way to turn a base object into derived than the
following
base* b = new base();
b->do some stuff
now he becomes derived
base* d = new derived(b);
thx
|
| |
|
5 Comments |
|
  |
Author: nandor.siebennandor.sieben
Date: Apr 13, 2008 16:47
I am using a small set of functions that implements an n-ary tree. The
library is disscusses here:
http://groups.google.com/group/comp.lang.c++/browse_thread/thread/35450795fb41b047/8d274ef3f22fdb90...#8d274ef3f22fdb90
The nodes of the tree are cretaed and erased by new and delete. I just
read in Modern C++ Design that new/delete can be very inefficient. I
am using this library to search in game trees so I do create and erase
a lot of nodes. Would I be better of by creating a large vector
containing nodes and use this vector to store my tree nodes. Instead
of pointers I could use indices. The unused nodes would be linked
together for easy access and used only when a new node is needed. This
would avoid the use of new/delete. The only drawback is that the
memory is allocated even when it's not used, but this is not really an
issue for my application.
Should I expect a significant gain in performance from this?
|
| |
|
5 Comments |
|
  |
Author: danep2danep2
Date: Apr 13, 2008 13:56
Let me start by saying that this is more a question about principle
than practice - with the speed of today's computers it's probably
rarely an actual issue. Still I'd like to know...
If I have a function that is called thousands of times per second, it
seems to me that, performance-wise, it would be best to make all
variables used in it global, so that memory for them doesn't have to
be allocated and released with each call. However, I know this
clutters up the name space and can make the code more bug-prone.
Would it ever make sense to use global variables over local ones in
this situation? Would the same answer apply to threads instead of
functions? Thanks for satisfying my curiosity!
|
| |
|
1 Comment |
|
  |
Author: RobRob
Date: Apr 13, 2008 11:16
[CODE]
(I am not the one who defined these classes)
class _jobject {};
class _jarray : public _jobject {};
typedef _jobject* jobject;
typedef _jarray jarray;
int main()
{
jobject * a;
jarray b;
a = dynamic_cast (&b);
....
}
[/CODE]
This doesn't work and the problem is the only type names I'm
guaranteed to have are jobject and jarray. The original _jobject is
how it's defined here but I'm not guaranteed it''ll always be that way
so I have to work with jobject/jarray.
How would I cast between jobject and jarray?
|
| |
|
9 Comments |
|
  |
Author: morganjones_1977morganjones_1977
Date: Apr 13, 2008 10:33
We are legitimate and reputable company from Uk,London we have all
brands of Mobile Phones,Ipods,xbox 360, Sidekicks,Nextels
phone,Laptops for sell at cheap and affordable prices.
ORDER INFORMATION :
Minimum Order : 1-5 units
Payment Method : Western Union and Money Gram
Shipping Method : FedEx and UPS.
Delivery Time : 48 Hours Delivery To Your Door Step.
Special offer 3 unit{From Any Brand Model}Selling Price Will Be $400
Dollars,With All Fees For Delivey Included.
EMAIL:
morgantradinglimited@ hotmail.com
morganplaza_1@mail.md
morganjones19_77@ yahoo.com
PHONE NUMBER:
+447031945280
+447045735570
|
| Show full article (8.67Kb) |
|
no comments
|
|
  |
|
|
  |
|
|
|
|
|
|
|