1 Jan 01:21 2009

### Re: proto for array expressions

```Sorry for the delay, the holidays, you know ...

Daniel Oberhoff wrote:
> On 2008-12-18 23:46:40 +0100, Eric Niebler <eric <at> boost-consulting.com>
> said:
>
>> Daniel Oberhoff wrote:
>>>
>>> Now with proto I was wondering how hard it would be to build an et
>>> engine for array math. Basically I am interested in general tensor
>>> notation, and the resulting expressions should be iteratable
>>>
>>> a_ij = b_i * (c_j - sum(d_ijk, k = [i-1,1])
>>
>> I don't understand your notation. What are a_ij et. al.?
>
> Sorry, the underscripts where meant to be indices. So a is a 2d array, b
> and c are 1d arrays, and d is a 3d array. The statement says: to
> calculate a at a given index pair i,j (say 0,0) you substitute for i,j
> on the right. And the sum sums over the third index of the 3d array d.
> The notation further says that the bounds for the summation depend on
> what you substitute for i. So to fill the array a like that you need to
> substitute all values in the domian (say both indices run from 0 to 99
> for a 100x100 array), and for efficiency it would be best if the right
> hand side would result in an iterator that substitutes subsequent all
> values in series.

OK, the syntax for your tensor expressions needs work, but I think what
you're shooting for is certainly doable. How about a syntax like this:
```

1 Jan 15:43 2009

### Re: [filesystem] windows program crashes in debug mode ( DbgUiConnectToDbg )

```> My last guess would be static vs. dynamic runtime libraries...

just checked, and so does the multi-threaded static build).   Oh man.

Warms thanks for your assistance (also to Volodya also).

For the sake of completeness, and because I had it all written any
way, here's my response to the rest of your email.

>> I'm using Code::Blocks under XP, with Boost 1.37 with Mingw 3.4.5
>> boost_filesystem-mgw34-mt-1_37.lib )
>
> Also in debug mode ?
I've tried linking to a variety of different libraries in a variety of
different build modes.

> and it does work. Please find a sample project using bjam and Boost.Test
> attached. It would be great if you could test this with your setup.
> I've looked at the regression test but no-one seems to be running
> mingw-3.4.x tests continuously (some stalled on trunk, none on release)

It ran the test, with both (toolset=msvc and toolset=gcc), and both passed.

> That's is the constructor throwing an exception when setting up with an
> invalid path. Try to catch it.
Tried catching it with

```

1 Jan 19:57 2009

### Re: [boost-users][mpl, enable_if] checking if a type has specific dependant type

```> http://www.boost.org/libs/mpl/doc/refmanual/has-xxx-trait-def.html
>
> In Christ,
> Steven Watanabe

Great, exactly what I need.

Thanks a lot.
```
2 Jan 02:46 2009

### AT Commands Sample Needed

I need a basic example for sending AT commands to mobile. This will require serial communication on COM port. If any one can send me any example of it. I want to do this using BOOST. By searching on GOOGLE I got this but this is not compiling. I know this code is wrong at several places. So can any give me a any right sample or modify it to be right.

#include <iostream>
#include <boost/asio.hpp>
#include <boost/asio/serial_port.hpp>
#include <boost/system/error_code.hpp>
#include <boost/system/system_error.hpp>
#include <boost/bind.hpp>

void handler(const boost::system::error_code& error)
{

}

int main(int argc, char* argv[])
{

using namespace std;
using namespace boost;

boost::asio::io_service io;

asio::serial_port theport(io,"COM7");

io.run();
return 0;

}

Thank You
Rahul

To create something exceptional
-Master4Master
"Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s), are confidential, and may be privileged. If you are not the intended recipient, you are hereby notified that any review, re-transmission, conversion to hard copy, copying, circulation or other use of this message and any attachments is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email, and delete this message and any attachments from your system.Virus Warning: Although I have taken reasonable precautions to ensure no viruses are present in this email, I cannot accept responsibility for any loss or damage arising from the use of this email or attachment."

Speak out for justice and peace,

```_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users```
2 Jan 05:08 2009

### Re: shared_ptr and signals

```Hello,

Perhaps nobody is aware of (perpahs some are) that this simple
use case has introduced another intersting and, probably, very
useful scenario in which the Signals lib could be benificial.

That is:

Slot With Status.

Have a look at this example:

struct Slot
{
int sum;
Slot() : sum(0) {}
Slot(int i) : sum(i) {}
int operator()(int i) { return sum += i; }
};

void test_signals()
{
typedef boost::signal<int(int)> Signal;
Signal sig;

boost::shared_ptr<Slot> a( new Slot() );
boost::shared_ptr<Slot> b = a;
sig.connect(boost::bind( &Slot::operator(), a, _1));
sig.connect(boost::bind( &Slot::operator(), b, _1));
sig.connect(boost::bind( &Slot::operator(), boost::shared_ptr<Slot>(a), _1));
std::cout << "\na.use_count() = " << a.use_count();

std::cout << "\nsum = " << sig(1) << std::endl;
}

The result is:

a.use_count() = 5
sum = 3

the reason of use_count of the shared_ptr being 5 rather than 3 is
the result of the copy semantics of the connect function.

Hope this information is interesting.

B/Rgds
Max

----- Original Message -----
From: Frank Mori Hess <fmhess <at> speakeasy.net>
To: boost-users <at> lists.boost.org
Subject: Re: [Boost-users] shared_ptr and signals
Date: 2009-1-1 01:30:05

On Tue Dec 30 12:47 , Steven Watanabe <watanabesj <at> gmail.com> sent:

>James C. Sutherland wrote:
>> Is it possible to use a shared_ptr object in a signal?
>>
>> I want something like
>>
>> struct A{
>> ...
>> void operator()(){ ... }
>> ...
>> };
>> typedef boost::signal Signal;
>> Signal mySignal;
>>
>> boost::shared_ptr a( new A() );
>> mySignal.connect(a);

>Wrap the shared_ptr in a function object
>
>struct deref_call {
> void operator()() const {
> (*f)();
> }
> boost::shared_ptr f;
>};

bind can also be used to do this, since shared_ptr can be passed as the
"this" argument when binding member functions:

boost::shared_ptr a( new A() );
mySignal.connect(boost::bind(&A::operator(), a));

-------------------------------------------------------------------

```_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users```
2 Jan 16:29 2009

```Hi

I am using the boost s11n lib, version 1.35.0,  in combination with a
text archive, Windows platform, MSVC++ 2005 compiler.

I have split serialize into load and save members, as indicated in the
tutorial.

However, it seems as if save expects a different header format (ie text
stream like stringstream etc) as the corresponding load method outputs.

22 serialization::archive 4 0 0 10(...)

Everything before 10 is s11n housekeeping stuff, 10 is the beginning of
the "real" data.

Now, if a string like this is used as input for save, then the first
variable that is extracted is not the 10 (what it should be) but rather
a 0 (or something else which is equally wrong); instead, the 10 shows up
as the value of the const unsigned int version which is one of the two
parameters of load/save/serialize members. Actually, version is supposed
to be 0, I do not set a version number deliberatly anywhere.

Playing around, I added a third 0 to the header, resulting in

22 serialization::archive 4 0 0 0 10

and, guess what, this time save(...) correctly managed to de-serialize
the data congtained in the string.

I tried it also with a single seralize() member (and not splitting into

The relevant code is below (class code and code to (de)serialize class
instance.

Has anybody experienced the same or similar problems? Any help is

Regards
Ewald

-------------------------------------
Excerpt of class code:

class Foo {

(...)

private:
int buflen;

// s11n stuff
friend class boost::serialization::access;

template<class Archive>
void save(Archive & ar, const unsigned int version) const
{
// store length of buffer
ar & buflen;
// store data itself
for (int j = 0; j < buflen; j++)
ar &  buffer[j];
}

template<class Archive>
void load(Archive & ar, const unsigned int version) {
// get length of buffer
ar & buflen;

// create buffer with appropriate length
deleteBuffer();
init(buflen);

// reat data into buffer
for (int j = 0; j < buflen; j++)
ar & buffer[j];
}

BOOST_SERIALIZATION_SPLIT_MEMBER()

/*
// just to try it with serialize alone:
template<class Archive>
void serialize(Archive &ar, const unsigned int version)
{
ar & buflen;
}
*/

(...)
};
-------------------------------------

// check the save operation
std::stringstream ssq (std::stringstream::in | std::stringstream::out);
{
const Foo rp(10);
boost::archive::text_oarchive oa(ssq);
oa << rp;
}

-----------------------------------

{
stringstream ss (stringstream::in| std::stringstream::out);
ss << s11nbuf << endl;

boost::archive::text_iarchive ia(ss);

// restore  from the archive
ia >> rp;
}

----------------------------------
(end of post)
```
2 Jan 18:52 2009

### release vs. debug build

```After many debug builds, I am trying to build a "release" version -- sometimes known as a non-debug build or
retail version.

In any event, despite changing my .inc file to not use the following debug library, and doing a "build clear"
(which is roughly equivalent to a rebuild all), I get the following:

LINK : fatal error LNK1104: cannot open file 'libboost_date_time-vc90-mt-gd-1_37.lib'

I tried to change the include libraries so that libboost_date_time-vc90-mt-1_37.lib was used instead.

Am I required to rebuild the entire Boost system (e.g. using "jam" files) when I want to swtich from debug to
release?  Can anyone think of any obvious solution to this problem?

Note:  I obtain the Boost lists via digests, so it may take a while for me to interactively respond, if that
becomes needed.

Thanks Again,
Sincerely,
Joseph

AMDG

Joseph A. Marks
PHONE:  612-788-9658
e-mail:  josephamarks <at> yahoo.com
```
2 Jan 19:03 2009

### Re: [thread] locking and time

```Hi,
----- Original Message -----
From: "Ernst Murnleitner" <mur <at> awite.de>
To: <boost-users <at> lists.boost.org>
Sent: Wednesday, December 31, 2008 10:24 PM
Subject: [Boost-users] [thread] locking and time

>
> Hello,
>
> I have some questions about threads. It would be very nice if somebody could
> clarify.
>
> 1) recursive_timed_mutex: It is possible to use a time period for locking of a
> recursive_timed_mutex by using the approprioate timed_lock(). But there is not
> lock class with such a constructor?
You are right. The standard includes
template <class Duration>
unique_lock(mutex_type& m, const Duration& rel_time);

> 2) (recursive timed) shared mutex: Is it not possible to lock with a period of
shared mutex are not recursive.

You are right. The folowing should be added
template<typename TimeDuration>
bool shared_mutex::timed_lock_shared(TimeDuration const & relative_time);
template<typename TimeDuration>
bool shared_mutex::timed_lock(TimeDuration const & relative_time);

> 3) change of system time: What happens in a timed_lock if the system time is
> advanced by e.g. one hour? Is there a difference of using ptime or time_period?
I supose that the lock will expire. I don't think there is any difference because the relative time
interface uses the absolute time one.

> 4) read/writer mutex: if there are some recursive locks by one thread and this
> thread should become the writer, do I run in a deadlock?

> 5) What is the meaning of the various ..._lock_t (e.g. )? Is there a
> documentation?

The Boost.Thread library documents this partially
It document the types but not the variables. In

"Some lock constructors may take tag types, which describe what should be done with the mutex during the
lock's construction.

struct defer_lock_t  {}; // do not acquire ownership of the mutex
struct try_to_lock_t {}; // try to acquire ownership of the mutex
// without blocking
// obtained mutex ownership and manage it

extern const defer_lock_t   defer_lock;
extern const try_to_lock_t  try_to_lock;

"

You use them as follows:

boost::mutex mtx;
boost::unique_lock<boost::mutex> lock(mtx,  boost::defer_lock);
// the mutex is not locked here
or
boost::mutex mtx;
mtx.lock();
// lock will unclock the mutex on destruction
or
boost::mutex mtx;
boost::unique_lock<boost::mutex> lock(mtx,  boost::try_to_lock);
// here the mutex can be lock or not, you need to check with lock.owns_lock()

You should do a ticket on the Trac system for each issue.

Best,
Vicente
```
2 Jan 19:41 2009

```Tweak your code to use the xml_archive.  Then examine this.  This
will reveal what is out of sync.

Robert Ramey

Ewald Peiszer wrote:
> Hi
>
> I am using the boost s11n lib, version 1.35.0,  in combination with a
> text archive, Windows platform, MSVC++ 2005 compiler.
>
> I have split serialize into load and save members, as indicated in the
> tutorial.
>
> However, it seems as if save expects a different header format (ie
> text stream like stringstream etc) as the corresponding load method
> outputs.
> Output of my load method:
> 22 serialization::archive 4 0 0 10(...)
>
> Everything before 10 is s11n housekeeping stuff, 10 is the beginning
> of the "real" data.
>
> Now, if a string like this is used as input for save, then the first
> variable that is extracted is not the 10 (what it should be) but
> rather a 0 (or something else which is equally wrong); instead, the
> 10 shows up as the value of the const unsigned int version which is
> one of the two parameters of load/save/serialize members. Actually,
> version is supposed to be 0, I do not set a version number
> deliberatly anywhere.
> Playing around, I added a third 0 to the header, resulting in
>
> 22 serialization::archive 4 0 0 0 10
>
> and, guess what, this time save(...) correctly managed to de-serialize
> the data congtained in the string.
>
> I tried it also with a single seralize() member (and not splitting
>
> The relevant code is below (class code and code to (de)serialize class
> instance.
>
> Has anybody experienced the same or similar problems? Any help is
>
> Regards
> Ewald
>
> -------------------------------------
> Excerpt of class code:
>
>
>
> class Foo {
>
> (...)
>
> private:
> int buflen;
>
>
>
> // s11n stuff
> friend class boost::serialization::access;
>
> template<class Archive>
> void save(Archive & ar, const unsigned int version) const
>  {
> // store length of buffer
> ar & buflen;
> // store data itself
> for (int j = 0; j < buflen; j++)
> ar &  buffer[j];
> }
>
> template<class Archive>
> void load(Archive & ar, const unsigned int version) {
> // get length of buffer
> ar & buflen;
>
> // create buffer with appropriate length
> deleteBuffer();
> init(buflen);
>
> // reat data into buffer
> for (int j = 0; j < buflen; j++)
> ar & buffer[j];
> }
>
>     BOOST_SERIALIZATION_SPLIT_MEMBER()
>
>
>
>
> /*
> // just to try it with serialize alone:
> template<class Archive>
>     void serialize(Archive &ar, const unsigned int version)
>     {
> ar & buflen;
>     }
> */
>
> (...)
> };
> -------------------------------------
>
>
> // check the save operation
> std::stringstream ssq (std::stringstream::in |
> std::stringstream::out); {
> const Foo rp(10);
> boost::archive::text_oarchive oa(ssq);
> oa << rp;
> }
>
>
>
>
> -----------------------------------
>
>
> {
> stringstream ss (stringstream::in| std::stringstream::out);
> ss << s11nbuf << endl;
>
> boost::archive::text_iarchive ia(ss);
>
> // restore  from the archive
> ia >> rp;
> }
>
> ----------------------------------
> (end of post)
```
2 Jan 20:31 2009

### [interprocess] support for private mappings?

```Does this library support private, read-write file mappings?  Such mapping
is copy on write, and modifications to the mapped region remain private to
the process that created the mapping.

(POSIX: MAP_PRIVATE flag for mmap(), Windows: FILE_MAP_COPY flag to
MapViewOfFile and PAGE_WRITECOPY flag to CreateFileMapping)
```

Gmane