Up |
|
|
  |
Author: Ioannis VranosIoannis Vranos
Date: Feb 4, 2008 15:41
Does C++03 include the C programming language ISO/IEC 9899/AMD1:1995
amendment?
|
| |
|
| |
3 Comments |
|
  |
Author: nwnw
Date: Feb 4, 2008 15:19
Hi all,
I'm constantly confronted with the following two techniques, which I
believe often produce less readable code, but I am told are faster
therefore better. Can anyone help me out with counter examples and
arguments?
1. The STL is slow.
More specifically vector. The argument goes like this:
"Multidimensional arrays should be allocated as large contiguous
blocks. This is so that when you are accessing the array and reach the
end of a row, the next row will already be in the cache. You also
don't need to spend time navigating pointers when accessing the array.
So a 2 dimensional array of size 100x100 should be created like this:
const int xdim=100;
const int ydim=100;
int *myarray = malloc(xdim*ydim*sizeof(int));
and accessed like this:
myarray[xdim*ypos+xpos] = avalue;
|
| Show full article (2.11Kb) |
|
| |
46 Comments |
|
  |
Author: wong_powahwong_powah
Date: Feb 4, 2008 15:08
How to fix this compile error?
# make -f Util/UtilBlock.dep
g++ /opt/aCC/include_std/rw/codecvt.cc -o /opt/aCC/include_std/
rw/codecvt
/opt/aCC/include_std/rw/codecvt.cc:32: error: use of namespace `std'
as
expression
/opt/aCC/include_std/rw/codecvt.cc:39: error: ISO C++ forbids
declaration of `
_RWSTD_NAMESPACE_BEGIN' with no type
/opt/aCC/include_std/rw/codecvt.cc:39: error: syntax error before
`template'
/opt/aCC/include_std/rw/codecvt.cc:43: error: syntax error at end of
input
make: *** [/opt/aCC/include_std/rw/codecvt] Error 1
|
| Show full article (5.97Kb) |
|
2 Comments |
|
  |
Author: RickRick
Date: Feb 4, 2008 14:58
Is the following appropriate behavior? It certainly isn't what I
expected.
#include
using namespace std;
template bool fun(const T& value) {
cout << "In fun(const T&);" << endl;
}
template bool fun(T value) {
cout << "In fun(T);" << endl;
}
int main(int argc, char** argv) {
fun(static_cast(10) );
}
|
| Show full article (1.05Kb) |
|
5 Comments |
|
  |
|
|
  |
Author: Dario SaccavinoDario Saccavino
Date: Feb 4, 2008 08:12
It seems to me that operator->* is overloadable in C++ (just like
operator->), and it should be useful to implement in smart pointer
classes.
However, I haven't found its implementation either in the standard
weak_ptr class, or in any boost smart pointer. Was it intentionally
left out of those headers?
Actually there's a workaround: just write
(ptr.operator->())->*memptr
instead of
ptr->*memptr
But it looks very ugly. How am I supposed to use member pointers with
smart pointers?
Thank you for your attention
Dario
|
| |
|
2 Comments |
|
  |
Author: michael.goossensmichael.goossens
Date: Feb 4, 2008 08:06
Alright I am implementing a static member function for the first time
and it is not working :(. Are static member functions implemented in
the header?
header:
static float[4][8] GetPivot(float matrix[4][8], int n);
cpp:
static float[4][8] Matrix4x4::GetPivot(float matrix[4][8], int n) {
...
}
and the errors:
1>c:\users\michaël\documents\visual studio 2005\projects\renderwoman
\renderwoman\matrix4x4.h(12) : error C3409: empty attribute block is
not allowed
1>c:\users\michaël\documents\visual studio 2005\projects\renderwoman...
|
| Show full article (2.94Kb) |
|
4 Comments |
|
  |
Author: Hicham MoulineHicham Mouline
Date: Feb 4, 2008 06:36
hi,
I have a map of data points (xi,yi), modelling a function to
interpolate.
Assuming the points are monotone increasing, such that, i>j, yi> yj if xi>xj
How do i get the inverse of a point y inside the range of yi?
typedef std::map::const_iterator CCI;
CCI endi = f.end();
for (CCI iter=f.begin(); iter!=endi; ++iter)
if (iter->second > x)
break;
if (iter==endi)
return NaN;
CCI prev = iter;
--prev;
if (iter->second = prev->second) // shouldn't happen
return prev->first;
return prev->first + (x - prev->second)*(iter->first -
prev->first)/(iter->second - prev->second);
|
| Show full article (0.75Kb) |
|
2 Comments |
|
  |
Author: kasthurirangan.balajikasthurirangan.balaji
Date: Feb 4, 2008 05:26
Hi,
I am looking for advice on i18n/l10n using c++. I understand about
wchar & wstreams. I have gone thru the net for some knowledge. All
speak of encodings like utf8/utf16/iso8859 and so. I also see that by
using utf8, we can achieve i18n and l10n using char itself. It would
be great if someone can provide or point out resources in c++ with
lots of example programs. Books are also welcome. References should
speak of persistence, network communications.
Thanks,
Balaji.
|
| |
|
2 Comments |
|
  |
|
|
  |
Author: jacob naviajacob navia
Date: Feb 4, 2008 02:34
Hi
Has C++ defined the function
isnan() for complex numbers?
What is the definition?
Thanks in advance
|
| |
|
3 Comments |
|
|
|
|
|