http://groups.google.com/group/comp.lang.c++?hl=en
comp.lang.c++@googlegroups.com
Today's topics:
* multiset unique values count - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/b66513ea50fac61b?hl=en
* ♬☎♬))) free shipping wholesale cheap fashionable brands T-shirts in www.
ecyaya.com - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/cc8d5dfe1b27b7a4?hl=en
* ◆●◆●◆ Cheap price Wholesale Air Force One Shoes at www.rijing-trade.com <
paypal payment> - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/a69751db0617cda7?hl=en
* ordered unordered_map - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/3743266d80703cfb?hl=en
* Odd Exception Behavior - 4 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/ce3a580936f3cddd?hl=en
* Constructor call in array definition - 5 messages, 3 authors
http://groups.google.com/group/comp.lang.c++/t/43870fbc3354536d?hl=en
* C++0x regex supported by gcc? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/a5e3fb25be9236a9?hl=en
* Draft paper submission deadline is extended: SETP-10 - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/8666a4fc6e937d23?hl=en
* how would one define/use polymorphic implementations of STL types ?? - 3
messages, 3 authors
http://groups.google.com/group/comp.lang.c++/t/f804e45d4caee766?hl=en
* C++ to C# conversion - 5 messages, 3 authors
http://groups.google.com/group/comp.lang.c++/t/dd58a0348cd2906e?hl=en
* ★~★~★ 2010 HOT Sale AAA True Leather brand handbags (Chanel handbag, Gucci
handbag, LV handbag......) at www.rijing-trade.com <paypal payment> - 1
messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/41e43f78aaea390e?hl=en
* ☎ ☞wholesale cheap ❉Watch❉belt❉cap❉ free shipping cost at www.ecyaya.com - 1
messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/31830af1e605486d?hl=en
==============================================================================
TOPIC: multiset unique values count
http://groups.google.com/group/comp.lang.c++/t/b66513ea50fac61b?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Feb 4 2010 12:09 am
From: dushkin
Hi
I wish someone can give a tip on this one..
http://groups.google.co.il/group/comp.lang.c++/browse_thread/thread/1da69b779019d7c4/d060bace91a1830?hl=iw&ie=UTF-8&oe=utf-8&q=multiset+unique+elements+counting#0d060bace91a1830
Thanks!
==============================================================================
TOPIC: ♬☎♬))) free shipping wholesale cheap fashionable brands T-shirts in
www.ecyaya.com
http://groups.google.com/group/comp.lang.c++/t/cc8d5dfe1b27b7a4?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Feb 4 2010 12:37 am
From: hero
♬☎♬))) free shipping wholesale cheap fashionable brands T-shirts in
www.ecyaya.com
Wholesale Lacoste polo t shirt ( www.ecyaya.com )
Wholesale Lacoste t shirt solid color ( www.ecyaya.com )
Wholesale Lacoste sweater ( www.ecyaya.com )
Wholesale Lacoste shirt ( www.ecyaya.com )
Wholesale Lacoste ( www.ecyaya.com )
Wholesale Ralph lauren ( www.ecyaya.com )
Wholesale Ralph Lauren polo ( www.ecyaya.com )
Wholesale Polo ( www.ecyaya.com )
Wholesale Ralph lauren polo t shirt( www.ecyaya.com )
Wholesale Ralph lauren t shirt ( www.ecyaya.com )
Wholesale Abercrombie & fitch shirt ( www.ecyaya.com )
Wholesale Burberry shirt ( www.ecyaya.com )
wholesale Burberry t shirt ( www.ecyaya.com )
wholesale NBA sports jersey ( www.ecyaya.com )
T-Shirts
wholesale AFF T-shirt ( www.ecyaya.com )
wholesale ARMANI T-shirt www.ecyaya.com
wholesale BAPE T-shirt ( www.ecyaya.com )
wholesale BBC T-shirt www.ecyaya.com
wholesale BOSS T-shirt www.ecyaya.com
wholesale Burberry T-shirt ( www.ecyaya.com )
wholesale CA T-shirt men's www.ecyaya.com
wholesale CA T-shirt women's ( www.ecyaya.com )
wholesale COOGI T-shirt ( www.ecyaya.com )
wholesale CRYSTAL ROCK women's ( www.ecyaya.com )
wholesale D&G T-shirt www.ecyaya.com
wholesale DIESEL T-shirt ( www.ecyaya.com )
wholesale DSQUARED T-shirt men's ( www.ecyaya.com )
wholesale DSQUARED T-shirt women's ( www.ecyaya.com )
wholesale Eck? Unltd T-shirt ( www.ecyaya.com )
wholesale ED T-shirt men's
wholesale ED T-shirt women's www.ecyaya.com
wholesale EVISU T-shirt ( www.ecyaya.com )
wholesale GGG T-shirt ( www.ecyaya.com )
wholesale G-STAR T-shirt ( www.ecyaya.com )
wholesale HLST T-Shirt www.ecyaya.com
wholesale Lacoste T-shirt ( www.ecyaya.com )
wholesale Lacoste T-shirt women's ( www.ecyaya.com )
wholesale LRG T-shirt ( www.ecyaya.com )
wholesale O&L T-shirt www.ecyaya.com
wholesale POLO 3 T-shirt ( www.ecyaya.com )
wholesale 4 T-shirt ( www.ecyaya.com )
wholesale POLO 5 T-shirt www.ecyaya.com
wholesale POLO T-shirt men's ( www.ecyaya.com )
POLO T-shirt women's ( www.ecyaya.com )
Prada T-shirt ( www.ecyaya.com )
RUEHL T-Shirt www.ecyaya.com
SMET T-Shirt men's ( www.ecyaya.com )
SMET T-Shirt women's www.ecyaya.com
VERSACE T-shirt ( www.ecyaya.com )
A&F Abercrombie & Fitch T-shirt men's ( www.ecyaya.com )
A&F Abercrombie & Fitch T-shirt women's ( www.ecyaya.com )
Our advantages:
1) A rate quality wholesale price.
2) rapid and safe delivery time: 4-6days
3) no minute order requirement.
4) different styles, colors and sizes in stock for your reference
Whatever you need, you are free to contact me.
Website:www.ecyaya.com
MSN:ecyaya@hotmail.com
Have a good day!
==============================================================================
TOPIC: ◆●◆●◆ Cheap price Wholesale Air Force One Shoes at www.rijing-trade.com
<paypal payment>
http://groups.google.com/group/comp.lang.c++/t/a69751db0617cda7?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Feb 4 2010 12:41 am
From: "www.fjrjtrade.com"
◆●◆●◆ Cheap price Wholesale Air Force One Shoes at www.rijing-trade.com
<paypal payment>
Welcome to visit www.fjrjtrade.com
Cheap Wholesale Air Force One Shoes
Wholesale Air Force One Shoes (paypal payment)
Wholesale Air Force One 25 Men (paypal payment)
Wholesale Air Force One Children (paypal payment)
Wholesale Air Force One low (paypal payment)
Wholesale Air Force One M&W (paypal payment)
Wholesale Air Force One Mid (paypal payment)
Wholesale Air Force One Mid Men (paypal payment)
Wholesale Air Force One Mid Women (paypal payment)
Wholesale Air Force One Women (paypal payment)
Website:
www.rijing-trade.com
==============================================================================
TOPIC: ordered unordered_map
http://groups.google.com/group/comp.lang.c++/t/3743266d80703cfb?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Feb 4 2010 12:54 am
From: Ralf Goertz
tonydee wrote:
> I'm not sure how often you need to "clean up" these duplicates, but if
> Foo has (or can easily be given) a operator<, you may find it better
> to have an (ordered) map (something like "std::map<Foo*, unsigned,
> Compare_Via_Ptr<Foo*> >" with template <typename T> struct
> Compare_Via_Ptr { bool operator()(const Foo* lhs, const Foo* rhs)
> const { return *lhs < *rhs; } }; )...
>
> That way you can do a quick lookup to see if an "incoming" Foo is
> already stored, preventing the storage of duplicates.
That is impossible. Only after thorough investigation of the whole set I
know that two given objects of type Foo are the same. And I not only
erase the duplicates but I also transfer information that is stored in
the one to be erased.
I have a solution for the problem (breaking the inner loop) but I
consider it being error prone and inelegant. That's why I hoped to find
a smarter one. Using one more level of indirection as you suggested
might be the way to go. Thanks for your input.
==============================================================================
TOPIC: Odd Exception Behavior
http://groups.google.com/group/comp.lang.c++/t/ce3a580936f3cddd?hl=en
==============================================================================
== 1 of 4 ==
Date: Thurs, Feb 4 2010 12:56 am
From: none
Hi,
I have an exception class like so:
class CMyException
{
public:
// Streams for creating the message
std::ostringstream msg;
std::ostringstream short_msg;
CMyException() {}
CMyException(const CMyException &rhs) { copy(rhs); }
CMyException(const std::string simple_msg)
{ msg << simple_msg; short_msg << simple_msg; }
~CMyException() {}
CMyException &operator=(const CMyException &rhs) { copy(rhs); }
operator const char *() { return msg.str().c_str(); }
protected:
// std::ostringstream cannot be copied, so copy() must
// only copy the internal strings
void copy(const CMyException &rhs)
{
msg << (rhs.msg.str().empty() ?
rhs.short_msg.str() : rhs.msg.str());
short_msg << (rhs.short_msg.str().empty() ?
rhs.msg.str() : rhs.short_msg.str());
}
};
It's kind of a work in progress. The idea is that you can set either the
"msg" or the "short_msg" or both. You could use it like so:
if (parse_failed)
{
CMyException e;
// Write long message
e.msg << "Something bad happened on line " << line;
e.msg << " in file " << filename << ".";
// Write short message
e.short_msg << "Something bad happened.";
throw e;
}
Then, the "catcher" can decide which message to display:
try
{
parse(something);
}
catch (CMyException e)
{
// Display the long error message
ErrorMessage(e.msg.str().c_str());
}
For convenience, I added the (const char *) type-cast operator so that you
could also do this, assuming you want the longer message:
catch (CMyException e)
{
// Display the long error message
ErrorMessage(e);
}
But something very strange happens. My ErrorMessage() function displays
garbage when I use the type-cast operator. It works fine if I write
"ErrorMessage(e.msg.str().c_str())" but not if I write
"ErrorMessage(e)". I traced into the ErrorMessage() function in both
cases, and what I see is that the actual const char * pointer is off by
exactly 256 bytes in the latter case. I just don't see the difference
between the two!
I am using Visual Studio 2005, if that makes a difference.
== 2 of 4 ==
Date: Thurs, Feb 4 2010 1:39 am
From: none
none wrote:
> But something very strange happens. My ErrorMessage() function
> displays garbage when I use the type-cast operator. It works fine if
> I write "ErrorMessage(e.msg.str().c_str())" but not if I write
> "ErrorMessage(e)". I traced into the ErrorMessage() function in both
> cases, and what I see is that the actual const char * pointer is off
> by exactly 256 bytes in the latter case. I just don't see the
> difference between the two!
AAAAAARRRRRGH
The str() function returns by *value*. So the type-cast function, as I
have it written, calls c_str() on a temporary that ceases to exist as soon
as the function returns.
== 3 of 4 ==
Date: Thurs, Feb 4 2010 1:48 am
From: "Alf P. Steinbach"
* none:
> none wrote:
>
>> But something very strange happens. My ErrorMessage() function
>> displays garbage when I use the type-cast operator. It works fine if
>> I write "ErrorMessage(e.msg.str().c_str())" but not if I write
>> "ErrorMessage(e)". I traced into the ErrorMessage() function in both
>> cases, and what I see is that the actual const char * pointer is off
>> by exactly 256 bytes in the latter case. I just don't see the
>> difference between the two!
>
>
> AAAAAARRRRRGH
>
> The str() function returns by *value*. So the type-cast function, as I
> have it written, calls c_str() on a temporary that ceases to exist as soon
> as the function returns.
Yes. :-)
You're absolutely not the first to walk into that, but perhaps one of the first
here to recognize it yourself -- at least, I can't remember it happen b4.
Some other tips for the code:
* "C"-prefix for a class is a Microsoft-ism, therefore (almost automatically)
ungood.
* The assignment operator implementaiton is a bit dangerous, think about
assigning twice to same exception object.
* The copy function seems to jumble up the short and long messages, anyway,
copy will not be perfect copy with the code as-is.
* The 'cast' operator should perhaps best be 'const'.
* Most importantly, the whole "stream whatever into a string" can be
/separated/ as a very very simple class. Then it can be used for whatever.
:-)
Cheers & hth.,
- Alf
== 4 of 4 ==
Date: Thurs, Feb 4 2010 12:33 pm
From: none
Alf P. Steinbach wrote:
> You're absolutely not the first to walk into that, but perhaps one of
> the first here to recognize it yourself -- at least, I can't
> remember it happen b4.
I get lucky, on occaision. :) Is there any particular reason why str()
doesn't return by reference? Or, at least, why there isn't an
alternative method available to do so?
> Some other tips for the code:
>
> * "C"-prefix for a class is a Microsoft-ism, therefore (almost
> automatically)
> ungood.
Guilty as charged. I've been using the "C" prefix since the early days
of Visual Studio.
> * The assignment operator implementaiton is a bit dangerous, think
> about
> assigning twice to same exception object.
I should be checking for "&rhs == this"?
> * The copy function seems to jumble up the short and long messages,
> anyway,
> copy will not be perfect copy with the code as-is.
Yes, the idea was that the "thrower" would not need to set both the
short and long messages. If only one is set, the other will just be a
duplicate.
> * The 'cast' operator should perhaps best be 'const'.
Ah, good point.
> * Most importantly, the whole "stream whatever into a string" can
> be
> /separated/ as a very very simple class. Then it can be used for
> whatever.
> :-)
That's interesting. So I would basically be creating a "copyable
ostringstream."
Thanks a lot for the feedback.
==============================================================================
TOPIC: Constructor call in array definition
http://groups.google.com/group/comp.lang.c++/t/43870fbc3354536d?hl=en
==============================================================================
== 1 of 5 ==
Date: Thurs, Feb 4 2010 4:38 am
From: "Christian Meier"
Hello NG
Is it the standard behaviour that the copy constructor is called when I
initialize an array of a class type?
And if so, is it possible to initialize an array of objects without invoking
the copy constructor?
My problem is that my class has a private copy constructor (and an explicit
constructor - but I do not know whether this is relevant).
Below is my sample code (which does not compile). How do I have to write the
definition of "D::c" so that it compiles without changing class C?
Thanks in advance!
Greets Chris
-----------------
class C
{
public:
explicit C(int i) : i_(i) {}
private:
C(const C&);
int i_;
};
class D
{
static C c[2];
};
C D::c[2] = { C(0), C(1) };
int main()
{
}
== 2 of 5 ==
Date: Thurs, Feb 4 2010 5:23 am
From: Victor Bazarov
Christian Meier wrote:
> Is it the standard behaviour that the copy constructor is called when I
> initialize an array of a class type?
Yes, you're initializing your objects from temporaries. That requires a
callable copy c-tor.
> And if so, is it possible to initialize an array of objects without invoking
> the copy constructor?
Don't create temporaries. You could initialise those elements directly,
but not with an explicit c-tor.
> My problem is that my class has a private copy constructor (and an explicit
> constructor - but I do not know whether this is relevant).
> Below is my sample code (which does not compile). How do I have to write the
> definition of "D::c" so that it compiles without changing class C?
There is no way.
At first I was thinking you could leave it uninitialised, but that would
require a default c-tor, which you don't have. Adding it would mean
changing class C.
So, something's gotta give.
>
> Thanks in advance!
>
> Greets Chris
>
> -----------------
>
> class C
> {
> public:
> explicit C(int i) : i_(i) {}
> private:
> C(const C&);
> int i_;
> };
>
> class D
> {
> static C c[2];
> };
>
>
> C D::c[2] = { C(0), C(1) };
>
>
> int main()
> {
> }
>
>
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
== 3 of 5 ==
Date: Thurs, Feb 4 2010 5:53 am
From: "Christian Meier"
Thanks for your answer.
Victor Bazarov wrote:
> Christian Meier wrote:
>> Is it the standard behaviour that the copy constructor is called when I
>> initialize an array of a class type?
>
> Yes, you're initializing your objects from temporaries. That requires a
> callable copy c-tor.
>
>> And if so, is it possible to initialize an array of objects without
>> invoking the copy constructor?
>
> Don't create temporaries. You could initialise those elements directly,
> but not with an explicit c-tor.
>
How do I do that? If I remove the "exclicit" keyword in my sample code and
change the initializer-statement to "C D::c[2] = { 0, 1 };" then my compiler
still tries to call the copy constructor:
main.cpp:6: error: 'C::C(const C&)' is private
>> My problem is that my class has a private copy constructor (and an
>> explicit constructor - but I do not know whether this is relevant).
>> Below is my sample code (which does not compile). How do I have to write
>> the definition of "D::c" so that it compiles without changing class C?
>
> There is no way.
>
> At first I was thinking you could leave it uninitialised, but that would
> require a default c-tor, which you don't have. Adding it would mean
> changing class C.
>
> So, something's gotta give.
>
If I left it uninitialized then they would have the same value.
== 4 of 5 ==
Date: Thurs, Feb 4 2010 8:18 am
From: Victor Bazarov
Christian Meier wrote:
> Thanks for your answer.
>
> Victor Bazarov wrote:
>> Christian Meier wrote:
>>> Is it the standard behaviour that the copy constructor is called when I
>>> initialize an array of a class type?
>> Yes, you're initializing your objects from temporaries. That requires a
>> callable copy c-tor.
>>
>>> And if so, is it possible to initialize an array of objects without
>>> invoking the copy constructor?
>> Don't create temporaries. You could initialise those elements directly,
>> but not with an explicit c-tor.
>>
>
> How do I do that? If I remove the "exclicit" keyword in my sample code and
> change the initializer-statement to "C D::c[2] = { 0, 1 };" then my compiler
> still tries to call the copy constructor:
> main.cpp:6: error: 'C::C(const C&)' is private
Hm... Maybe I'm wrong. I thought it would do direct initialization.
Lemme look it up... <opens the Standard>
8.5/12 says <<The initialization that occurs in argument passing,
function return, throwing an exception (15.1), handling
an exception (15.3), and brace-enclosed initializer lists (8.5.1) is
called copy-initialization ...>>
That's too bad (for your situation, I mean). I was wrong - the copy
c-tor still needs to be accessible even if the compiler doesn't need it.
It's the "as-if" rule.
>>> My problem is that my class has a private copy constructor (and an
>>> explicit constructor - but I do not know whether this is relevant).
>>> Below is my sample code (which does not compile). How do I have to write
>>> the definition of "D::c" so that it compiles without changing class C?
>> There is no way.
>>
>> At first I was thinking you could leave it uninitialised, but that would
>> require a default c-tor, which you don't have. Adding it would mean
>> changing class C.
>>
>> So, something's gotta give.
>>
>
> If I left it uninitialized then they would have the same value.
They can't be left uninitialised, your class has no default c-tor.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
== 5 of 5 ==
Date: Thurs, Feb 4 2010 10:56 am
From: Robert Fendt
And thus spake Victor Bazarov <v.Abazarov@comAcast.net>
Thu, 04 Feb 2010 11:18:19 -0500:
> >> So, something's gotta give.
> >>
> >
> > If I left it uninitialized then they would have the same value.
>
> They can't be left uninitialised, your class has no default c-tor.
If you do not want to lose the access level protection, you can only use a factory function: either a friend or a class member has to create the array and return a pointer to it. There is no other way (at least to my knowledge), due to the array initialisation limitations in C++.
Regards,
Robert
==============================================================================
TOPIC: C++0x regex supported by gcc?
http://groups.google.com/group/comp.lang.c++/t/a5e3fb25be9236a9?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Feb 4 2010 4:49 am
From: Devil Wang
you should link the BOOST library while compiling .
On Feb 1, 1:43 am, Robert Fendt <rob...@fendt.net> wrote:
> > Hi all, do you know if gcc supports the regex library defined in the C+
> > +0x draft? If so, which version? Can you provide a simple snippet?
>
> As far as I know, GCC does not support regular expressions as defined in TR1 as part of its standard library (yet). However, to use 0x features already before standardisation would be a portability nightmare (not to speak of stability issues to be expected in the early implementations).
>
> If you want to stay at least semi-portable and need a solid regex library for C++, just use boost::regex for now. The TR1 specification is based upon it anyway. Or, if you are concerned about code changes after the compilers have caught up with the standard, you can use boost::tr1.
>
> http://www.boost.org/doc/libs/1_41_0/libs/regex/doc/html/index.htmlhttp://www.boost.org/doc/libs/1_41_0/doc/html/boost_tr1.html
>
> Regards,
> Robert
==============================================================================
TOPIC: Draft paper submission deadline is extended: SETP-10
http://groups.google.com/group/comp.lang.c++/t/8666a4fc6e937d23?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Feb 4 2010 5:29 am
From: James Heralds
Draft paper submission deadline is extended: SETP-10
The 2010 International Conference on Software Engineering Theory and
Practice (SETP-10) (website: http://www.PromoteResearch.org) will be
held during 12-14 of July 2010 in Orlando, FL, USA. SETP is an
important event in the areas of Software development, maintenance, and
other areas of software engineering and related topics.
The conference will be held at the same time and location where
several other major international conferences will be taking place.
The conference will be held as part of 2010 multi-conference
(MULTICONF-10). MULTICONF-10 will be held during July 12-14, 2010 in
Orlando, Florida, USA. The primary goal of MULTICONF is to promote
research and developmental activities in computer science, information
technology, control engineering, and related fields. Another goal is
to promote the dissemination of research to a multidisciplinary
audience and to facilitate communication among researchers,
developers, practitioners in different fields. The following
conferences are planned to be organized as part of MULTICONF-10.
• International Conference on Artificial Intelligence and Pattern
Recognition (AIPR-10)
• International Conference on Automation, Robotics and Control
Systems (ARCS-10)
• International Conference on Bioinformatics, Computational Biology,
Genomics and Chemoinformatics (BCBGC-10)
• International Conference on Computer Communications and Networks
(CCN-10)
• International Conference on Enterprise Information Systems and Web
Technologies (EISWT-10)
• International Conference on High Performance Computing Systems
(HPCS-10)
• International Conference on Information Security and Privacy
(ISP-10)
• International Conference on Image and Video Processing and Computer
Vision (IVPCV-10)
• International Conference on Software Engineering Theory and Practice
(SETP-10)
• International Conference on Theoretical and Mathematical Foundations
of Computer Science (TMFCS-10)
We invite draft paper submissions. Please see the website
http://www.PromoteResearch.org for more details.
Sincerely
James Heralds
Publicity committee
==============================================================================
TOPIC: how would one define/use polymorphic implementations of STL types ??
http://groups.google.com/group/comp.lang.c++/t/f804e45d4caee766?hl=en
==============================================================================
== 1 of 3 ==
Date: Thurs, Feb 4 2010 6:01 am
From: Coder Fodder
Hello there.
I have been pondering how one would do such a thing.
For example, the std::set type uses a red-black tree impl.
If I decided that I needed a special impl for set for some
reason, how would one do this ??
So we might have :
// Some function that should be applicable to any impl of set
void doSomething( ?1? theSet)
{
?1?::iterator iter = theSet.begin() ;
// ...
}
std::set<int> s1 ; // the standard STL impl
?2? s2 ; // the special impl of set
doSomething(s1) ;
doSomething(s2) ;
How would ?1? and ?2? be defined and/or implemented ??
Or is the above just not possible (you are stuck with one
impl of every STL type in every program - whatever that may be) ??
Regards
== 2 of 3 ==
Date: Thurs, Feb 4 2010 7:40 am
From: Gert-Jan de Vos
On Feb 4, 3:01 pm, Coder Fodder <nos...@my.com> wrote:
> Hello there.
>
> I have been pondering how one would do such a thing.
>
> For example, the std::set type uses a red-black tree impl.
>
> If I decided that I needed a special impl for set for some
> reason, how would one do this ??
>
> So we might have :
>
> // Some function that should be applicable to any impl of set
>
> void doSomething( ?1? theSet)
> {
> ?1?::iterator iter = theSet.begin() ;
> // ...
> }
template <typename SetType>
void doSomething(const SetType& theSet)
{
SetType::iterator iter = theSet.begin();
// ...
}
> std::set<int> s1 ; // the standard STL impl
> ?2? s2 ; // the special impl of set
MySet<int> s2;
> doSomething(s1);
> doSomething(s2);
This is exactly how things like std::sort can work on
e.g. either std::queue<T> or std::vector<T> or built-in
arrays.
== 3 of 3 ==
Date: Thurs, Feb 4 2010 9:21 am
From: "Thomas J. Gritzan"
Am 04.02.2010 16:40, schrieb Gert-Jan de Vos:
> On Feb 4, 3:01 pm, Coder Fodder <nos...@my.com> wrote:
>> I have been pondering how one would do such a thing.
>>
>> For example, the std::set type uses a red-black tree impl.
>>
>> If I decided that I needed a special impl for set for some
>> reason, how would one do this ??
>>
>> So we might have :
>>
>> // Some function that should be applicable to any impl of set
>>
>> void doSomething( ?1? theSet)
>> {
>> ?1?::iterator iter = theSet.begin() ;
>> // ...
>> }
>
> template <typename SetType>
> void doSomething(const SetType& theSet)
> {
> SetType::iterator iter = theSet.begin();
<nitpicking>
typename SetType::const_iterator iter = theSet.begin();
</nitpicking>
> // ...
> }
--
Thomas
==============================================================================
TOPIC: C++ to C# conversion
http://groups.google.com/group/comp.lang.c++/t/dd58a0348cd2906e?hl=en
==============================================================================
== 1 of 5 ==
Date: Thurs, Feb 4 2010 6:24 am
From: "GrzybSon"
I've got following struct in C++
typedef struct TestStruct
{
const char * m_device;
unsigned m_value;
}
What size is m_device type;
What does const mean?
What size is m_value type?
--
Regards,
Maæko
== 2 of 5 ==
Date: Thurs, Feb 4 2010 6:37 am
From: Bart van Ingen Schenau
On Feb 4, 3:24 pm, "GrzybSon" <mrych...@kenbit.pl> wrote:
> I've got following struct in C++
>
> typedef struct TestStruct
> {
> const char * m_device;
> unsigned m_value;
>
> }
>
> What size is m_device type;
It is the size of a pointer to char (sizeof(char*)). Probably it will
be 4 or 8 bytes.
> What does const mean?
It means that the character(s) that m_device refers to can not be
changed by the program.
>
> What size is m_value type?
It is sizeof(unsigned int) bytes. Probably 4.
>
> --
> Regards,
> Maæko
Bart v Ingen Schenau
== 3 of 5 ==
Date: Thurs, Feb 4 2010 6:51 am
From: "GrzybSon"
Uzytkownik "Bart van Ingen Schenau" <bart@ingen.ddns.info> napisal w
wiadomosci
news:e85e1317-13ef-4f47-9ddb-5e235867197c@g1g2000yqi.googlegroups.com...
On Feb 4, 3:24 pm, "GrzybSon" <mrych...@kenbit.pl> wrote:
> I've got following struct in C++
>
> typedef struct TestStruct
> {
> const char * m_device;
> unsigned m_value;
>
> }
>
> What size is m_device type;
> It is the size of a pointer to char (sizeof(char*)). Probably it will
> be 4 or 8 bytes.
So on win32 systems it will be 4 bytes?
This code is run under VC++ 2005.
> What does const mean?
It means that the character(s) that m_device refers to can not be
changed by the program.
>
> What size is m_value type?
> It is sizeof(unsigned int) bytes. Probably 4.
Thanx :)
>
> --
> Regards,
> Maæko
Bart v Ingen Schenau
== 4 of 5 ==
Date: Thurs, Feb 4 2010 10:40 am
From: Rolf Magnus
GrzybSon wrote:
>> I've got following struct in C++
>>
>> typedef struct TestStruct
>> {
>> const char * m_device;
>> unsigned m_value;
>>
>> }
>>
>> What size is m_device type;
>
>> It is the size of a pointer to char (sizeof(char*)). Probably it will
>> be 4 or 8 bytes.
>
> So on win32 systems it will be 4 bytes?
> This code is run under VC++ 2005.
Yes, but why does that matter to you?
== 5 of 5 ==
Date: Thurs, Feb 4 2010 1:50 pm
From: "GrzybSon"
Uzytkownik "Rolf Magnus" <ramagnus@t-online.de> napisal w wiadomosci
news:hkf4bg$10o$00$1@news.t-online.com...
> GrzybSon wrote:
>
>>> I've got following struct in C++
>>>
>>> typedef struct TestStruct
>>> {
>>> const char * m_device;
>>> unsigned m_value;
>>>
>>> }
>>>
>>> What size is m_device type;
>>
>>> It is the size of a pointer to char (sizeof(char*)). Probably it will
>>> be 4 or 8 bytes.
>>
>> So on win32 systems it will be 4 bytes?
>> This code is run under VC++ 2005.
>
> Yes, but why does that matter to you?
I've got unmanaged C++ dll that exports some functions, classes and
callbacks.
I want to use that DLL in C# under VS 2008.
Some of the exported functions returns complex types as instances of
unmanaged classes - pointers in memory.
To convert pointer to managed structers in C# i have to define managed
equivalent classes (or structs).
My next question:
typedef enum MyEnum
{
enum1,
enum2
}
what is the size of variable of type MyEnum in C++?
==============================================================================
TOPIC: ★~★~★ 2010 HOT Sale AAA True Leather brand handbags (Chanel handbag,
Gucci handbag, LV handbag......) at www.rijing-trade.com <paypal payment>
http://groups.google.com/group/comp.lang.c++/t/41e43f78aaea390e?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Feb 4 2010 8:29 am
From: "www.fjrjtrade.com"
★~★~★ 2010 HOT Sale AAA True Leather brand handbags (Chanel handbag,
Gucci handbag, LV handbag......) at www.rijing-trade.com <paypal
payment>
Cheap wholesale handbags www.rijing-trade.com
Cheap wholesale AAA True Leather handbags www.rijing-trade.com
Cheap wholesale Burberry Handbags AAA
Cheap wholesale Burberry Purse AAA
Cheap wholesale D&G Handbags AAA
Cheap wholesale Fendi Handbags AAA
Cheap wholesale Hermes Handbags AAA
Cheap wholesale Kooba Handbags AAA
Cheap wholesale Loewe Handbags AAA
Cheap wholesale Marc Jacobs Handbags AAA
Cheap wholesale Mulberry Handbags AAA
Cheap wholesale Prada Handbags AAA
Cheap wholesale Thomaswlde Handbags AAA
Cheap wholesale Valentnv Handbags AAA
Cheap wholesale Versace Handbags AAA
Cheap wholesale Balenciaga Handbags AAA
Cheap wholesale Balenciaga Purse AAA
Cheap wholesale Bally Purse AAA
Cheap wholesale Boss purse AAA
Cheap wholesale Chanel Handbags AAA
Cheap wholesale Chanel Purse AAA
Cheap wholesale Chloe Handbags AAA
Cheap wholesale Coach Handbags AAA
Cheap wholesale Miumiu Handbags AAA
Cheap wholesale Dior Handbags AAA
Cheap wholesale Gucci Handbags AAA
Cheap wholesale Gucci Purse AAA
Cheap wholesale Hermes Purse AAA
Cheap wholesale JIMMY CHOO Handbags AAA
Cheap wholesale LV Handbags AAA
Cheap wholesale LV Purse AAA
More brand items at website:
http://www.rijing-trade.com
==============================================================================
TOPIC: ☎ ☞wholesale cheap ❉Watch❉belt❉cap❉ free shipping cost at www.ecyaya.
com
http://groups.google.com/group/comp.lang.c++/t/31830af1e605486d?hl=en
==============================================================================
== 1 of 1 ==
Date: Thurs, Feb 4 2010 9:22 am
From: hero
☎ ☞wholesale cheap ❉Watch❉belt❉cap❉ free shipping cost at www.ecyaya.com
wholesale Titoni Watch with good quality and low price in www.ecyaya.com
wholesale Bape Watch with good quality and low price in www.ecyaya.com
wholesale Bell&Ross Watch with good quality and low price in www.ecyaya.com
wholesale Breit Ling Watch with good quality and low price in www.ecyaya.com
wholesale Burberry Watch with good quality and low price in www.ecyaya.com
wholesale Cartier Watch with good quality and low price in www.ecyaya.com
wholesale Chopard Watch with good quality and low price in www.ecyaya.com
wholesale D&G Watch with good quality and low price in www.ecyaya.com
wholesale Givenchy Watch with good quality and low price in www.ecyaya.com
wholesale Jacob&Co Watch with good quality and low price in www.ecyaya.com
wholesale Kappa Watch with good quality and low price in www.ecyaya.com
wholesale Prada Watch with good quality and low price in www.ecyaya.com
wholesale Tissot Watch with good quality and low price in www.ecyaya.com
wholesale U-BOAT Watch with good quality and low price in www.ecyaya.com
wholesale Zenith Watch with good quality and low price in www.ecyaya.com
wholesale cheap A CAP www.ecyaya.com
wholesale cheap AFF CAP www.ecyaya.com
wholesale cheap BAPE CAP www.ecyaya.com
wholesale cheap C CAP www.ecyaya.com
wholesale cheap CA CAP www.ecyaya.com
wholesale cheap Cincinnati Reds CAP www.ecyaya.com
wholesale cheap Colorado Rockies CAP www.ecyaya.com
wholesale cheap Coogi CAP www.ecyaya.com
wholesale cheap DC Baseball CAP www.ecyaya.com
wholesale cheap Detroit Tigers CAP www.ecyaya.com
wholesale cheap DSQ CAP www.ecyaya.com
wholesale cheap ED CAP www.ecyaya.com
wholesale cheap ED Winter hat www.ecyaya.com
wholesale cheap GUCCI CAP www.ecyaya.com
wholesale cheap GUCCI Winter hat www.ecyaya.com
wholesale cheap Houston Astros CAP www.ecyaya.com
wholesale cheap Jordan CAP www.ecyaya.com
wholesale cheap Kansas City Royals CAP www.ecyaya.com
wholesale cheap LA CAP www.ecyaya.com
wholesale cheap LV CAP www.ecyaya.com
wholesale cheap Minnesota Twins CAP www.ecyaya.com
wholesale cheap NBA CAP www.ecyaya.com
wholesale cheap NEWERA CAP www.ecyaya.com
wholesale cheap Oakland Athletics CAP www.ecyaya.com
wholesale cheap P CAP www.ecyaya.com
wholesale cheap Philadelphia Phillies CAP www.ecyaya.com
wholesale cheap POLO CAP www.ecyaya.com
wholesale cheap RED BULL CAP www.ecyaya.com
wholesale cheap San Diego Padres CAP www.ecyaya.com
wholesale cheap SF CAP www.ecyaya.com
wholesale cheap SMET CAP www.ecyaya.com
wholesale cheap SOX CAP www.ecyaya.com
wholesale cheap St. Louis Cardinals CAP www.ecyaya.com
wholesale cheap Texas Rangers CAP www.ecyaya.com
wholesale cheap Washington Nationals CAP www.ecyaya.com
the hottest Afflirtion Belt with high quality and low price on www.ecyaya.com
the hottest Armani Belt with high quality and low price on www.ecyaya.com
the hottest Bape Belt with high quality and low price on www.ecyaya.com
the hottest Boss Belt with high quality and low price on www.ecyaya.com
the hottest Burberry Belt with high quality and low price on www.ecyaya.com
the hottest C.D Belt with high quality and low price on www.ecyaya.com
the hottest Chanel Belt with high quality and low price on www.ecyaya.com
the hottest CK Belt with high quality and low price on www.ecyaya.com
the hottest D&G Belt with high quality and low price on www.ecyaya.com
the hottest Diesel Belt with high quality and low price on www.ecyaya.com
the hottest DSQ Belt with high quality and low price on www.ecyaya.com
the hottest ED Belt with high quality and low price on www.ecyaya.com
the hottest Gucci Belt with high quality and low price on www.ecyaya.com
the hottest Hermes Belt with high quality and low price on www.ecyaya.com
the hottest Levfs Belt with high quality and low price on www.ecyaya.com
the hottest LV Belt with high quality and low price on www.ecyaya.com
the hottest Polo Belt with high quality and low price on www.ecyaya.com
the hottest Prada Belt with high quality and low price on www.ecyaya.com
the hottest Versace Belt with high quality and low price on www.ecyaya.com
Good service, Low price, Quick shipping, Good quality are our service
purposes.
These are our company's business items:
1.if you order more than $100, the shipping cost is free.
2.you can paypment by paypal, moneygram, west union, bank transfer.
3.rapid and safe delivery time: 4-9days
4.different styles, colors and sizes in stock for your reference.
otherwise, if you want to return your order back, you would pay the
shipping cost.
More details pls contact us
==============================================================================
You received this message because you are subscribed to the Google Groups "comp.lang.c++"
group.
To post to this group, visit http://groups.google.com/group/comp.lang.c++?hl=en
To unsubscribe from this group, send email to comp.lang.c+++unsubscribe@googlegroups.com
To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.c++/subscribe?hl=en
To report abuse, send email explaining the problem to abuse@googlegroups.com
==============================================================================
Google Groups: http://groups.google.com/?hl=en
No comments:
Post a Comment