<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel about="http://blog.gmane.org/gmane.comp.lib.boost.user">
    <title>gmane.comp.lib.boost.user</title>
    <link>http://blog.gmane.org/gmane.comp.lib.boost.user</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39784"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39781"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39774"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39773"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39769"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39768"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39766"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39764"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39760"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39748"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39746"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39745"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39744"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39743"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39740"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39732"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39731"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39730"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39729"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lib.boost.user/39727"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39784">
    <title>Serialization problem while using class template with template function</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39784</link>
    <description>
Dear everyone,

I need to serialize a class like this:

template&lt;typename typename1, typename typename2=double&gt;
class test_mean
{

public:

test_mean(){}

typename1 typename1_type;

typename2 typename2_type;

private:
std::vector&lt;double&gt; m_parameters;

friend class boost::serialization::access;
template&lt;class Archive&gt;
void serialize(Archive &amp; ar, const unsigned int version)
{
ar &amp; boost::serialization::base_object&lt;base_type&gt;(*this);
ar &amp; m_parameters;
}
};

But I got trapped in the famous 'serialization trap' giving following error
message (compilation is attempted using msvc 8.0 compiler):

\boost_1_36_0\boost\iterator\iterator_adaptor.hpp(225) : error C2027: use of
undefined type 'boost::STATIC_ASSERTION_FAILURE&lt;x&gt;'
1&gt;        with
1&gt;        [
1&gt;            x=false
1&gt;        ]

&lt;cut&gt;

when I put 


struct parameters
{    
double mean(const std::vector&lt;double&gt; &amp;values) const
{
return ame::range::mean(std::make_pair(values.begin()+1, values.end()-1)
| boost::adaptors::filtered(boost::math::isfinite&lt;double&gt;));
}

};

in the typename1...

Anyone can help me to fix this error? I attached the solution (
http://www.nabble.com/file/p19347724/jam_serialize.zip jam_serialize.zip )
along this message. Any guidance should be very helpful. Thank you!!!

gatotkaca





</description>
    <dc:creator>gatotkaca</dc:creator>
    <dc:date>2008-09-06T16:05:30</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39781">
    <title>[filesystem] [random] Demo code in August 2008 LinuxGazette</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39781</link>
    <description>All,

I just saw this article in the Linux Gazette ("Populating a Filesystem
with Random Data"), and thought that people looking for a fairly
simple example of boost might be interested:

http://linuxgazette.net/153/pfeiffer.html

Enjoy,
~ Scott
</description>
    <dc:creator>Scott McMurray</dc:creator>
    <dc:date>2008-09-06T17:45:52</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39774">
    <title>[lexical_cast] bad_lexical_cast behavior?</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39774</link>
    <description> From the documentation:
"If the conversion is unsuccessful, a  bad_lexical_cast exception is 
thrown. "
"Exception used to indicate runtime lexical_cast  failure. "

So the question is when will the conversion fail? Unit tests check for 
the cases between [min(), max()], but what about under/overflows (&gt;max, 
&lt;min)? Is it unspecified?

It seems it is currently handled a bit inconsistent:

#include &lt;boost/test/unit_test.hpp&gt;
#include &lt;boost/lexical_cast.hpp&gt;
#include &lt;limits.h&gt;
using std::string;
using std::numeric_limits;
using boost::lexical_cast;
string s;

// warning: needs to be a part of a unit test


//#define min max

#define T short
// add a digit!
s = lexical_cast&lt;string, T&gt;(numeric_limits&lt;T&gt;::min()) + "0";
BOOST_CHECK_THROW(lexical_cast&lt;T&gt;(s), boost::exception); // throws
s = lexical_cast&lt;string, T&gt;(numeric_limits&lt;T&gt;::min()) + "5";
BOOST_CHECK_THROW(lexical_cast&lt;T&gt;(s), boost::exception); // throws

#define T boost::int64_t
s = lexical_cast&lt;string, T&gt;(numeric_limits&lt;T&gt;::min()) + "0";
BOOST_CHECK_THROW(lexical_cast&lt;T&gt;(s), boost::exception); // NO throw!!!
s = lexical_cast&lt;string, T&gt;(numeric_limits&lt;T&gt;::min()) + "5";
BOOST_CHECK_THROW(lexical_cast&lt;T&gt;(s), boost::exception); // throws

The behavior is really weird.
The docs don't mention what should happen.
If I use max instead of min every test throws.

Is there something in boost that can convert a *whole* string to it's 
integer representation and throw on under/overflows and errors?


</description>
    <dc:creator>Hrvoje Prgeša</dc:creator>
    <dc:date>2008-09-06T15:16:40</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39773">
    <title>Crash when serializing binary object to XML archive</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39773</link>
    <description>Using Boost 1.36, I'm seeing a crash when serializing a 256K malloc  
block
using binary_object to an XML archive, something like this:

using namespace boost;

serialization::binary_object dataObject =
               serialization::make_binary_object(dataBlock, dataSize);
ar &lt;&lt; serialization::make_nvp("data_contents", dataObject);

The crash is in
boost::archive::iterators::transform_width&lt;char const*, 6, 8,  
char&gt;::fill ()

template&lt;class Base, int BitsOut, int BitsIn, class CharType&gt;
CharType transform_width&lt;Base, BitsOut, BitsIn, CharType&gt;::fill(){
    CharType retval = 0;
    unsigned int missing_bits = BitsOut;
    for(;;){
        unsigned int bcount;
        if(! m_bufferfull){
            m_buffer = * this-&gt;base_reference();  &lt;-------- crash here
            m_bufferfull = true;
            bcount = BitsIn;
        }
        else
            ...

and the stack back up to my object serialization looks like:

#0  0x0008f12e in boost::archive::iterators::transform_width&lt;char  
const*, 6, 8, char&gt;::fill () at transform_width.hpp:139
#1  0x0008f12e in boost::archive::iterators::transform_width&lt;char  
const*, 6, 8, char&gt;::dereference_impl () at transform_width.hpp:71
#2  0x0008f12e in  
boost::iterator_facade&lt;boost::archive::iterators::transform_width&lt;char  
const*, 6, 8, char&gt;, char, boost::single_pass_traversal_tag, char,  
int&gt;::operator* () at transform_width.hpp:78
#3  0x0008f12e in  
dereference&lt;boost::archive::iterators::transform_width&lt;const char*, 6,  
8, char&gt; &gt; [inlined] () at transform_width.hpp:137
#4  0x0008f12e in boost::archive::iterators::transform_width&lt;char  
const*, 6, 8, char&gt;::dereference () at transform_width.hpp:635
#5  0x0008f12e in  
boost 
::iterator_facade 
&lt; 
boost 
::transform_iterator 
&lt;boost::archive::iterators::detail::from_6_bit&lt;char&gt;,  
boost::archive::iterators::transform_width&lt;char const*, 6, 8, char&gt;,  
boost::use_default, boost::use_default&gt;, char,  
boost::single_pass_traversal_tag, char, int&gt;::operator* () at  
transform_width.hpp:517
#6  0x0008f12e in  
dereference 
&lt; 
boost 
::transform_iterator 
&lt;boost::archive::iterators::detail::from_6_bit&lt;char&gt;,  
boost::archive::iterators::transform_width&lt;const char*, 6, 8, char&gt;,  
boost::use_default, boost::use_default&gt; &gt; [inlined] () at  
transform_width.hpp:80
#7  0x0008f12e in  
boost 
::transform_iterator 
&lt;boost::archive::iterators::detail::from_6_bit&lt;char&gt;,  
boost::archive::iterators::transform_width&lt;char const*, 6, 8, char&gt;,  
boost::use_default, boost::use_default&gt;::dereference () at  
transform_width.hpp:635
#8  0x0008f12e in  
boost 
::archive 
::iterators 
::insert_linebreaks 
&lt; 
boost 
::archive 
::iterators 
::base64_from_binary&lt;boost::archive::iterators::transform_width&lt;char  
const*, 6, 8, char&gt;, char&gt;, 72, char const&gt;::dereference () at  
insert_linebreaks.hpp:517
#9  0x0008f12e in  
dereference 
&lt; 
boost 
::archive 
::iterators 
::insert_linebreaks 
&lt; 
boost 
::archive 
::iterators 
::base64_from_binary&lt;boost::archive::iterators::transform_width&lt;const  
char*, 6, 8, char&gt;, char&gt;, 72, const char&gt; &gt; [inlined] () at  
insert_linebreaks.hpp:517
#10 0x0008f12e in  
boost 
::iterator_facade 
&lt; 
boost 
::archive 
::iterators 
::insert_linebreaks 
&lt; 
boost 
::archive 
::iterators 
::base64_from_binary&lt;boost::archive::iterators::transform_width&lt;char  
const*, 6, 8, char&gt;, char&gt;, 72, char const&gt;, char const,  
boost::single_pass_traversal_tag, char const, int&gt;::operator* () at  
iterator_facade.hpp:635
#11 0x0008f12e in  
copy 
&lt; 
boost 
::archive 
::iterators 
::insert_linebreaks 
&lt; 
boost 
::archive 
::iterators 
::base64_from_binary&lt;boost::archive::iterators::transform_width&lt;const  
char*, 6, 8, char&gt;, char&gt;, 72, const char&gt;,  
boost::archive::iterators::ostream_iterator&lt;char&gt; &gt; [inlined] () at  
iterator_facade.hpp:270
#12 0x0008f12e in  
copy 
&lt; 
boost 
::archive 
::iterators 
::insert_linebreaks 
&lt; 
boost 
::archive 
::iterators 
::base64_from_binary&lt;boost::archive::iterators::transform_width&lt;const  
char*, 6, 8, char&gt;, char&gt;, 72, const char&gt;,  
boost::archive::iterators::ostream_iterator&lt;char&gt; &gt; [inlined] () at  
iterator_facade.hpp:270
#13 0x0008f12e in  
boost::archive::basic_text_oprimitive&lt;std::ostream&gt;::save_binary  
(this=0xbffff178, address=0x423000, count=262144) at libs/ 
serialization/src/basic_text_oprimitive.cpp:317
#14 0x000aaae4 in  
boost 
::archive 
::xml_oarchive_impl&lt;boost::archive::xml_oarchive&gt;::save_binary  
(this=0xbffff168, address=0x463000, count=4599808) at libs/ 
serialization/src/basic_text_oprimitive.cpp:317
#15 0x00054032 in  
boost 
::serialization::binary_object::save&lt;boost::archive::xml_oarchive&gt;  
(this=0xbfffe730, ar=&lt; at &gt;0xbffff168) at libs/serialization/src/ 
basic_text_oprimitive.cpp:317
#16 0x00054059 in  
boost 
::serialization::access::member_save&lt;boost::archive::xml_oarchive,  
boost::serialization::binary_object const&gt; (ar=&lt; at &gt;0xbffff168,  
t=&lt; at &gt;0xbfffe730, file_version=0) at libs/serialization/src/ 
basic_text_oprimitive.cpp:317
#17 0x00054081 in  
boost 
::serialization::detail::member_saver&lt;boost::archive::xml_oarchive,  
boost::serialization::binary_object&gt;::invoke (ar=&lt; at &gt;0xbffff168,  
t=&lt; at &gt;0xbfffe730, file_version=0) at libs/serialization/src/ 
basic_text_oprimitive.cpp:317
#18 0x000540a9 in  
boost::serialization::split_member&lt;boost::archive::xml_oarchive,  
boost::serialization::binary_object&gt; (ar=&lt; at &gt;0xbffff168, t=&lt; at &gt;0xbfffe730,  
file_version=0) at libs/serialization/src/basic_text_oprimitive.cpp:317
#19 0x000540d1 in  
boost 
::serialization 
::binary_object::serialize&lt;boost::archive::xml_oarchive&gt;  
(this=0xbfffe730, ar=&lt; at &gt;0xbffff168, file_version=0) at libs/ 
serialization/src/basic_text_oprimitive.cpp:317
#20 0x000540f9 in  
boost::serialization::access::serialize&lt;boost::archive::xml_oarchive,  
boost::serialization::binary_object&gt; (ar=&lt; at &gt;0xbffff168, t=&lt; at &gt;0xbfffe730,  
file_version=0) at libs/serialization/src/basic_text_oprimitive.cpp:317
#21 0x00054121 in  
boost::serialization::serialize&lt;boost::archive::xml_oarchive,  
boost::serialization::binary_object&gt; (ar=&lt; at &gt;0xbffff168, t=&lt; at &gt;0xbfffe730,  
file_version=0) at libs/serialization/src/basic_text_oprimitive.cpp:317
#22 0x00054165 in  
boost::serialization::serialize_adl&lt;boost::archive::xml_oarchive,  
boost::serialization::binary_object&gt; (ar=&lt; at &gt;0xbffff168, t=&lt; at &gt;0xbfffe730,  
file_version=0) at libs/serialization/src/basic_text_oprimitive.cpp:317
#23 0x0005418e in  
boost 
::archive::detail::save_non_pointer_type&lt;boost::archive::xml_oarchive,  
boost::serialization::binary_object&gt;::save_only::invoke  
(ar=&lt; at &gt;0xbffff168, t=&lt; at &gt;0xbfffe730) at libs/serialization/src/ 
basic_text_oprimitive.cpp:317
#24 0x000541ae in  
boost 
::archive::detail::save_non_pointer_type&lt;boost::archive::xml_oarchive,  
boost::serialization::binary_object&gt;::invoke (ar=&lt; at &gt;0xbffff168,  
t=&lt; at &gt;0xbfffe730) at libs/serialization/src/basic_text_oprimitive.cpp:317
#25 0x000541ce in boost::archive::save&lt;boost::archive::xml_oarchive,  
boost::serialization::binary_object&gt; (ar=&lt; at &gt;0xbffff168, t=&lt; at &gt;0xbfffe730)  
at libs/serialization/src/basic_text_oprimitive.cpp:317
#26 0x000541f8 in  
boost 
::archive 
::detail 
::common_oarchive 
&lt; 
boost 
::archive 
::xml_oarchive&gt;::save_override&lt;boost::serialization::binary_object  
const&gt; (this=0xbffff168, t=&lt; at &gt;0xbfffe730) at libs/serialization/src/ 
basic_text_oprimitive.cpp:317
#27 0x00054242 in  
boost 
::archive 
::basic_xml_oarchive 
&lt; 
boost 
::archive 
::xml_oarchive&gt;::save_override&lt;boost::serialization::binary_object&gt;  
(this=0xbffff168, t=&lt; at &gt;0xbfffe738) at libs/serialization/src/ 
basic_text_oprimitive.cpp:317
#28 0x0005428e in  
boost 
::archive 
::detail::interface_oarchive&lt;boost::archive::xml_oarchive&gt;::operator&lt;&lt;  
&lt;boost::serialization::nvp&lt;boost::serialization::binary_object&gt; const&gt;  
(this=0xbffff168, t=&lt; at &gt;0xbfffe738) at libs/serialization/src/ 
basic_text_oprimitive.cpp:317
#29 0x00054301 in MacTierra::Soup::save&lt;boost::archive::xml_oarchive&gt;  
(this=0x500880, ar=&lt; at &gt;0xbffff168, version=0) at libs/serialization/src/ 
basic_text_oprimitive.cpp:317
#30 0x0005432b in  
boost 
::serialization::access::member_save&lt;boost::archive::xml_oarchive,  
MacTierra::Soup const&gt; (ar=&lt; at &gt;0xbffff168, t=&lt; at &gt;0x500880, file_version=0)  
at libs/serialization/src/basic_text_oprimitive.cpp:317
#31 0x00054353 in  
boost 
::serialization::detail::member_saver&lt;boost::archive::xml_oarchive,  
MacTierra::Soup&gt;::invoke (ar=&lt; at &gt;0xbffff168, t=&lt; at &gt;0x500880, file_version=0)  
at libs/serialization/src/basic_text_oprimitive.cpp:317
#32 0x0005437b in  
boost::serialization::split_member&lt;boost::archive::xml_oarchive,  
MacTierra::Soup&gt; (ar=&lt; at &gt;0xbffff168, t=&lt; at &gt;0x500880, file_version=0) at libs/ 
serialization/src/basic_text_oprimitive.cpp:317
#33 0x000543a3 in  
MacTierra::Soup::serialize&lt;boost::archive::xml_oarchive&gt;  
(this=0x500880, ar=&lt; at &gt;0xbffff168, file_version=0) at libs/serialization/ 
src/basic_text_oprimitive.cpp:317

This is on Mac OS X, using gcc 4.0, compiling for intel.

Has anyone seen this crash? Should I reduce and file a bug?

Simon
</description>
    <dc:creator>Simon Fraser</dc:creator>
    <dc:date>2008-09-06T07:09:41</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39769">
    <title>Newbie: Compiling multi filed programs</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39769</link>
    <description>Still trying to get a grip on Boost with some toy problems.   I have a very simple program that multiplies two vectors.  It worked as a single file program, but doesn't work as a multi file program.  I'm finding it difficult to deal with impressive looking templates in the compiler error messages.   This is on Linux, g++, Debian testing.



09-prob.h:
=======
#pragma once

#include &lt;boost/numeric/ublas/matrix.hpp&gt;
#include &lt;boost/numeric/ublas/vector.hpp&gt;
#include &lt;boost/numeric/ublas/io.hpp&gt;

using namespace boost::numeric::ublas;

// n-vector outer product: |u&gt;&lt;v|
template&lt;class E1, class E2&gt;
typename vector_matrix_binary_traits&lt;E1, E2,scalar_multiplies&lt;typename E1::value_type, typename E2::value_type&gt; &gt;::result_type
mult_vector_vector( E1 bra, E2 ket );



09-prob.cpp:
=========
#include "09-prob.h"

template&lt;class E1, class E2&gt;
typename vector_matrix_binary_traits&lt;E1, E2,scalar_multiplies&lt;typename E1::value_type, typename E2::value_type&gt; &gt;::result_type
mult_vector_vector( E1 bra, E2 ket )
{
   return outer_prod(bra, ket);
}



09-driver.cpp:
==========
#include "09-prob.h"
using std::cout;
using std::endl;


int main( void )
{
   using boost::numeric::ublas::vector; // Use Boost's vector, not STL's.
   vector&lt;double&gt; u(3), v(3);
   for( unsigned i = 0;  i &lt; u.size(); ++i ) {
      u(i) = static_cast&lt;double&gt;(i);
      v(i) = u(i) * u(i);
   }


   // Test mult_vector_vector
   //
   cout &lt;&lt; mult_vector_vector(u, v) &lt;&lt; endl;
   return 0;
}


And the error message:

g++  -g3 -Wall -Wextra -Waggregate-return -Wpointer-arith -Weffc++ -Wcast-qual -Wcast-align -Wmissing-declarations -Wredundant-decls -Wwrite-strings -Winline  -c -o 09-driver.o 09-driver.cpp
g++   09-prob.o 09-driver.o   -o 09-prob
09-driver.o: In function `main':
/home/p/Baruch/numla/hw1/09-driver.cpp:29: undefined reference to `boost::numeric::ublas::vector_matrix_binary_traits&lt;boost::numeric::ublas::vector&lt;double, boost::numeric::ublas::unbounded_array&lt;double, std::allocator&lt;double&gt; &gt; &gt;, boost::numeric::ublas::vector&lt;double, boost::numeric::ublas::unbounded_array&lt;double, std::allocator&lt;double&gt; &gt; &gt;, boost::numeric::ublas::scalar_multiplies&lt;boost::numeric::ublas::vector&lt;double, boost::numeric::ublas::unbounded_array&lt;double, std::allocator&lt;double&gt; &gt; &gt;::value_type, boost::numeric::ublas::vector&lt;double, boost::numeric::ublas::unbounded_array&lt;double, std::allocator&lt;double&gt; &gt; &gt;::value_type&gt; &gt;::result_type mult_vector_vector&lt;boost::numeric::ublas::vector&lt;double, boost::numeric::ublas::unbounded_array&lt;double, std::allocator&lt;double&gt; &gt; &gt;, boost::numeric::ub
 las::vector&lt;double, boost::numeric::ublas::unbounded_array&lt;double, std::allocator&lt;double&gt; &gt; &gt; &gt;(boost::numeric::ublas::vector&lt;double,
 boost::numeric::ublas::unbounded_array&lt;double, std::allocator&lt;double&gt; &gt; &gt;, boost::numeric::ublas::vector&lt;double, boost::numeric::ublas::unbounded_array&lt;double, std::allocator&lt;double&gt; &gt; &gt;)'
collect2: ld returned 1 exit status
make: *** [09-prob] Error 1


Since 09-driver.o and 09-prob.o are being linked together, I'm guessing there's something wrong with the function signature?

Can some kind soul give me a few hints on how to make this work?

Thanks!



~
</description>
    <dc:creator>Pete</dc:creator>
    <dc:date>2008-09-05T18:08:49</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39768">
    <title>globals best-practices (avoiding multiple definitions)</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39768</link>
    <description>Hi -

I'm trying to understand the best practice for handling globals (within a namespace), and in particular, avoiding multiple definitions (whether multiple "private" copies or collisions causing a linker error).

For namespace globals, if I do something like this (in a header file):

  namespace log_categories
  {
    static log_t server(log_t::category("http.server.server"));
  }

I'd guess that each translation unit (TU) would get its own copy of log_categories::server (or maybe some compilers give a multiple-definition link error, while others would just make multiple private copies?). OTOH, if I only declared the variable and put the definition in a c++ file, there would only be a single copy.

For class static members, you cannot initialize the members "in-line" (unless it's an integral constant).

One interesting "work-around" I saw in asio/error.hpp was this:

namespace boost { ...

  static const boost::system::error_category&amp; system_category
    = boost::asio::error::get_system_category();
...

This way, there might be multiple copies but they will all be references to the same underlying object.

For the case of class template static members, I found this example in complex.hpp:

namespace boost { namespace numeric
{
    namespace detail
    {
        template&lt;typename T&gt;
        struct one_complex
        {
            static std::complex&lt;T&gt; const value;
        };

        template&lt;typename T&gt;
        std::complex&lt;T&gt; const one_complex&lt;T&gt;::value
          = std::complex&lt;T&gt;(numeric::one&lt;T&gt;::value, numeric::one&lt;T&gt;::value);
    }
...

Is it guaranteed that there will only be one instance of one_complex&lt;T&gt;::value for each T, even if this header file is included in multiple TU's? In this case it doesn't matter (it's a constant), but in other cases I need to ensure that it's a true singleton.

Is there a good resource on best-practices for this? I've been bitten by the "multiple-definition" bug in several guises before (eg: in windows when there were multiple libraries linking to the same dll). I googled, and saw suggestions from, say, DEC (http://www.helsinki.fi/atk/unix/dec_manuals/cxx_6.0/cxx570_ug_004.html), which were to put template definitions in separate "template definition files." I take it complex.hpp is best-practice (standards-compatible, portable, etc - at least with certain options set on a particular vendor's compiler, say, automatic template instantiation)?

Handling declarations vs definitions of template specializations seems even more fraught, but thankfully I don't have to worry about that for now (plus, it would certainly simplify things to always keep both template decls and defs in the same header file).

thanks,
--craig
</description>
    <dc:creator>craigp</dc:creator>
    <dc:date>2008-09-06T10:49:59</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39766">
    <title>More bimap issues</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39766</link>
    <description>Hi: 
I have the following code:
struct VectorComp
{
bool operator()(const std::vector&lt;std::bitset&lt;6&gt;&gt;&amp; lhs, const
std::vector&lt;std::bitset&lt;6&gt;&gt;&amp; rhs) const
    {
        return false;
    }
};
typedef
boost::bimaps::bimap&lt;boost::bimaps::set_of&lt;std::vector&lt;std::bitset&lt;6&gt;&gt;,
VectorComp&gt;, int&gt; SignsList_Type; 
SignsList_Type SignsList; 
When compiling this code, I get c2676 errors from visual studio:
8 error C2676: binary '&lt;' : 'const std::bitset&lt;_Bits&gt;' does not define
this operator or a conversion to a type acceptable to the  functional
143 
I have BitsetComp which successfully compares two std::bitsets. How do I
insert this so that my code works succesfully?
Cheers
Sean.
 

__________ Information from ESET NOD32 Antivirus, version of virus
signature database 3421 (20080906) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
</description>
    <dc:creator>Sean Farrow</dc:creator>
    <dc:date>2008-09-06T08:33:30</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39764">
    <title>[string_algo] implementation functor for classification predicates doesn't implement result_of</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39764</link>
    <description>The implementation functor for the String Algorithms library's classification
predicates ( boost::algorithm::detail::is_classifiedF in
boost/algorithm/string/detail/classification.hpp ) doesnt have a result_type
typedef or a result struct. Consequently the classification predicates do not
work with boost::bind. For a future release of Boost, please add 'typedef bool
result_type;' into the struct.
</description>
    <dc:creator>Adam Merz</dc:creator>
    <dc:date>2008-09-05T23:04:23</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39760">
    <title>Warning c4002 with boost_foreach</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39760</link>
    <description>Hi: 
Could somebody please tell me why I get a warning c4002 with the
following boost::foreach declaration?
BOOST_FOREACH(
boost::bimaps::bimap&lt;boost::bimaps::set_of&lt;std::vector&lt;std::bitset&lt;6&gt;&gt;&gt;,
int&gt;::left_reference CurrentSign, SignsList.left )
Should I use a typedef instead?
Sean.
 

__________ Information from ESET NOD32 Antivirus, version of virus
signature database 3420 (20080905) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
</description>
    <dc:creator>Sean Farrow</dc:creator>
    <dc:date>2008-09-05T22:27:49</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39748">
    <title>comparing objects using boost</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39748</link>
    <description>_______________________________________________
Boost-users mailing list
Boost-users&lt; at &gt;lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users</description>
    <dc:creator>Reena Dass</dc:creator>
    <dc:date>2008-09-05T17:47:53</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39746">
    <title>newbie: initializing a matrix</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39746</link>
    <description>The examples I've seen construct matrices using for loops, like:


    matrix&lt;double&gt; m (3, 3);
    for (unsigned i = 0; i &lt; m.size1 (); ++ i)
        for (unsigned j = 0; j &lt; m.size2 (); ++ j)
            m (i, j) = 3 * i + j;


but that's inconvenient.  I have a matrix in mind, say:


double foo[3][3] = {  { 1.0, 2.0, 3.0 }, { 2.0, 9.3, 8.1 }, { 3.0, 5.0, 2.3 } };
Is it possible to initialize a matrix&lt;double&gt; from a double[][]?   How does one create a matrix without resorting to for loops or via n^2 assignments in the code?

Thanks!
</description>
    <dc:creator>Pete</dc:creator>
    <dc:date>2008-09-05T17:09:58</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39745">
    <title>[program_options] Specific sections for options -lack of documentation</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39745</link>
    <description>I have absolutely loved the program_options library, and thank those who developed it so well and comprehensive. I love the config file parsing, but am confused on how to implement specific sections. The documentation speaks of parsing through sections of the config file on the following page.

Library Overview --&gt; Specific parsers --&gt; Configuration file parser
http://www.boost.org/doc/libs/1_36_0/doc/html/program_options/overview.html#id3452595

However there is no discussion on how to setup some option that is part of a specific section. How can I do this and how will it affect the command line options? I noticed that boost_1_35_0/boost/program_options/detail/config_file.hpp talks about this functionality a little more.

I appreciate any help with this, and would especially enjoy code snippets that illustrate creating options that belong to a section.
</description>
    <dc:creator>Ken Johnson</dc:creator>
    <dc:date>2008-09-05T17:08:48</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39744">
    <title>[Thread]Deadlock using shared_mutex with unique_lock</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39744</link>
    <description>_______________________________________________
Boost-users mailing list
Boost-users&lt; at &gt;lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users</description>
    <dc:creator>Stanislav Stoyanov</dc:creator>
    <dc:date>2008-09-05T16:07:56</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39743">
    <title>Boost.MPL.Vector -&gt; Boost.Tuple</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39743</link>
    <description>_______________________________________________
Boost-users mailing list
Boost-users&lt; at &gt;lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users</description>
    <dc:creator>Олег Царев</dc:creator>
    <dc:date>2008-09-05T16:04:58</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39740">
    <title>[lambda] Making my expression less complicated</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39740</link>
    <description>Hello,

In my test program below, I have a container of columns and want to output the column headers into a string separated by a tab. The lambda expression is looking fairly complicated so I wonder if it could be made simpler or if there's any other algorithm I should've used to put a separator between the elements?

Regards,

Pete

#include &lt;algorithm&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;vector&gt;

#include &lt;boost/lambda/bind.hpp&gt;
#include &lt;boost/lambda/lambda.hpp&gt;
#include &lt;boost/lambda/if.hpp&gt;

class Column
{
public:
explicit Column(const std::string&amp; str) : str_(str) {}
const std::string&amp; getColumnText() const {return str_;}
private:
std::string str_;
};

int main()
{

using namespace boost::lambda;
using boost::lambda::_1;

std::vector&lt;Column&gt; cols;
cols.push_back(Column("Fred"));
cols.push_back(Column("Jim"));
cols.push_back(Column("Harry"));
const std::size_t numCols = static_cast&lt;size_t&gt;(cols.size());

const char fieldSeparator = '\t';

std::string outputText;

std::size_t i = 1;
var_type&lt;std::size_t&gt;::type iV(var(i));
std::for_each(cols.begin(),cols.end(),
(
var(outputText) += bind(&amp;Column::getColumnText,_1),
if_then(iV &lt; constant(numCols),var(outputText) += constant(fieldSeparator)),
++iV
)
);

std::cout &lt;&lt; '[' &lt;&lt; outputText &lt;&lt; ']';
}
</description>
    <dc:creator>Peter Barker</dc:creator>
    <dc:date>2008-09-05T16:30:42</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39732">
    <title>graph all pair shortest path problem</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39732</link>
    <description>Hi *,

I have a question about the All Pair Shortest Path (Johnson) algorithm.

Here is my code:

#include &lt;boost/config.hpp&gt;
#include &lt;fstream&gt;
#include &lt;iostream&gt;
#include &lt;iomanip&gt;
#include &lt;vector&gt;
#include &lt;boost/property_map.hpp&gt;
#include &lt;boost/graph/adjacency_list.hpp&gt;
#include &lt;boost/graph/johnson_all_pairs_shortest.hpp&gt;

int main() {
using namespace boost;

typedef property&lt;vertex_index_t, int, property&lt;vertex_name_t,  
std::string&gt; &gt;
VertexProperty;

typedef property&lt;edge_weight_t, int, property&lt;edge_weight2_t, int&gt; &gt;
EdgeProperty;

typedef property&lt;graph_name_t, std::string&gt; GraphProperty;
//adjacency_list&lt;OutEdgeList, VertexList, Directed,
//             VertexProperties, EdgeProperties,
//           GraphProperties, EdgeList&gt;
typedef adjacency_list&lt;listS, listS, undirectedS, VertexProperty,
EdgeProperty, GraphProperty&gt; Graph;

boost::graph_traits&lt;Graph&gt;::vertex_descriptor u, v, w, first, second;


int N = 10;
Graph g;

first = add_vertex(g);
put(vertex_index, g, first, num_vertices(g));

second = add_vertex(g);
put(vertex_index, g, second, num_vertices(g));

add_edge(first, second, g);

u = first;
v = second;
for (int i = 2; i &lt; N; i++) {
w = add_vertex(g);
put(vertex_index, g, w, i + 1);
add_edge(u, w, g);
add_edge(v, w, g);
u = v;
v = w;
}
add_edge(u, first, g);
add_edge(v, second, g), add_edge(v, first, g);
std::cout &lt;&lt; "Finished to build Graph" &lt;&lt; std::endl;


//set weights to 1
typedef graph_traits&lt;Graph&gt;::edge_iterator EdgeIterator;
EdgeIterator ei, edge_end;
for ( boost::tie(ei, edge_end) = edges(g); ei != edge_end; ++ei){
put(edge_weight, g, *ei, 1);
}


std::vector&lt;int&gt; d(N, (std::numeric_limits&lt;int&gt;::max)());
int D[N][N];
johnson_all_pairs_shortest_paths(g, D, distance_map(&amp;d[0]));

std::cout &lt;&lt; "     ";
for (int k = 0; k &lt; N; ++k)
std::cout &lt;&lt; std::setw(5) &lt;&lt; k;
std::cout &lt;&lt; std::endl;
for (int i = 0; i &lt; N; ++i) {
std::cout &lt;&lt; i &lt;&lt; " -&gt; ";
for (int j = 0; j &lt; N; ++j) {
if (D[i][j] &gt; 20 || D[i][j] &lt; -20)
std::cout &lt;&lt; std::setw(5) &lt;&lt; "inf";
else
std::cout &lt;&lt; std::setw(5) &lt;&lt; D[i][j];
}
std::cout &lt;&lt; std::endl;
}


return 0;
}


When I compile  I get the error:
../src/BGLTest.cpp: In function 'int main()':
../src/BGLTest.cpp:73: error: no matching function for call to  
'johnson_all_pairs_shortest_paths(main()::Graph&amp;, int [(((long  
unsigned int)(((int)N) - 1)) + 1u)][(((long unsigned int)(((int)N) -  
1)) + 1u)], boost::bgl_named_params&lt;int*, boost::vertex_distance_t,  
boost::no_property&gt;)'

What does that mean? I want to use the Johnson algorithm with a listS  
= Vertexlist and listS = Egelist.   With listS, vecS as in your  
example it works fine. What can I do?

Thanks in advance,
Nico
</description>
    <dc:creator>Nicolas Heine</dc:creator>
    <dc:date>2008-09-05T14:07:55</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39731">
    <title>[timer] eclapsed return zero</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39731</link>
    <description>_______________________________________________
Boost-users mailing list
Boost-users&lt; at &gt;lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users</description>
    <dc:creator>gmail</dc:creator>
    <dc:date>2008-09-05T11:15:07</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39730">
    <title>Closures emulation made easy</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39730</link>
    <description>Hi.

Here's a trick.

Use the idea of Boost.ScopeExit. But don't implement capturing of variables 
like in Boost.ScopeExit - use Boost.Bind which does it.

Have easy to write and debug closure body - don't spend too much time on 
making Boost.Lamda work.
And a compact implementation with very small proprocessor overhead, compared 
to Boost.ScopeExit.

// Implementation

#define CONCATENATE_DIRECT(s1, s2) s1##s2
#define CONCATENATE(s1, s2) CONCATENATE_DIRECT(s1, s2)
#define ANONYMOUS_VARIABLE(str) CONCATENATE(str, __LINE__)

#define LOCAL(R, P) \
  typedef struct ANONYMOUS_VARIABLE(xg1) { \
    typedef R(*F) P; static R body P {

#define LOCAL_END(name) \
  } } ANONYMOUS_VARIABLE(xg2); \
  const ANONYMOUS_VARIABLE(xg2)::F name \
    = ANONYMOUS_VARIABLE(xg2)::body;

// Example

#include &lt;algorithm&gt;

int main()
{
  LOCAL(bool, (int i, int j, bool reverse))
    return reverse ? (j &lt; i) : (i &lt; j);
  LOCAL_END(myFcn)
  int a[] = { 2, 5, 1, 6 };
  std::sort(
    a,
    a + sizeof(a)/sizeof(a[0]),
    boost::bind(myFcn, _1, _2, true));
}
</description>
    <dc:creator>Alexander Gutenev</dc:creator>
    <dc:date>2008-09-05T08:43:35</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39729">
    <title>wrap native C++ DLL used Boost libs, into .NET</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39729</link>
    <description>Hello!

I need to use a DLL used Boost, in .NET projects.
I wrapped this lib, but I cannot use the wrapping, because
          System.BadImageFormatException
          (is not a valid Win32 application. (Exception from HRESULT: 0x800700C1))
raises at once, if I executing an
application using the wrap.

Wrap scheme:    Native DLL --- .NET Class Library --- .NET Project.
I'm wrapping every class in native DLL into .NET class. I using some
principles from the "Expert C++/CLI: .NET for Visual C++ Programmers"
by Marcus Heege.

When I wrote a small test project, I discovered that if I only include
anyone Boost header into native DLL, it set the
System.BadImageFormatException permanently.
Without Boost wrapping works perfectly.

I use:
Boost 1.35.0
Visual Stidio 2005 SP1, 2008 - same results in all cases.
Windows XP SP2 x86.

I found same problems in Internet - impossible to wrap native DLLs, used
Boost. All this problems were unsolved.
Such as: http://objectmix.com/dotnet/121318-not-valid-win32-application-exception-hresult-0x800700c1.html



</description>
    <dc:creator>aidforsoft&lt; at &gt;mail.ru</dc:creator>
    <dc:date>2008-09-05T06:47:08</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39727">
    <title>newbie: debugging programs with boost</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39727</link>
    <description>Hi all,

I'm having trouble using GDB with my program that uses boost.  In GDB (bra
is a vector&lt;double&gt;):

   (gdb) print bra(j)
   Invalid data type for function to be called.

I've compiled my program with -g3.  How can I peek at boost datatypes?

Thanks!
</description>
    <dc:creator>p&lt; at &gt;dirac.org</dc:creator>
    <dc:date>2008-09-05T04:31:54</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lib.boost.user/39721">
    <title>Boost.Multiindex namespace problem</title>
    <link>http://comments.gmane.org/gmane.comp.lib.boost.user/39721</link>
    <description>Hello

I m using boost 1.35 and g++ v4.1.3 20070929 (Ubuntu 4.1.2-16ubuntu2) on 
ubuntu gutsy, I have a problem when using multindex namespaces.

This compiles without problem : (this is in a class)

using namespace boost::multi_index ;
class myClass
{
    public:
        struct foo
        {
            public:
                int getLocalDataId() ;
        } ;
    typedef hashed_unique&lt;boost::multi_index::mem_fun&lt;foo, int, 
&amp;foo::getLocalDataId&gt; &gt; myIndex ;
};

But the same code without the prefix "boost::multi_index" doesnt compile :
typedef hashed_unique&lt;mem_fun&lt;foo, int, &amp;foo::getLocalDataId&gt; &gt; myIndex ;

I can obviously add the namespace before mem_fun, I just wonder why this 
compile error occurs.
Thanks in advance.
</description>
    <dc:creator>Axel</dc:creator>
    <dc:date>2008-09-05T12:56:30</dc:date>
  </item>
  <textinput about="http://search.gmane.org/?group=$group=gmane.comp.lib.boost.user">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.lib.boost.user</link>
  </textinput>
</rdf:RDF>
