Specifically, I need to catch the event of a month greater than 12,
etc.
Presumably, I should go to this page and figure the syntax from there.
http://www.boost.org/doc/libs/1_40_0/doc/html/date_time/doxy.html
But I can't figure out how to get from A to B.
I have zero experience with templates (except for simple things like
vector<string>). I have no idea how to derive a subclass in C++, a
skill which is apparently required for dealing with exceptions.
All my exceptions have been based on an enum, but it seem that
Date_Time uses structs. Another mystery.
Any pointers and guidance are most welcome...
TIA,
-RFH
> Specifically, I need to catch the event of a month greater than 12,
> etc.
>
> Presumably, I should go to this page and figure the syntax from there.
>
> http://www.boost.org/doc/libs/1_40_0/doc/html/date_time/doxy.html
>
> But I can't figure out how to get from A to B.
>
> I have zero experience with templates (except for simple things like
> vector<string>). I have no idea how to derive a subclass in C++, a
> skill which is apparently required for dealing with exceptions.
>
A subclass is simply a class that is derived from another class.
> All my exceptions have been based on an enum, but it seem that
> Date_Time uses structs. Another mystery.
>
A struct is like a class but doesn't have the as much functionality.
struct aStruct{int x;int y; char c;}
Basically its a simple class with members but no methods.I can't give you
all the specific rules for a struct in C++, but I'm sure someone can quote
something from the standards that specifies exactly where a struct differs
form a class.
A struct's members are public by default. A class's members are
private by default. That's the *only* differnece as far as the
language is concerned.
As a matter of style, though, it's probably best to use "struct"
for, roughly, types that could be declared as structs in C, and
"class" for anything that goes beyond that (inheritance, member
functions, etc.).
--
Keith Thompson (The_Other_Keith) ks...@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Some comments:
* Exceptions are not special types. You can throw an int, a pointer, a
string, an instance of a class derived from std::exception or any other
class if you want.
* I think someone mentioned the difference between 'class' and 'struct' in
C++ already, i.e. that they are the same except for the default access
(private and public).
* You should not need to derive a subclass in order to use exceptions, but
you have to understand the concept. You should also understand how a
reference to a base object can actually refer to a derived object. These
concepts are explained in any C++ book.
* If I understand the documentation correctly, the library uses
boost::gregorian::bad_month to signal a faulty month value. This class is
derived from std::out_of_range (which in turn derived from std::exception),
even though the documentation doesn't mention it.
Note: Boost is complex and not always easy to use. Neither is C++ and its
standard library, but adding a third component might be a bad choice in the
beginning. Someone also claimed that Boost was pretty slow. This statement
IMHO makes no sense, because Boost is a collection of libraries, some of
which do not even create any runtime overhead, i.e. can not influence the
speed of execution. In any case, I wouldn't worry too much about speed for
the moment, first get your stuff correct.
Good luck!
Uli
Considering the level of knowledge shown by the OP, Slowness will not be
a problem for him. There is nothing wrong with Boost's Date_Time library
and dates and times are very rarely in a performance critical part of a
program.
>
>
>> Specifically, I need to catch the event of a month greater than 12,
>> etc.
>>
>> Presumably, I should go to this page and figure the syntax from there.
>>
>> http://www.boost.org/doc/libs/1_40_0/doc/html/date_time/doxy.html
>>
>> But I can't figure out how to get from A to B.
>>
>> I have zero experience with templates (except for simple things like
>> vector<string>). I have no idea how to derive a subclass in C++, a
>> skill which is apparently required for dealing with exceptions.
>>
> A subclass is simply a class that is derived from another class.
Which is probably of exactly zero use to the OP. Note that he has
explicitly sr=taed that he has no idea as how to derive a subclass in C++
>
>> All my exceptions have been based on an enum, but it seem that
>> Date_Time uses structs. Another mystery.
>>
> A struct is like a class but doesn't have the as much functionality.
> struct aStruct{int x;int y; char c;}
> Basically its a simple class with members but no methods.I can't give you
> all the specific rules for a struct in C++, but I'm sure someone can quote
> something from the standards that specifies exactly where a struct differs
> form a class.
Rubbish (looks like a case of the blind leading the blind). Sorry to be
blunt but that is completely incorrect. A struct is simply a class whose
default access is public. Some programmers restrict their usage of
structs to places where a C-style struct (one that has only data
members) is all they need. But more commonly experienced programmers use
a struct where they are going to provide data members that are publicly
accessible (and, yes, that is sometimes a correct design choice)
Helge
Yes but that is an entirely different context where 'class' just means a
type parameter, nothing to do with class in its more common usage. That
is why many prefer to use 'typename' (it was not available as a keyword
when templates were being developed in the early 1990s)
Could you define slow? I have been using Boost in software that was
handling over 250 sessions per second on a single CPU, with so little
CPU per event that the software itself did not show up in top.
My general experience about Boost seem to significantly differ from
yours. I wonder why do you say Boost is slow...
--
BR, WW
"White Wolf" <wo...@freemail.hu> wrote in message
news:4b093a8c$0$579$c5fe...@read01.usenet4all.se...
Helge
It's another difference between the "class" and "struct" keywords.
It's not a difference between a class and a struct.
Don't sweat it. /bin/sh it happens ;) I hope you have managed to solve
whatever made you pissed. Have a nice day! (I just had to have another
one from Forrest Gump. :)
--
BR, WW