Sanjit Jhala | 1 Apr 2011 01:16
Picon

[boost] [program options] Potential bug in parsing arguments where one is suffix of the other ?

Hi,


I have the following code (modified from example/first.cpp):

#include <boost/program_options.hpp>
#include <string>
#include <vector>
#include <iostream>

namespace po = boost::program_options;

using namespace std;

typedef vector<string> Strings;

// A helper function to simplify the main part.
template<class T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
  copy(v.begin(), v.end(), ostream_iterator<T>(cout, " "));
  return os; 
}


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

  po::options_description cmdline_desc("Usage: %s [Options] [args]\nOptions");
  cmdline_desc.add_options()
      ("str", po::value< string >(), "a string arg")
      ("strs", po::value< Strings >(), "a list of strings")
      ("foo", po::value< string >(), "a string arg")
      ("bar", po::value< Strings >(), "a list of strings")
      ;   

  po::variables_map vm; 
  po::store(po::parse_command_line(argc, argv, cmdline_desc), vm);
  po::notify(vm);

  if (vm.count("str"))
    cout << "Got str arg=" << vm["str"].as< string >() << "\n";
  if (vm.count("strs"))
    cout << "Got strs arg=" << vm["strs"].as< Strings >() << "\n";
  if (vm.count("foo"))
    cout << "Got foo arg=" << vm["foo"].as< string >() << "\n";
  if (vm.count("bar"))
    cout << "Got bar arg=" << vm["bar"].as< Strings >() << "\n";
}

When I run the program I see:
./po_test --str "a string" --strs "a, vector, of, strings" --foo "a foo" --bar "a, bar"
Got strs arg=a string a, vector, of, strings 
Got foo arg=a foo
Got bar arg=a, bar 

It appears the parser is getting confused between the "str" and the "strs". It doesn't seem to be related to ambiguity in handling vectors since the "foo" and "bar" arguments are fine. I see this problem on 32-bit CentOS and Ubuntu machines, but not on 64-bit. I am running Boost 1.43 and from the /usr/local/include/boost/program_options/version.hpp:
#define BOOST_PROGRAM_OPTIONS_VERSION_HPP_VP_2004_04_05
#define BOOST_PROGRAM_OPTIONS_VERSION 2

Is this a bug or a expected behaviour?

-Sanjit


_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Noah Roberts | 1 Apr 2011 01:32
Picon
Gravatar

[MPL] no invoke<T>?

I had to write an invoke metafunction because I couldn't seem to find 
one that looked like it was what I needed:

template < typename MF > struct invoke { typedef typename MF::type type; };

I've looked through the documentation TOC: 
http://www.boost.org/doc/libs/1_42_0/libs/mpl/doc/refmanual/refmanual_toc.html

Is there something I'm missing?
Andreas Wehrmann | 1 Apr 2011 08:04

Re: Problem with gcc/4.5.0-g++and boost::function

On 03/31/2011 06:42 PM, Steven Watanabe wrote:
> AMDG
>
> On 03/31/2011 09:27 AM, Shah, Gaurav N wrote:
>> I have legacy code in my library using boost::function. This works 
>> fine if I am using gcc/4.2.2-g++ and BOOST/1.41.  But if I switch 
>> myself to using gcc/4.5.0-g++ and BOOST/1.44 I get below ERROR:
>> I do not see anything wrong with code.
>>
>>
/export/home/a_besnad/Perforce/eq-thebeast-build-linux-Beast_8.08/TheBeast/marketdata/IMDMXP/server/wombat/management.hpp:69:51: 
>> error: 'function' in namespace 'boost' does not name a type
>>
/export/home/a_besnad/Perforce/eq-thebeast-build-linux-Beast_8.08/TheBeast/marketdata/IMDMXP/server/wombat/management.hpp:69:58: 
>> error: ISO C++ forbids declaration of 'parameter' with no type
>>
/export/home/a_besnad/Perforce/eq-thebeast-build-linux-Beast_8.08/TheBeast/marketdata/IMDMXP/server/wombat/management.hpp:69:66: 
>> error: expected ',' or '...' before '<' token
>> ../../../../../../marketdata/IMDMXP/server/wombat/management.cpp:126:10: 
>> error: prototype for 'void datasource::management::stop(const 
>> std::string&, const boost::function<void()>&)' does not match any in 
>> class 'datasource::management'
>>
/export/home/a_besnad/Perforce/eq-thebeast-build-linux-Beast_8.08/TheBeast/marketdata/IMDMXP/server/wombat/management.hpp:69:14: 
>> error: candidate is: void datasource::management::stop(const 
>> std::string&, int)
>> make[6]: *** [management.lo] Error 1
>> make[6]: *** Waiting for unfinished jobs....
>>
>>
>>
>> Code lines throw ERROR:
>>
>> 68           */
>> 69         void stop(const std::string&  topic, const 
>> boost::function<  void (void)>&  action);
>> 70
>>
>> Thanks for help in advance.
>>
>
> Have you verified that boost/function.hpp
> is #included?
>
> In Christ,
> Steven Watanabe
> _______________________________________________
> Boost-users mailing list
> Boost-users <at> lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users

This is the first thing I would check, since the compiler has become 
stricter, meaning
indirect inclusions won't work anymore.
I ran across the same problem when upgrading from 4.2.x to 4.4.x and 
4.5.x respectively.

Regards,
Andreas

--

-- 
Dipl.-Ing. (FH) Andreas Wehrmann
Software Development
--------------------------------------------------------------
Center Communication Systems GmbH
A-1210 Wien, Ignaz-Köck-Straße 19
Sitz in Wien
FN 796 88p, Firmenbuchgericht Wien
www.centersystems.com

Tel.: +43 (0) 190 199 - 3616
Mobile: +43 (0) 664 884 75916
Fax: +43 (0) 190 199 - 2110
E-Mail: a.wehrmann <at> centersystems.com
Joel Falcou | 1 Apr 2011 09:33
Picon
Gravatar

Re: [MPL] no invoke<T>?

On 01/04/11 01:32, Noah Roberts wrote:
> I had to write an invoke metafunction because I couldn't seem to find
> one that looked like it was what I needed:
>
> template < typename MF > struct invoke { typedef typename MF::type type; };
>
> I've looked through the documentation TOC:
> http://www.boost.org/doc/libs/1_42_0/libs/mpl/doc/refmanual/refmanual_toc.html
>
>
> Is there something I'm missing?

http://www.boost.org/doc/libs/1_46_1/libs/mpl/doc/refmanual/apply.html
Cedric Laczny | 1 Apr 2011 10:03
Picon
Picon

[BGL] Confusion about iterator_property_map and initialization of OffsetMap

Hi,

I have modified the astar-cities.cpp example to use an external rank_map based 
on iterator_property_map.
The following should give you an idea:

  vector<cost> v_vec(num_vertices(g), 0.0);

  typedef property_map< mygraph_t, vertex_index_t>::type VertexIndexMap;
  VertexIndexMap v_index = get(vertex_index, g); // Initialization of interest
  // Create the external property map
  typedef iterator_property_map< std::vector< cost >::iterator, VertexIndexMap 
> CostMap;
  CostMap c_map(v_vec.begin(), v_index);

and the function-call of astar_search is as follows:

    astar_search
      (g, start,
       distance_heuristic<mygraph_t, cost, location*, const char**≥
        (locations, goal, name),
       predecessor_map(&p[0]).distance_map(&d[0]).
       visitor(a_star_vis).
       rank_map(c_map)); // Here we use the "global" cost map 

Basically, the code is the same as in the example, with only the addition of 
the explicit rank_map.

Now I am fairly confused that the function call seems to behave the same if I 
have "get(vertex_index, g)" and if I don't have it.
This comes unexpected to me as I would think that it needs OffsetMap (v_index) 
to correctly find the index in the random access container (v_vec). But when I 
simply declare an object it is not yet initialized and will not contain any 
meaningfull offsets (not using "get(vertex_index, g)").
So why does it work, when the map is not initialized? Or what am I missing 
here please?

Best,

Cedric
Shah, Gaurav N | 1 Apr 2011 10:09
Picon

Re: Boost-users Digest, Vol 2679, Issue 1

Thanks Andreas Wehrmann.
if worked after including boost/function.hpp.

I am still wondering what changes boost has made while moving from 1.41 to 1.44 that has made users to
explicitly include "function.hpp" This code was compiling with 1.41 without including boost/function.hpp

Thank You,
Gaurav

-----Original Message-----
From: boost-users-bounces <at> lists.boost.org [mailto:boost-users-bounces <at> lists.boost.org] On
Behalf Of boost-users-request <at> lists.boost.org
Sent: Friday, April 01, 2011 11:34 AM
To: boost-users <at> lists.boost.org
Subject: Boost-users Digest, Vol 2679, Issue 1

Send Boost-users mailing list submissions to
	boost-users <at> lists.boost.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.boost.org/mailman/listinfo.cgi/boost-users
or, via email, send a message with subject or body 'help' to
	boost-users-request <at> lists.boost.org

You can reach the person managing the list at
	boost-users-owner <at> lists.boost.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Boost-users digest..."

Today's Topics:

   1. Re: [boost::mutex] Do they block or wait? (Ovanes Markarian)
   2. Re: [Lambda] nitty gritty detail...? (Robert Jones)
   3. Re: [Lambda] nitty gritty detail...? (Steven Watanabe)
   4. VS2010+boost 1.44 - error in move.hpp (archie14)
   5. [boost] [program options] Potential bug in parsing arguments
      where one is suffix of the other ? (Sanjit Jhala)
   6. [MPL] no invoke<T>? (Noah Roberts)
   7. Re: Problem with gcc/4.5.0-g++and boost::function
      (Andreas Wehrmann)

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

Message: 1
Date: Thu, 31 Mar 2011 20:21:29 +0200
From: Ovanes Markarian <om_boost <at> keywallet.com>
To: boost-users <at> lists.boost.org
Subject: Re: [Boost-users] [boost::mutex] Do they block or wait?
Message-ID:
	<AANLkTim_=MZAk0WwoerK7-TCRAGpN0Gdgcr+DDV5uhOA <at> mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

On Thu, Mar 31, 2011 at 7:49 PM, Steven Watanabe <watanabesj <at> gmail.com>wrote:

> AMDG
>
>
> On 03/31/2011 09:55 AM, Panagiotis Foteinos wrote:
>
>> I looked into the documentation, but it is still unclear to me.
>>
>> [...]
>
> boost's locking mechanism
>> blocking or spinning?
>>
>>
> It's an implementation detail.  You realize that the
> two aren't necessarily mutually exclusive?  Anyway,
> Boost.Thread does block on an Event.  A spin-lock
> only makes sense on a multi-core system.
>
> In Christ,
> Steven Watanabe
>

As Steven pointed out it is an implementation detail and these two concepts
might be used together  (primarily for optimization). Switching to kernel
mode (e.g. dealing with kernel objects like event, mutex, semaphore through
system calls) is a very time costly operation, therefore some libs provide
spinning optimizations, which do spinning (for some few cpu cycles) and if
they are still unable to acquire a lock, they make a system call which
changes into the kernel mode and finally puts the thread into the blocked
state if the object is still not available (signaled, unlocked etc). But
even so it is not black and white in the concurrency world. :( Some would
like to achieve speed through such an optimization others would like to get
rid of such an optimization. A good example might be an embedded app running
on a battery driven HW, where energy plays a major role. Here wasting CPU
cycles for speed optimization might not be a good idea... But anyway that
should be separately evaluated.

With Kind Regards,
Ovanes
-------------- next part --------------
HTML attachment scrubbed and removed

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

Message: 2
Date: Thu, 31 Mar 2011 19:27:30 +0100
From: Robert Jones <robertgbjones <at> gmail.com>
To: boost-users <at> lists.boost.org
Subject: Re: [Boost-users] [Lambda] nitty gritty detail...?
Message-ID:
	<AANLkTinfsOJmqrWBP16+7s2c+YufKcW3GwcHapxttLqq <at> mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

On Thu, Mar 31, 2011 at 4:47 PM, Steven Watanabe <watanabesj <at> gmail.com>wrote:

> AMDG
>
>
> On 03/31/2011 08:29 AM, Robert Jones wrote:
>
>> From Bjorn Karlsson's book, P297...
>>>
>>
>> int i;
>> int value = 12;
>> var(i) = ( if_then_else_return( _1>=10, constant(10),_1) )(value);
>>
>> Why does the assignment LHS need to be wrapped in var()?
>>
>>
> Because operator= must be a member function.
>
>
Nope, still not getting it! Stop me when I err...

if_then_else_return(...) defines a unary functor
it_then_else_return(...)( value) evaluates that functor, and returns what?

Some type of integer I think? So doesn't the assignment simply perform
assignment of an integer, by copy? And that doesn't need operator= to
a member of anything?

Thanks

- R.
-------------- next part --------------
HTML attachment scrubbed and removed

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

Message: 3
Date: Thu, 31 Mar 2011 11:38:33 -0700
From: Steven Watanabe <watanabesj <at> gmail.com>
To: boost-users <at> lists.boost.org
Subject: Re: [Boost-users] [Lambda] nitty gritty detail...?
Message-ID: <4D94CA29.9060307 <at> providere-consulting.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

AMDG

On 03/31/2011 11:27 AM, Robert Jones wrote:
> On Thu, Mar 31, 2011 at 4:47 PM, Steven Watanabe<watanabesj <at> gmail.com>wrote:
>>
>> On 03/31/2011 08:29 AM, Robert Jones wrote:
>>
>>>  From Bjorn Karlsson's book, P297...
>>>>
>>>
>>> int i;
>>> int value = 12;
>>> var(i) = ( if_then_else_return( _1>=10, constant(10),_1) )(value);
>>>
>>> Why does the assignment LHS need to be wrapped in var()?
>>>
>>>
>> Because operator= must be a member function.
>>
>>
> Nope, still not getting it! Stop me when I err...
>
> if_then_else_return(...) defines a unary functor
> it_then_else_return(...)( value) evaluates that functor, and returns what?
>
> Some type of integer I think?

Yes.

> So doesn't the assignment simply perform
> assignment of an integer, by copy? And that doesn't need operator= to
> a member of anything?
>

Oh, I see.  As written, the code doesn't make much
sense, so my mind automatically translated it into

(var(i) = if_then_else_return( _1>=10, constant(10),_1) )(value);

In Christ,
Steven Watanabe

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

Message: 4
Date: Thu, 31 Mar 2011 22:56:11 +0000 (UTC)
From: archie14 <admin <at> tradeplatform.us>
To: boost-users <at> lists.boost.org
Subject: [Boost-users] VS2010+boost 1.44 - error in move.hpp
Message-ID: <loom.20110401T005027-111 <at> post.gmane.org>
Content-Type: text/plain; charset=us-ascii

While compiling the project in VS2010 previously built without errors in 
VS2008 I am getting following error:

c:\libraries\boost\boost_1_44_0\boost\interprocess\detail\move.hpp(342): error 
C2440: 'return' : cannot convert from 'boost::interprocess::file_mapping' 
to 'boost::interprocess::file_mapping &&'
         You cannot bind an lvalue to an rvalue reference
         c:\libraries\boost\boost_1_44_0\boost\interprocess\file_mapping.hpp
(62) : see reference to function template 
instantiation 'boost::interprocess::file_mapping 
&&boost::interprocess::move<boost::interprocess::file_mapping&>(T)' being 
compiled
          with
         [
             T=boost::interprocess::file_mapping &
         ]

I tried to search the forum for the reports on this error and did not find 
anything.

I'll appreciate any help in this matter.

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

Message: 5
Date: Thu, 31 Mar 2011 16:16:25 -0700
From: Sanjit Jhala <sjhalaz <at> gmail.com>
To: boost-users <at> lists.boost.org
Subject: [Boost-users] [boost] [program options] Potential bug in
	parsing arguments where one is suffix of the other ?
Message-ID:
	<AANLkTi=bEJWMhNj-wO-9O6SjHORiGkr0xn75pKeJOU4= <at> mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

I have the following code (modified from example/first.cpp):

*#include <boost/program_options.hpp>*
*#include <string>*
*#include <vector>*
*#include <iostream>*
*
*
*namespace po = boost::program_options;*
*
*
*using namespace std;*
*
*
*typedef vector<string> Strings;*
*
*
*// A helper function to simplify the main part.*
*template<class T>*
*ostream& operator<<(ostream& os, const vector<T>& v)*
*{*
*  copy(v.begin(), v.end(), ostream_iterator<T>(cout, " "));*
*  return os; *
*}*
*
*
*
*
*int main(int argc, char *argv[]) {*
*
*
*  po::options_description cmdline_desc("Usage: %s [Options]
[args]\nOptions");*
*  cmdline_desc.add_options()*
*      ("str", po::value< string >(), "a string arg")*
*      ("strs", po::value< Strings >(), "a list of strings")*
*      ("foo", po::value< string >(), "a string arg")*
*      ("bar", po::value< Strings >(), "a list of strings")*
*      ;   *
*
*
*  po::variables_map vm; *
*  po::store(po::parse_command_line(argc, argv, cmdline_desc), vm);*
*  po::notify(vm);*
*
*
*  if (vm.count("str"))*
*    cout << "Got str arg=" << vm["str"].as< string >() << "\n";*
*  if (vm.count("strs"))*
*    cout << "Got strs arg=" << vm["strs"].as< Strings >() << "\n";*
*  if (vm.count("foo"))*
*    cout << "Got foo arg=" << vm["foo"].as< string >() << "\n";*
*  if (vm.count("bar"))*
*    cout << "Got bar arg=" << vm["bar"].as< Strings >() << "\n";*
*}*
*
*
When I run the program I see:
*./po_test --str "a string" --strs "a, vector, of, strings" --foo "a foo"
--bar "a, bar"*
*Got strs arg=a string a, vector, of, strings *
*Got foo arg=a foo*
*Got bar arg=a, bar *

It appears the parser is getting confused between the "str" and the "strs".
It doesn't seem to be related to ambiguity in handling vectors since the
"foo" and "bar" arguments are fine. I see this problem on 32-bit CentOS and
Ubuntu machines, but not on 64-bit. I am running Boost 1.43 and from
the /usr/local/include/boost/program_options/version.hpp:
#define BOOST_PROGRAM_OPTIONS_VERSION_HPP_VP_2004_04_05
#define BOOST_PROGRAM_OPTIONS_VERSION 2

Is this a bug or a expected behaviour?

-Sanjit
-------------- next part --------------
HTML attachment scrubbed and removed

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

Message: 6
Date: Thu, 31 Mar 2011 16:32:13 -0700
From: Noah Roberts <roberts.noah <at> gmail.com>
To: boost-users <at> lists.boost.org
Subject: [Boost-users] [MPL] no invoke<T>?
Message-ID: <in32tm$6u3$1 <at> dough.gmane.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

I had to write an invoke metafunction because I couldn't seem to find 
one that looked like it was what I needed:

template < typename MF > struct invoke { typedef typename MF::type type; };

I've looked through the documentation TOC: 
http://www.boost.org/doc/libs/1_42_0/libs/mpl/doc/refmanual/refmanual_toc.html

Is there something I'm missing?

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

Message: 7
Date: Fri, 01 Apr 2011 08:04:18 +0200
From: Andreas Wehrmann <a.wehrmann <at> centersystems.com>
To: boost-users <at> lists.boost.org
Subject: Re: [Boost-users] Problem with gcc/4.5.0-g++and
	boost::function
Message-ID: <4D956AE2.4040808 <at> centersystems.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 03/31/2011 06:42 PM, Steven Watanabe wrote:
> AMDG
>
> On 03/31/2011 09:27 AM, Shah, Gaurav N wrote:
>> I have legacy code in my library using boost::function. This works 
>> fine if I am using gcc/4.2.2-g++ and BOOST/1.41.  But if I switch 
>> myself to using gcc/4.5.0-g++ and BOOST/1.44 I get below ERROR:
>> I do not see anything wrong with code.
>>
>>
/export/home/a_besnad/Perforce/eq-thebeast-build-linux-Beast_8.08/TheBeast/marketdata/IMDMXP/server/wombat/management.hpp:69:51: 
>> error: 'function' in namespace 'boost' does not name a type
>>
/export/home/a_besnad/Perforce/eq-thebeast-build-linux-Beast_8.08/TheBeast/marketdata/IMDMXP/server/wombat/management.hpp:69:58: 
>> error: ISO C++ forbids declaration of 'parameter' with no type
>>
/export/home/a_besnad/Perforce/eq-thebeast-build-linux-Beast_8.08/TheBeast/marketdata/IMDMXP/server/wombat/management.hpp:69:66: 
>> error: expected ',' or '...' before '<' token
>> ../../../../../../marketdata/IMDMXP/server/wombat/management.cpp:126:10: 
>> error: prototype for 'void datasource::management::stop(const 
>> std::string&, const boost::function<void()>&)' does not match any in 
>> class 'datasource::management'
>>
/export/home/a_besnad/Perforce/eq-thebeast-build-linux-Beast_8.08/TheBeast/marketdata/IMDMXP/server/wombat/management.hpp:69:14: 
>> error: candidate is: void datasource::management::stop(const 
>> std::string&, int)
>> make[6]: *** [management.lo] Error 1
>> make[6]: *** Waiting for unfinished jobs....
>>
>>
>>
>> Code lines throw ERROR:
>>
>> 68           */
>> 69         void stop(const std::string&  topic, const 
>> boost::function<  void (void)>&  action);
>> 70
>>
>> Thanks for help in advance.
>>
>
> Have you verified that boost/function.hpp
> is #included?
>
> In Christ,
> Steven Watanabe
> _______________________________________________
> Boost-users mailing list
> Boost-users <at> lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users

This is the first thing I would check, since the compiler has become 
stricter, meaning
indirect inclusions won't work anymore.
I ran across the same problem when upgrading from 4.2.x to 4.4.x and 
4.5.x respectively.

Regards,
Andreas

-- 
Dipl.-Ing. (FH) Andreas Wehrmann
Software Development
--------------------------------------------------------------
Center Communication Systems GmbH
A-1210 Wien, Ignaz-K?ck-Stra?e 19
Sitz in Wien
FN 796 88p, Firmenbuchgericht Wien
www.centersystems.com

Tel.: +43 (0) 190 199 - 3616
Mobile: +43 (0) 664 884 75916
Fax: +43 (0) 190 199 - 2110
E-Mail: a.wehrmann <at> centersystems.com

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

_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

End of Boost-users Digest, Vol 2679, Issue 1
********************************************
This communication is for informational purposes only. It is not
intended as an offer or solicitation for the purchase or sale of
any financial instrument or as an official confirmation of any
transaction. All market prices, data and other information are not
warranted as to completeness or accuracy and are subject to change
without notice. Any comments or statements made herein do not
necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.

Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to European legal entities.
emeplease | 1 Apr 2011 10:28
Picon

gcc3.4 and boost type trait (is_virtual_base_of) , compile warning

Hello , I am using boost 1.41 with gcc 3.4 (I know it's pretty old) , I 
am having problem with "is_virtual_base_of"

The following lines of code will reproduce the problem. Thank you very much

Joseph

======== test_typetrait.cpp ==============

#include <iostream>
#include <boost/type_traits/is_virtual_base_of.hpp>

class Fruit
{
};

class Apple : virtual public Fruit
{
};

int main(int argc,char** argv)
{
     std::cout << std::endl << boost::is_virtual_base_of< Fruit, 
Apple>::value << std::endl;
     return 0;
}

======== full Compile warning ==============

include/boost/type_traits/is_virtual_base_of.hpp:
     In instantiation of `boost::detail::is_virtual_base_of_impl<Fruit, 
Apple, mpl_::bool_< true> >::X':

include/boost/type_traits/is_virtual_base_of.hpp:70:
     instantiated from `boost::detail::is_virtual_base_of_impl<Fruit, 
Apple, mpl_::bool_< true> >'

include/boost/type_traits/is_virtual_base_of.hpp:78:
     instantiated from `boost::detail::is_virtual_base_of_impl2<Fruit, 
Apple>'

include/boost/type_traits/is_virtual_base_of.hpp:87:
     instantiated from `boost::is_virtual_base_of<Fruit, Apple>'

test_typetrait.cpp:119:
     instantiated from here
     include/boost/type_traits/is_virtual_base_of.hpp:56:
         warning: direct base `Fruit' inaccessible in 
`boost::detail::is_virtual_base_of_impl<Fruit, Apple, mpl_::bool_< true> 
 >::X' due to ambiguity
Ion Gaztañaga | 1 Apr 2011 11:59
Picon

Re: VS2010+boost 1.44 - error in move.hpp

El 01/04/2011 0:56, archie14 escribió:
> While compiling the project in VS2010 previously built without errors in
> VS2008 I am getting following error:
>
> c:\libraries\boost\boost_1_44_0\boost\interprocess\detail\move.hpp(342): error
> C2440: 'return' : cannot convert from 'boost::interprocess::file_mapping'
> to 'boost::interprocess::file_mapping&&'
>           You cannot bind an lvalue to an rvalue reference
>           c:\libraries\boost\boost_1_44_0\boost\interprocess\file_mapping.hpp
> (62) : see reference to function template
> instantiation 'boost::interprocess::file_mapping
> &&boost::interprocess::move<boost::interprocess::file_mapping&>(T)' being
> compiled
>            with
>           [
>               T=boost::interprocess::file_mapping&
>           ]
>
>
> I tried to search the forum for the reports on this error and did not find
> anything.
>
> I'll appreciate any help in this matter.

Update your interprocess code. This bug should be solved now.

Ion
John Maddock | 1 Apr 2011 13:13
Favicon

Re: gcc3.4 and boost type trait (is_virtual_base_of) , compile warning

> Hello , I am using boost 1.41 with gcc 3.4 (I know it's pretty old) , I am 
> having problem with "is_virtual_base_of"
>
> The following lines of code will reproduce the problem. Thank you very 
> much

It's a known issue, specific to GCC-3.4.x, and I don't have a fix, sorry :-(

Regards, John. 
David Ward | 1 Apr 2011 13:32
Picon
Favicon

Re: how to link to a specific version of windows CRT


Hi,there,    I am using boost 1.42. The default CRT linked by it is  like this:      
name='Microsoft.VC90.CRT' version='9.0.21022.8'

  Now I want to link to the another
 version, say, version="9.0.30729.4148", can anybody 
  tell where and how to specify this option when I build the binary from source?

Thanks in advanceOrNot   

---

http://msdn.microsoft.com/en-us/library/cc664727(v=vs.90).aspx
You can pass the appropriate macros into bjam:
define="_BIND_TO_CURRENT_VCLIBS_VERSION=1"

Regards,
David. 		 	   		  

Gmane