[FileSystem] Getting modified date and time from a file?
Does boost provide a portable way to do this? I didn't see an obvious way; I was hoping others might have ideas. Thanks in advance, Lawrence
________________________________________ From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Lawrence Spector Sent: Tuesday, February 20, 2007 12:42 PM To: boost-users@lists.boost.org Subject: [Boost-users] [FileSystem] Getting modified date and time from afile? Does boost provide a portable way to do this? I didn't see an obvious way; I was hoping others might have ideas. [Nat] How about last_write_time()? http://boost.org/libs/filesystem/doc/operations.htm#last_write_time
I think this will do the job. Thanks so much. =) -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Nat Goodspeed Sent: Tuesday, February 20, 2007 1:39 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [FileSystem] Getting modified date and time fromafile? ________________________________________ From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Lawrence Spector Sent: Tuesday, February 20, 2007 12:42 PM To: boost-users@lists.boost.org Subject: [Boost-users] [FileSystem] Getting modified date and time from afile? Does boost provide a portable way to do this? I didn't see an obvious way; I was hoping others might have ideas. [Nat] How about last_write_time()? http://boost.org/libs/filesystem/doc/operations.htm#last_write_time _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi all, I've been trying out boost::any in a messaging system to package up function arguments. A message call is basically Message::Call(std::vectorboost::any& args) { try ...a few any_cast<..> ...fire the actual function... catch ...etc } It's all good, except for one niggling problem. Say I have a double-precision value that I need changed inside the message, so it needs to be passed as a double* or a double& in an argument. The problem is, if I create a double& inside a boost::any, it doesn't point to the right memory location once I'm inside the message, and it looks like it's copying the original dereferenced value and giving me a reference to the copy. If I create a double* inside a boost::any, I get a new pointer inside the message like the reference, but because the pointer target is correct everything works. The code looks like this: ... ... std::vectorboost::any args; double d = 1.5; double* dptr = &d; msgargs.push_back(dptr);//works fine... double& dref = d; msgargs.push_back(dref);//seems to copy d instead of a reference to d... ... msg->Call(args); ... I can live with this, I just have to pass "large" objects by pointer so they don't get copied. BUT: Can anyone tell me why references are creating a copy of the original and not a copy of the reference, or how I could avoid the copying? Or am I doing something dumb? Damien
Hi,
There's no such thing as a vector (or any other container) of references.
Try this and see how the compiler reacts: vector
Hi all,
I've been trying out boost::any in a messaging system to package up function arguments. A message call is basically
Message::Call(std::vectorboost::any& args) { try ...a few any_cast<..> ...fire the actual function... catch ...etc }
It's all good, except for one niggling problem. Say I have a double-precision value that I need changed inside the message, so it needs to be passed as a double* or a double& in an argument. The problem is, if I create a double& inside a boost::any, it doesn't point to the right memory location once I'm inside the message, and it looks like it's copying the original dereferenced value and giving me a reference to the copy. If I create a double* inside a boost::any, I get a new pointer inside the message like the reference, but because the pointer target is correct everything works. The code looks like this:
... ... std::vectorboost::any args; double d = 1.5; double* dptr = &d; msgargs.push_back(dptr);//works fine... double& dref = d; msgargs.push_back(dref);//seems to copy d instead of a reference to d... ... msg->Call(args); ...
I can live with this, I just have to pass "large" objects by pointer so they don't get copied. BUT: Can anyone tell me why references are creating a copy of the original and not a copy of the reference, or how I could avoid the copying? Or am I doing something dumb?
Damien _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Yes, I know. If you mean this line:
msgargs.push_back(dref)
that's supposed to create a boost::any
Hi,
There's no such thing as a vector (or any other container) of references. Try this and see how the compiler reacts: vector
v; Jan
On 2/26/07, Damien
wrote: Hi all,
I've been trying out boost::any in a messaging system to package up function arguments. A message call is basically
Message::Call(std::vectorboost::any& args) { try ...a few any_cast<..> ...fire the actual function... catch ...etc }
It's all good, except for one niggling problem. Say I have a double-precision value that I need changed inside the message, so it needs to be passed as a double* or a double& in an argument. The problem is, if I create a double& inside a boost::any, it doesn't point to the right memory location once I'm inside the message, and it looks like it's copying the original dereferenced value and giving me a reference to the copy. If I create a double* inside a boost::any, I get a new pointer inside the message like the reference, but because the pointer target is correct everything works. The code looks like this:
... ... std::vectorboost::any args; double d = 1.5; double* dptr = &d; msgargs.push_back(dptr);//works fine... double& dref = d; msgargs.push_back(dref);//seems to copy d instead of a reference to d... ... msg->Call(args); ...
I can live with this, I just have to pass "large" objects by pointer so they don't get copied. BUT: Can anyone tell me why references are creating a copy of the original and not a copy of the reference, or how I could avoid the copying? Or am I doing something dumb?
Damien _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (5)
-
Damien
-
damien@khubla.com
-
Jan Van den bosch
-
Lawrence Spector
-
Nat Goodspeed