Description:
Technical discussion of the C++ language. (Moderated)
|
|
|
Difference between if and ternary operator
|
| |
Hi!
The output of the example below is "CopyMove". Should not it be "MoveMove" ?
If not, why is it so ? I tried this with GCC 4.7, VS 10, and VS11 Beta. All the compilers return "CopyMove".
Thank you very much for the answer.
PK.
// ---
...using namespace std;
struct CBigData
{
CBigData() {}... more »
|
|
message processing using template
|
| |
Hi,
Suppose there are messages required to process. the code would look
like this.
void process (int type)
{
if (type == MSG_TYPE_A)
{
processMsgA();
}
else if (type == MSG_TYPE_B)
{
processMsgB();
}
...
I would like to know if it is possible to use template to achieve the... more »
|
|
Broken interaction between std::priority_queue and move-only types
|
| |
Let's say you've got a move-only type (such as std::unique_ptr< T >
or std::packaged_task) with an associated Compare functor that
defines some kind of ordering on objects of the move-only type:
struct Node;
std::priority_queue<
std::unique_ptr< Node >,
std::vector< std::unique_ptr< Node > >,... more »
|
|
postfix operator++
|
| |
{ Though this question may seem trivial, it may also be confusing and
tricky in light of the series of relevant changes in the standard,
so hopefully the follow-ups will clear up the issue. -mod }
hello guys,
I am kind of puzzled by one simple c++ constuct. What should be the
value of x after the statement:... more »
|
|
Help writing a functor binder
|
| |
Hi all, I am a bit stuck on how to achieve something I want to do and
was wondering if anyone can point me to somewhere where I can find a
pattern that may help me implement this.
I started implementing something and kept running into the problem of
needing to specialize for two things at once:... more »
|
|
taking abs() of min signed int value
|
| |
Hi,
I need to compute the absolute value of the minimum signed int value
for each signed integral type. This value isn't representable as a
signed int, but it is representable as an unsigned int.
This is easy when a larger signed type is available:
int32_t min_int32 = std::numeric_limits<int32_t>:: min();... more »
|
|
How to find an enum's underlying type?
|
| |
A web search comes up with a variety of syntax:
std::underlying_type<E>::type
std::EnumeratedType<T>::underl yingType
etc. etc. None seem to work with gcc4.6.3.
-- [ See [link] for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]... more »
|
|
Threads: incompatibilities between C and C++?
|
| |
Recently I watched a speech made by Hans Boehm on Channel #9 where he
mentioned an incompatibility between C11 and C++11. I think he was
talking about a difference between thread libraries. Does anyone know
what these differences consist of?
MJ
-- [ See [link] for info about ]... more »
|
|
|