Cliff Green | 1 Feb 01:06

Re: Transferring files across a network.

> I now have a client and a server that can handle multiple files being
> sent over the network. The files are attached for your interest. If
> anyone can improve them I really will welcome their comments.
>
> If there is a need, it is Ok to include them as examples in the ASIO
> documentation. I have no issues with this.

I mentioned this before, but here goes again - the following:

sizeof(buffer_)

should be:

buffer_.size()

Alignment or padding on some compilers might cause sizeof(buffer_) to be 
incorrect (different than buffer_size(), although it's probably rare).

Cliff
Max | 1 Feb 02:28
Favicon

Re: [traits] Type of class of member function pointer

> >>> perhaps more out of exercise, but does any of you know whether it is
> >>> possible to get to the type of the class of a member function pointer?
> >>>
> >>> I.e., to somehow get to type T in "R (T::*)()"? (in this particular
> >>>
> > case, a
> >
> >>> member function without arguments in class T returning R)?
> >>>
> >>>
> >> Look at the FunctionTypes library.
> >
> > I've skimmed over the doc, but still not found the weapon.
> > :-(
> 
> For member function pointers, the class is treated as the first argument.
> boost::mpl::at_c<parameter_types<R(T::*)(), boost::mpl::identity<> >,
> 0>::type
> 
> In Christ,
> Steven Watanabe

Cool! Thanks.
I'll have a closer look at the doc and try to dissect the expression.

B/Rgds
Max
Andrew Maclean | 1 Feb 04:13
Picon

Re: Transferring files across a network.

Thanks for that I forgot about it!

Andrew

On Sun, Feb 1, 2009 at 11:06 AM, Cliff Green <cliffg <at> codewrangler.net> wrote:
>> I now have a client and a server that can handle multiple files being
>> sent over the network. The files are attached for your interest. If
>> anyone can improve them I really will welcome their comments.
>>
>> If there is a need, it is Ok to include them as examples in the ASIO
>> documentation. I have no issues with this.
>
> I mentioned this before, but here goes again - the following:
>
> sizeof(buffer_)
>
> should be:
>
> buffer_.size()
>
> Alignment or padding on some compilers might cause sizeof(buffer_) to be
> incorrect (different than buffer_size(), although it's probably rare).
>
> Cliff
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users <at> lists.boost.org
(Continue reading)

Kamil Zubair | 1 Feb 06:09
Picon
Favicon

Bls: Do "entire range" standard algorithms already exist


Phoenix has complete wrapper for std algorithm using range. It uses a functional programming style so the syntax is a bit different but not much. In your case the code would look like this :

V_INT::iterator it = boost::phoenix::find_if(_1, std::bind2nd(std::equal_to<int>(), 2))(v);

you can read phoenix documentation at BOOST_ROOT/libs/spirit/phoenix/index.html
--- Pada Jum, 30/1/09, Kirk Korver <kkorver <at> control4.com> menulis:
Dari: Kirk Korver <kkorver <at> control4.com>
Topik: [Boost-users] Do "entire range" standard algorithms already exist
Kepada: boost-users <at> lists.boost.org
Tanggal: Jumat, 30 Januari, 2009, 11:19 PM

Group,

I recently found the boost::range library. It seems very useful.

An annoyance that I have with STL algorithms is that they are very verbose. Most of the time I need to do something over the entire range. I'm sure I'm not alone here.

 

At any rate, I can easily do this:

  

template< typename Range, typename Pred >
inline typename boost::range_iterator<Range>::type
find_if( Range& c, Pred pred )
{
    return std::find_if( boost::begin( c ), boost::end( c ), pred );
}

 

Which then allows me to do this:

 

void foo()

{

    typedef std::vector <int> V_INT;
    V_INT v;
    v.push_back(1);
    v.push_back(2);
    v.push_back(3);

 

    V_INT::iterator it = find_if(v, std::bind2nd(std::equal_to<int>(), 2));

}

 

Perfect. Exactly what I want. Search the entire vector, and I give it a predicate.

 

I could easily create these functions for copy_if, erase_if, find_if, and for_each.

 

My question:

Do I need to go ahead and create the tiny wrapper functions, or do they already exist somewhere in Boost? If they exist already, I prefer to use those.

 

Thank you in advance,

Kirk

 

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

Apakah wajar artis ikut Pemilu?
Temukan jawabannya di Yahoo! Answers!
_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
John Maddock | 1 Feb 10:49
Picon

Re: Cosmetic warning in gcc 4.3

>I foudn that the following lines int he following files generates a huge
> amount of spurious warning in gcc 4.3 with -Wall  :
>
> /boost/math/special_functions/gamma.hpp
>
> line  1264:   tgamma1pm1(T z, const Policy& /* pol */)
>
> /boost/function_types/detail/pp_retag_default_cc/preprocessed.hpp
>
> line 18
> BOOST_STATIC_CONSTANT(bits_t, value = (
>    (::boost::function_types::detail::bits<Tag> ::value & 0x00008000 )
>    |( ::boost::function_types::detail::bits<RefTag> ::value & 802)
>    ));
>
>
> /boost/function_types/detail/pp_tags/preprocessed.hpp
>
> line 56
> BOOST_STATIC_CONSTANT(bits_t, combined_bits =
>             (LHS_bits & ~RHS_mask) | RHS_bits
> );
>
> The later was signaled as a ticket in trac but I wanted to know if it
> was fixed/merged in the upcoming 1.38.

Seems to be, but there's another warning from Boost.Fusion: I'll file a Trac 
issue on that,

John. 
Olivier Tournaire | 1 Feb 11:13
Picon

Calling a function in a defined time intervall

Hi all,

I would like to know how can I call a member function each x miliseconds, during a given time. Can any boost library help me for this task ?

Regards,

Olivier

--
Olivier Tournaire
MATIS - Institut Géographique National
73, Ave de Paris
94165 St Mandé cedex, France

tel: (+33) 1 43 98 80 00 - 71 25
fax: (+33) 1 43 98 85 81

_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Mickael Wolff | 1 Feb 12:04
Gravatar

Re: Calling a function in a defined time intervall

Olivier Tournaire a écrit :
> Hi all,
> 
> I would like to know how can I call a member function each x 
> miliseconds, during a given time. Can any boost library help me for this 
> task ?

   It seems they are no Boost library for that. My guess is you have to 
use a thread, and wait in the desired time then broadcast to listener on 
a specific signal.

   (You work a sunday ? :D )

--

-- 
Mickaël Wolff aka Lupus Michaelis
Racine <http://lupusmic.org>
Blog   <http://blog.lupusmic.org>
Igor R | 1 Feb 12:14
Picon

Re: Calling a function in a defined time intervall

I would like to know how can I call a member function each x miliseconds, during a given time. Can any boost library help me for this task ?
look at boost::asio library
deadline_timer class
 
_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Kim Kuen Tang | 1 Feb 12:31
Picon
Favicon

[Proto] proto::reverse_fold_tree

Hi all,

i want to use the function proto::reverse_fold_tree to build a 
heterogeneous list from the expression "((a*b+c)*d+e)*f". The resulting 
sequence only contains the two terminals 'a' and b'. So  i am a little 
bit confused.

But using the function proto::fold_tree it produces correctly the 
sequence [f,e,d,c,b,a]. (Btw the two functions proto::fold_tree and 
proto::fold produce the same sequence [f,e,d,c,b,a], what is their 
difference? )

Here is the code:

#include <iostream>
#include <boost/proto/proto.hpp>
#include <boost/proto/proto_typeof.hpp>

#include <boost/fusion/container.hpp>
#include <boost/fusion/algorithm/iteration.hpp>
#include <boost/fusion/include/iteration.hpp>

#include <boost/typeof/typeof.hpp>

namespace mpl = boost::mpl;
namespace proto = boost::proto;
namespace fusion = boost::fusion;
using proto::_;

proto::terminal<char>::type const a = {'a'};
proto::terminal<char>::type const b = {'b'};
proto::terminal<char>::type const c = {'c'};
proto::terminal<char>::type const d = {'d'};
proto::terminal<char>::type const e = {'e'};
proto::terminal<char>::type const f = {'f'};

struct FoldToList
    : proto::or_<
        proto::when<proto::terminal<_>,fusion::cons<proto::_value, 
proto::_state>(proto::_value, proto::_state) >
        ,proto::when<proto::nary_expr<_,proto::vararg<_> >, 
proto::fold_tree<proto::_,fusion::nil(),FoldToList > >

    >
{};

struct FoldToListReverse
    : proto::or_<
        proto::when<proto::terminal<_>,fusion::cons<proto::_value, 
proto::_state>(proto::_value, proto::_state) >
        ,proto::when<proto::nary_expr<_,proto::vararg<_> >, 
proto::reverse_fold_tree<proto::_,fusion::nil(),FoldToListReverse > >
    >
{};

struct print
{
    typedef void result_type;

    template<class T>
    result_type
    operator()(T const& t) const
    {
        std::cout<<t<<"\t";
    }
};

int main()
{
   BOOST_PROTO_AUTO(expr, ((a*b+c)*d+e)*f );
   proto::display_expr(expr);
   BOOST_MPL_ASSERT(( proto::matches<BOOST_TYPEOF(expr), FoldToList>));
   BOOST_MPL_ASSERT(( proto::matches<BOOST_TYPEOF(expr), 
FoldToListReverse>));

 
   BOOST_AUTO(sequence1,FoldToList()(expr));
   fusion::for_each(sequence1,print());
   std::cout << "\n--------------------\n";

   BOOST_AUTO(sequence2,FoldToListReverse()(expr));
   fusion::for_each(sequence2,print());
   std::cout << "\n--------------------\n";
}

Cheers
Kim Tang
Roland Bock | 1 Feb 12:49
Picon

Re: date-time library and checked iterators 2

gast128 wrote:
> filed a bug report (ticket 2698) and it was solved within an hour for Boost 
> 1.38

Glad to read that!

Regards,

Roland

Gmane