Lothar May | 1 Dec 2007 02:35
Picon
Picon

Re: boost::filesystem exception not caught on MacOS X

Hi,

I'm still stuck with the uncaught exception, I have no idea what is  
going wrong there. Does anyone have any hint on what I could check? I  
tried to compile the corresponding code in Xcode (MacOS 10.5), and  
there I'm getting hundreds of link warnings like

warning boost::detail::shared_count::~shared_count()has different  
visibility (2) in /Users/l-may/projects/test/build/Debug/ 
libtest.a(justatest.o) and (1) in /Users/l-may/projects/test/obj/ 
testapp.build/Debug/testapp.build/Objects-normal/i386/test.o

Not sure whether this is related to the exception problem. Any help?

Best regards,

Lothar

On Nov 24, 2007, at 9:27 PM, Lothar May wrote:

> Hi,
>
> I have a strange problem that an exception thrown by a  
> boost::filesystem directory_iterator is not caugth on MacOS X.  
> Please consider the following code:
>
> ("const string &dir" is a parameter)
>
> bool retVal = true;
> try
(Continue reading)

Daniel | 1 Dec 2007 03:45
Picon

Re: Simple Linking Error

How do I re-build all the libraries like that, on gentoo, without using boost-build?

On Nov 30, 2007 5:39 AM, Markus Schöpflin <markus.schoepflin <at> comsoft.de > wrote:
Daniel wrote:
> Code directly taken from the tutorial here:
> http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/tutorial/tuttimer1src.html
>
> Am I supossed to have a boost_thread library? A google search revealed that
> the gentoo package didn't have it correctly set up, wondering if this could
> be the cause of the problem?

I just tried the following (with Linux, gcc 3.4.3) on the latest boost
development trunk, maybe this will help you:

1. Build all boost libraries as static library with multi-threading enabled:

 > export BOOST_HOME=~/net/src/boost/devel/trunk
 > cd $BOOST_HOME
 > bjam debug link=static threading=multi stage

2. Compile and link asio tutorial example timer1:

 > cd libs/asio/example/tutorial/timer1
 > g++ -pthread -I $BOOST_HOME -o timer1 timer.cpp -L $BOOST_HOME/stage/lib
-lboost_system-gcc34-mt-d
 > ./timer1
Hello, world!

IOW, you only need to link to the boost system library, no other boost libs
are needed.

HTH, Markus

_______________________________________________

_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Andreas Huber | 1 Dec 2007 12:14
Picon
Favicon

Re: [statechart] context sensitive history

Hi Chris

> I have the following requirement:  States A and B, where B has two
> substates
> B1 and B2.  When transition occurs from B to A, and then from A
> back to B,
> under some conditions it is desired for B1 to be the initial
> substate, while
> in others we would like the substate to be chosen based on B's
> shallow
> history.
>
> Is there a concise way to obtain this behavior from the statecharts
> library?

Yep, you'd make B1 a shallow-history inner initial state, as follows:

struct B : sc::simple_state< B, Machine,
  mpl::list< sc::shallow_history< B1 > >, sc::has_shallow_history >
{
  // ...
};

(Note the need to wrap the history state into an mpl::list, see
<http://www.boost.org/libs/statechart/doc/tutorial.html#History>)

Now, whenever you need B1 to be the inner initial state (regardless
of previous history), you simply clear history information before
transitioning to B, as documented here:

<http://www.boost.org/libs/statechart/doc/reference.html#clear_shallow_history>

There's now also a FAQ item: 
<http://www.boost-consulting.com/boost/libs/statechart/doc/faq.html#DisableHistory>

HTH,

--

-- 
Andreas Huber

When replying by private email, please remove the words spam and trap
from the address shown in the header. 
Stathis | 1 Dec 2007 08:21
Picon
Favicon

serialization of vector of pointers

Hi,

What is the right way to serialize/deserialize a container of pointers, e.g. std::vector< int* > ?
I want to store the values, not the addresses in this case. Should I just flatten my data and store 
it in a different fashion, then read the flat data and build my objects with a builder?

I ended up storing the size of the container in a separate variable before the data, when 
serializing. Then when deserializing, I use this size value to scale the container, create new ints, 
read their individual values via the deserialized data values and finally store them back to the new 
object. Can you give an example of how to do this better?

cheers,
--stathis
Germán Diago | 1 Dec 2007 17:22
Picon

Copying types from a mpl vector to a fusion vector

Hello. I'm trying to build a library and I'm doing heavy use of boost mpl and fusion libraries. I'd like to know a way to fill a boost::fusion::vector<>
with the types contained in a boost::mpl::vector. Anyone knows how to do this? The code I have so far:

template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class T10>
struct Func {

    //This is the initial sequence
    typedef typename boost::mpl::vector<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> sequence;

   //The sequence without NullTypes
    typedef typename boost::mpl::filter_view<sequence, boost::mpl::not_<boost::is_same<NullType, boost::mpl::_1> > >::type validsequence;

    //The vector I want to fill with validsequence. Note that this is a fusion vector, not a mpl vector
    typedef boost::fusion::vector<> voidvector;


    /***************PROBLEM HERE*******************/
    //I want to copy validsequence types into voidvector
    typedef typename somewaytocopy::type type;
};



Thanks in advance.

_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Sohail Somani | 1 Dec 2007 18:41
Gravatar

Re: serialization of vector of pointers

On Sat, 01 Dec 2007 08:21:47 +0100, Stathis wrote:

> Hi,
> 
> What is the right way to serialize/deserialize a container of pointers,
> e.g. std::vector< int* > ? I want to store the values, not the addresses
> in this case. Should I just flatten my data and store it in a different
> fashion, then read the flat data and build my objects with a builder?

I think the main reason is that Boost Serialization doesn't track 
pointers to the primitives. So I have a feeling you want to use 
BOOST_STRONG_TYPEDEF (or whatever it is) and use a vector of those things.

Then #include <boost/serialization/vector.hpp> and ar & vec_of_ptrs

If I am not mistaken, I think the magic should take over from there.

--

-- 
Sohail Somani
http://uint32t.blogspot.com
Robert Ramey | 1 Dec 2007 18:46

Re: serialization of vector of pointers

This is already built into the library.

See test_list_ptr for an example how its done with std::list.
std::vector should be the same.

Robert Ramey

Stathis wrote:
> Hi,
>
> What is the right way to serialize/deserialize a container of
> pointers, e.g. std::vector< int* > ? I want to store the values, not
> the addresses in this case. Should I just flatten my data and store
> it in a different fashion, then read the flat data and build my
> objects with a builder?
>
> I ended up storing the size of the container in a separate variable
> before the data, when serializing. Then when deserializing, I use
> this size value to scale the container, create new ints, read their
> individual values via the deserialized data values and finally store
> them back to the new object. Can you give an example of how to do
> this better?
>
> cheers,
> --stathis 
Robert Ramey | 1 Dec 2007 18:51

Re: serialization of vector of pointers

Good call - two issues

a) using built-in serialization of collections
b) saving a pointer to a primitive will result in untracked pointers.
The proposed solution below addresses this second consideration.

Robert Ramey

Sohail Somani wrote:
> On Sat, 01 Dec 2007 08:21:47 +0100, Stathis wrote:
>
>> Hi,
>>
>> What is the right way to serialize/deserialize a container of
>> pointers, e.g. std::vector< int* > ? I want to store the values, not
>> the addresses in this case. Should I just flatten my data and store
>> it in a different fashion, then read the flat data and build my
>> objects with a builder?
>
> I think the main reason is that Boost Serialization doesn't track
> pointers to the primitives. So I have a feeling you want to use
> BOOST_STRONG_TYPEDEF (or whatever it is) and use a vector of those
> things.
>
> Then #include <boost/serialization/vector.hpp> and ar & vec_of_ptrs
>
> If I am not mistaken, I think the magic should take over from there. 
Aaron Windsor | 1 Dec 2007 20:09
Picon

Re: BGL : maximum weighted matching

On Nov 30, 2007 4:46 AM, Alessio Dore <dore <at> dibe.unige.it> wrote:
> Dear all,
>
> I am implementing an algorithm for which I would need to compute the
> maximum weighted matching of a bipartite graphs. I have seen that LEDA
> libraries has this sort of functions but their license is restrictive.
> BGL allows maximum cardinality matching but, if I understood well, it
> works for non-weighted graphs. In a previous message on this list it was
> mentioned that this functionality could have been added but I didn't
> find it. Is it available? Does anyone of you know if there are other
> libraries to perform it?

Hi Alessio,

You're correct - the BGL has an implementation of an algorithm to find
a maximum matching in an unweighted graph, but doesn't yet have a
maximum weighted matching algorithm, even for bipartite graphs. A
recent message on on the boost development mailing list had a link to
a C implementation of maximum weighted matching for graphs (not just
bipartite):

http://lists.boost.org/Archives/boost/2007/10/129535.php

This is the only such free implementation I've seen.

Regards,
Aaron
John Femiani | 1 Dec 2007 23:11
Picon
Favicon

Sequence modifying routines??


Is there a reason that fusion seems devoid of sequence modifying
routines except for the built-in assignment operators?  For instance, if
I wanted to operate on boost::array, I would seem to have no way to
write the results back into an array through fusion (unless I miss
something).

I am looking for something like copy(input_sequence, output_sequence)

-- John Femiani

Gmane