OvermindDL1 | 1 Nov 01:48
Picon

Re: [Spirit] xml parse tree printing double leaf node

On Sat, Oct 31, 2009 at 12:29 PM, HT4N - <ht4n <at> hotmail.com> wrote:
> When I generating parse tree and dump it using the built-in tree-to-xml
> function, even from a simple grammar, I wonder why it prints out the leaf
> node twice.
>
> For instance:
>
> Parameter = ParameterName >> ParameterValue;
>
> The tree it prints it looks more or less like the following (note the
> repetition of ParameterName and ParameterValue nodes):
>
> <Parameter>
>      <ParameterName>
>             <ParameterName>
>                     <value>Foo</value>
>             </ParameterName>
>      </ParameterName>
>      </ParameterValue>
>             <ParameterValue>
>                     <value>Bar</value>
>             </ParameterValue>
>      </ParameterValue>
> </Parameter>
>
> I would be expecting more something like:
>
> <Parameter>
>      <ParameterName>
>            <value>Foo</value>
(Continue reading)

OvermindDL1 | 1 Nov 01:51
Picon

Re: [regex] Using Boost.Regex rather than std::regex with VC++

On Sat, Oct 31, 2009 at 2:02 PM, Ahmed Charles <ahmedcharles <at> gmail.com> wrote:
> I'm using VC2010, which provides an implementation of
> std::regex/std::tr1::regex and boost gladly uses this implementation rather
> than it's own. I'd like to turn this off, so that I get the boost version
> when including:
>
> #include <boost/regex.hpp>
>
> Thanks in advance.

This may not be an answer you want, I do not know the regex library,
but maybe Boost.Xpressive still uses the normal Boost-side code since
it uses regex, at the very least the static version does.
Steven Watanabe | 1 Nov 02:00
Picon

Re: [regex] Using Boost.Regex rather than std::regex with VC++

AMDG

Ahmed Charles wrote:
> I'm using VC2010, which provides an implementation of
> std::regex/std::tr1::regex and boost gladly uses this implementation rather
> than it's own. I'd like to turn this off, so that I get the boost version
> when including:
>
> #include <boost/regex.hpp>
>   

This does give you the boost version.

In Christ,
Steven Watanabe
John Yamokoski | 1 Nov 02:58
Picon

Re: bad_any_cast being thrown but no idea why

>>
>> I have been pulling my hair out over this bug for a day or two now.
>> Here's the synopsis. I have a boost::any object which is storing a
>> std::string. Any test I do to check if indeed the any object is
>> holding onto a std::string object verifies what I already know. For
>> instance, the following function always returns true for my boost::any
>> object:
>>
>> bool is_string(const boost::any& operand)
>> {
>>        return ( operand.type() == typeid(std::string) );
>> }
>>
>> Also if I just print out the typeinfo information for the boost::any
>> object is also shows that its holding onto a std::string:
>>
>> std::stringstream ss;
>> ss << "any object: " << obj.type().name() << ", a string: " <<
>> typeid(std::string).name();
>>
>> yields,
>>
>> any object: Ss, a string: Ss
>>
>> However, whenever I try and actually cast my object to a string
>> (boost::any_cast<std::string>(...)), I always get
>> "boost::bad_any_cast: failed conversion using boost::any_cast".
>>
>> Could this possibly be a compiler issue? I saw one other thread where
>> "-fvisibility=hidden" was causing some problems for
(Continue reading)

Picon
Gravatar

Re: [regex] Using Boost.Regex rather than std::regex with VC++

Maybe through ADL it doesn't in his code? Ahmed, can you give us a
small snippet example of where you call a regex function and the one
you didnt expect is called?

Dee

On Sun, Nov 1, 2009 at 9:00 AM, Steven Watanabe <watanabesj <at> gmail.com> wrote:
> AMDG
>
> Ahmed Charles wrote:
>>
>> I'm using VC2010, which provides an implementation of
>> std::regex/std::tr1::regex and boost gladly uses this implementation
>> rather
>> than it's own. I'd like to turn this off, so that I get the boost version
>> when including:
>>
>> #include <boost/regex.hpp>
>>
>
> This does give you the boost version.
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Boost-users mailing list
> Boost-users <at> lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
(Continue reading)

Zachary Turner | 1 Nov 06:12
Picon

date_time O/S conversion routine limitation

Hello list,

Apologies for the cross-post, this originally went to the boost-users list a day or so ago but it got no responses, and then I also realized it was actually more appropriate here. 

Suppose I have a cross-platform agent that communicates with a server.  Agent from platform X sends a message to the server which contains a date/time.  Server sends a message to another agent running platform Y with the same date/time.  In practice X/Y are always either windows/linux or linux/windows.  The server always tells the agent which platform's native format the time is represented in, so there should be no problem.  Ideally I'd like to write the following code:

    ptime time;
    if (msg.is_from_windows())
    {
        time = from_ftime<ptime>(msg.time());
    }
    else
    {
        time = from_time_t(msg.time());
    }

But this doesn't work because from_ftime<> is not defined on linux.  If from_ftime<> is already templated on the FILETIME type, is there any reason it needs to be #ifdef'd out on non-windows platforms?    I mean, a FILETIME is really just a uint64, can't the templated function also just operate on a boost::uint64_t?

Zach

_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Zachary Turner | 1 Nov 06:13
Picon

Re: date_time O/S conversion routine limitation

On Sun, Nov 1, 2009 at 12:12 AM, Zachary Turner <divisortheory <at> gmail.com> wrote:

Hello list,

Apologies for the cross-post, this originally went to the boost-users list a day or so ago but it got no responses, and then I also realized it was actually more appropriate here. 

Agh, my hand-eye coordination is failing me tonight.  This was supposed to go to boost dev list.   Third time's a charm I suppose :(

Zach
_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Michael Caisse | 1 Nov 09:51

Re: bad_any_cast being thrown but no idea why

John Yamokoski wrote:
>> Hi John -
>>
>> The problem is that the RTTI id's are different between your lib
>> and the executable. You can use the undocumented and very useful
>> unsafe cast:
>>
>>        boost::unsafe_any_cast< std::string>( ... )
>>
>> Of course, this creates a problem since it is not safe and if the
>> any doesn't contain a std::string there will be a surprise.
>>
>>     
>
> Michael,
>
> Well its great to hear there's some sort of explanation for this.
> Unfortunately, from my compiler, I get:
>
> no matching function for call to 'unsafe_any_cast(const boost::any&)'
>
> I believe I have installed Boost version 1.40. I will gladly downgrade
> to an earlier version if unsafe_any_cast was finally eliminated in
> 1.40. Otherwise is there another way to deal with RTTI ID issues? This
> is the first I have heard of them. Ahhh.. so close though.
>   

John -

It is still in the interface:

https://svn.boost.org/trac/boost/browser/tags/release/Boost_1_40_0/boost/any.hpp#L219

Did you remember the template parameter?

	boost::unsafe_any_cast< std::string>( ... )

Do you have a small code snippet that reproduces the problem?

michael

--

-- 

----------------------------------
Michael Caisse
Object Modeling Designs
www.objectmodelingdesigns.com
John Maddock | 1 Nov 11:39
Picon

Re: [regex] Using Boost.Regex rather than std::regex withVC++

> I'm using VC2010, which provides an implementation of
> std::regex/std::tr1::regex and boost gladly uses this implementation 
> rather
> than it's own. I'd like to turn this off, so that I get the boost version
> when including:
>
> #include <boost/regex.hpp>

boost/regex.hpp *always* provides the Boost version (in namespace boost::).

boost/tr1/regex.hpp provides the std:: version if it's available, otherwise 
falls back to the boost version (in namespace std::tr1::).

HTH, John. 
Moritz | 1 Nov 13:57
Picon
Picon

[interprocess] Best practice question on shared resources.

Hi there,

I am writing a "server" that is capable of communicating data to many
"clients". Because I am implementing different communication modes
(async, sync), I need special methods to lock and unlock a managed
shared memory segment.

My question is how to store the mutex, semaphore and
managed_shared_memory segment information that are required in the lock
and unlock methods. I see different approaches to implement this on
client side.

1.
Open the resources in the constructor of the client. Save pointers to
the resources as members. So it is possible to access the resources in
every method of the client class without opening them every time. The
problem is that I do not recognize if the resources were closed because
they only throw on opening (using linux).

2.
Open the resources in the functions. That means I have to create the
resource objects every time the function is called. So I have a chance
to recognize if the resources have been removed. But I think this will
create some useless overhead.

Has anybody implemented something similar to this. How would you handle
the shared resources?

Thanks in advance Moritz

Illustration:
1.
class client
{
  client()
  {
    _mtx = new boost::interprocess::named_mutex(...);
  }

  void lock()
  {
    _mtx.lock()
  }

  boost::interprocess::named_mutex * _mtx;
};

versus
2.
class client
{
  void lock()
  {
    boost::interprocess::named_mutex mutex(...);
    mutex.lock()
  }
};

Gmane