Сумма размеров строк
От: Amor Россия  
Дата: 07.07.08 05:35
Оценка:
Доброго!
Дано: массив строк.
Можно ли с помощью bind-ов подсчитать общую сумму размеров строк.
     int isum = vec[ 0 ].size() + vec[ 1 ].size() + ... + vec[ n-1 ].size();


Я попробовал вот таким способом, но че-то не компилится...


     std::vector<std::string> vec;
     vec.push_back( "lala" );
     vec.push_back( "baba" );
     vec.push_back( "dada" );
     vec.push_back( "gaga" );

     int sum = 0;
     std::accumulate( vec.begin(), vec.end(), sum, 
          boost::bind( std::plus<int>(), _1, boost::bind( std::string::size, _2 ) ) );
Re: Сумма размеров строк
От: ArtDenis Россия  
Дата: 07.07.08 05:52
Оценка:
Amor wrote:
>
> Я попробовал вот таким способом, но че-то не компилится...

Вложенный bind и std::plus<int> здесь не нужен
Posted via RSDN NNTP Server 2.1 beta
[ 🎯 Дартс-лига Уфы | 🌙 Программа для сложения астрофото ]
Re: Сумма размеров строк
От: php-coder Чехия http://slava-semushin.blogspot.com
Дата: 07.07.08 06:18
Оценка:
Здравствуйте, Amor, Вы писали:

A>
A>     int sum = 0;
A>     std::accumulate( vec.begin(), vec.end(), sum, 
A>          boost::bind( std::plus<int>(), _1, boost::bind( std::string::size, _2 ) ) );
A>


Вот так попробуйте:

size_t sum = std::accumulate( vec.begin(), vec.end(), 0, boost::bind( std::plus<size_t>(), _1, boost::bind( &std::string::size, _2 ) ) );
Re[2]: Сумма размеров строк
От: Amor Россия  
Дата: 07.07.08 07:17
Оценка:
Здравствуйте, php-coder, Вы писали:

PC>Вот так попробуйте:


PC>
PC>size_t sum = std::accumulate( vec.begin(), vec.end(), 0, boost::bind( std::plus<size_t>(), _1, boost::bind( &std::string::size, _2 ) ) );
PC>


неа... вроде вообще ничего не изменилось...
Re[3]: Сумма размеров строк
От: php-coder Чехия http://slava-semushin.blogspot.com
Дата: 07.07.08 07:22
Оценка:
Здравствуйте, Amor, Вы писали:

A>неа... вроде вообще ничего не изменилось...


Странно, у меня работает. Вот код:

#include <algorithm>
#include <iostream>
#include <vector>
#include <numeric>
#include <string>
#include <boost/bind.hpp>

using std::accumulate;
using std::cout;
using std::endl;
using std::vector;
using std::plus;
using std::string;
using boost::bind;

int main() {
    
    vector<string> vec;
    vec.push_back("lala");
    vec.push_back("baba");
    vec.push_back("dada");
    vec.push_back("gaga");
    
    size_t sum = accumulate(
                    vec.begin(),
                    vec.end(),
                    0,
                    bind(plus<size_t>(), _1, bind(&string::size, _2))
                );
    
    cout << "sum = " << sum << endl;
    
    return 0;
}


Далее:

[c0der@xxx ~]$ g++ -W -Wall length_sum.cc -o length_sum
[c0der@xxx ~]$ ./length_sum
sum = 16


Компилятор -- g++ 4.2.1
Re[3]: Сумма размеров строк
От: php-coder Чехия http://slava-semushin.blogspot.com
Дата: 07.07.08 07:26
Оценка:
Здравствуйте, Amor, Вы писали:

A>неа... вроде вообще ничего не изменилось...


Что значит "ничего не изменилось"? У вас пример компилится? Если компилится, то должен работать. Другой вопрос в том, что в вашем исходном примере вы игнорируете результат, возвращаемый accumulate() (а резуальтат он именно возвращает, а не записывает в третий аргумент). Так что если компилируется, то работать должен, а если просто не выводит результат, так правьте код (пример я привёл).
Re[4]: Сумма размеров строк
От: Amor Россия  
Дата: 07.07.08 07:29
Оценка:
Здравствуйте, php-coder, Вы писали:
PC>Странно, у меня работает. Вот код:


На Visual C++ 6.0 не компилится

(не считая того, что надо еще добавить
#include <functional>

для обнаружения std::plus)

Сейчас попробую в 2005-ой студии...
Re[5]: Сумма размеров строк
От: Amor Россия  
Дата: 07.07.08 07:35
Оценка:
A>Сейчас попробую в 2005-ой студии...

В 2005-ой, все ОК
Re[5]: Сумма размеров строк
От: php-coder Чехия http://slava-semushin.blogspot.com
Дата: 07.07.08 07:36
Оценка:
Здравствуйте, Amor, Вы писали:

A>На Visual C++ 6.0 не компилится


Как ругается-то хоть?
Re[6]: Сумма размеров строк
От: Amor Россия  
Дата: 07.07.08 07:44
Оценка:
Здравствуйте, php-coder, Вы писали:


PC>Как ругается-то хоть?



--------------------Configuration: bind - Win32 Debug--------------------
Compiling...
bind.cpp
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list0> __cdecl boost::bind(F)' : expects 1 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1173) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list1<class boost::_bi::value<R> > > __cdecl boost::bind(F,A1)' : expects 2 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1181) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2783: 'class boost::_bi::bind_t<R,F,class boost::_bi::list2<class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(F,A1,A2)' : could not deduce template argument for 'R'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list3<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(F,A1,A2,A3)' : expects 4 arguments -
 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1197) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list4<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(F,A1,A2,A
3,A4)' : expects 5 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1205) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list5<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __
cdecl boost::bind(F,A1,A2,A3,A4,A5)' : expects 6 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1213) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list6<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class 
boost::_bi::value<R> > > __cdecl boost::bind(F,A1,A2,A3,A4,A5,A6)' : expects 7 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1221) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list7<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class 
boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(F,A1,A2,A3,A4,A5,A6,A7)' : expects 8 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1229) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list8<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class 
boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(F,A1,A2,A3,A4,A5,A6,A7,A8)' : expects 9 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1237) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list9<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class 
boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(F,A1,A2,A3,A4,A5,A6,A7,A8,A9)' : expects 10 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1245) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list0> __cdecl boost::bind(struct boost::type<R>,F)' : expects 2 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1255) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2784: 'class boost::_bi::bind_t<R,F,class boost::_bi::list1<class boost::_bi::value<R> > > __cdecl boost::bind(struct boost::type<R>,F,A1)' : could not deduce template argument for 'struct boost::type<
T>' from 'struct std::plus<unsigned int>'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2784: 'class boost::_bi::bind_t<R,F,class boost::_bi::list1<class boost::_bi::value<R> > > __cdecl boost::bind(struct boost::type<R>,F,A1)' : could not deduce template argument for 'struct boost::type<
T>' from 'struct std::plus<unsigned int>'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list2<class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(struct boost::type<R>,F,A1,A2)' : expects 4 arguments - 3 provi
ded
        c:\program files\contrib\boost\boost\bind.hpp(1271) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list3<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(struct boost::type<R>,F,A1,A2,A3)' :
 expects 5 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1279) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list4<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(struct bo
ost::type<R>,F,A1,A2,A3,A4)' : expects 6 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1287) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list5<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __
cdecl boost::bind(struct boost::type<R>,F,A1,A2,A3,A4,A5)' : expects 7 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1295) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list6<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class 
boost::_bi::value<R> > > __cdecl boost::bind(struct boost::type<R>,F,A1,A2,A3,A4,A5,A6)' : expects 8 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1303) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list7<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class 
boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(struct boost::type<R>,F,A1,A2,A3,A4,A5,A6,A7)' : expects 9 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1311) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list8<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class 
boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(struct boost::type<R>,F,A1,A2,A3,A4,A5,A6,A7,A8)' : expects 10 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1319) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list9<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class 
boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(struct boost::type<R>,F,A1,A2,A3,A4,A5,A6,A7,A8,A9)' : expects 11 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1327) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,class boost::_bi::XZVlist0::R (__cdecl*)( ?? ) throw( ?? )> __cdecl boost::bind(R (__cdecl *)(void))' : expects 1 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_cc.hpp(18) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::?$bind_t@$DBAB@P6A?AVtemplate-parameter-BAB@Vtemplate-parameter-BAC@@ZV?$list1@V?$value@$DBAB@@_bi@boost@@@_bi@boost@@ __cdecl boost::bind(R (__cdecl *)(B1),A1)' : expects 2 ar
guments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_cc.hpp(27) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2784: 'class boost::_bi::?$bind_t@$DBAB@P6A?AVtemplate-parameter-BAB@Vtemplate-parameter-BAC@Vtemplate-parameter-BAD@@ZV?$list2@V?$value@$DBAB@@_bi@boost@@V123@@_bi@boost@@ __cdecl boost::bind(R (__cde
cl *)(B1,B2),A1,A2)' : could not deduce template argument for ' (__cdecl *)(,)' from 'struct std::plus<unsigned int>'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::?$bind_t@$DBAB@P6A?AVtemplate-parameter-BAB@Vtemplate-parameter-BAC@Vtemplate-parameter-BAD@Vtemplate-parameter-BAE@@ZV?$list3@V?$value@$DBAB@@_bi@boost@@V123@V123@@_bi@boost@@
 __cdecl boost::bind(R (__cdecl *)(B1,B2,B3),A1,A2,A3)' : expects 4 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_cc.hpp(47) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::?$bind_t@$DBAB@P6A?AVtemplate-parameter-BAB@Vtemplate-parameter-BAC@Vtemplate-parameter-BAD@Vtemplate-parameter-BAE@Vtemplate-parameter-BAF@@ZV?$list4@V?$value@$DBAB@@_bi@boost
@@V123@V123@V123@@_bi@boost@@ __cdecl boost::bind(R (__cdecl *)(B1,B2,B3,B4),A1,A2,A3,A4)' : expects 5 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_cc.hpp(58) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::?$bind_t@$DBAB@P6A?AVtemplate-parameter-BAB@Vtemplate-parameter-BAC@Vtemplate-parameter-BAD@Vtemplate-parameter-BAE@Vtemplate-parameter-BAF@Vtemplate-parameter-BAG@@ZV?$list5@V
?$value@$DBAB@@_bi@boost@@V123@V123@V123@V123@@_bi@boost@@ __cdecl boost::bind(R (__cdecl *)(B1,B2,B3,B4,B5),A1,A2,A3,A4,A5)' : expects 6 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_cc.hpp(69) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::?$bind_t@$DBAB@P6A?AVtemplate-parameter-BAB@Vtemplate-parameter-BAC@Vtemplate-parameter-BAD@Vtemplate-parameter-BAE@Vtemplate-parameter-BAF@Vtemplate-parameter-BAG@Vtemplate-pa
rameter-BAH@@ZV?$list6@V?$value@$DBAB@@_bi@boost@@V123@V123@V123@V123@V123@@_bi@boost@@ __cdecl boost::bind(R (__cdecl *)(B1,B2,B3,B4,B5,B6),A1,A2,A3,A4,A5,A6)' : expects 7 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_cc.hpp(80) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::?$bind_t@$DBAB@P6A?AVtemplate-parameter-BAB@Vtemplate-parameter-BAC@Vtemplate-parameter-BAD@Vtemplate-parameter-BAE@Vtemplate-parameter-BAF@Vtemplate-parameter-BAG@Vtemplate-pa
rameter-BAH@Vtemplate-parameter-BAI@@ZV?$list7@V?$value@$DBAB@@_bi@boost@@V123@V123@V123@V123@V123@V123@@_bi@boost@@ __cdecl boost::bind(R (__cdecl *)(B1,B2,B3,B4,B5,B6,B7),A1,A2,A3,A4,A5,A6,A7)' : expects 8 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_cc.hpp(91) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::?$bind_t@$DBAB@P6A?AVtemplate-parameter-BAB@Vtemplate-parameter-BAC@Vtemplate-parameter-BAD@Vtemplate-parameter-BAE@Vtemplate-parameter-BAF@Vtemplate-parameter-BAG@Vtemplate-pa
rameter-BAH@Vtemplate-parameter-BAI@Vtemplate-parameter-BAJ@@ZV?$list8@V?$value@$DBAB@@_bi@boost@@V123@V123@V123@V123@V123@V123@V123@@_bi@boost@@ __cdecl boost::bind(R (__cdecl *)(B1,B2,B3,B4,B5,B6,B7,B8),A1,A2,A3,A4,A5,A6,A7,A8)' : expects 9 argume
nts - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_cc.hpp(102) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::?$bind_t@$DBAB@P6A?AVtemplate-parameter-BAB@Vtemplate-parameter-BAC@Vtemplate-parameter-BAD@Vtemplate-parameter-BAE@Vtemplate-parameter-BAF@Vtemplate-parameter-BAG@Vtemplate-pa
rameter-BAH@Vtemplate-parameter-BAI@Vtemplate-parameter-BAJ@Vtemplate-parameter-BAK@@ZV?$list9@V?$value@$DBAB@@_bi@boost@@V123@V123@V123@V123@V123@V123@V123@V123@@_bi@boost@@ __cdecl boost::bind(R (__cdecl *)(B1,B2,B3,B4,B5,B6,B7,B8,B9),A1,A2,A3,A4,
A5,A6,A7,A8,A9)' : expects 10 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_cc.hpp(113) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::mf0<R,T>,class boost::_bi::list1<class boost::_bi::value<R> > > __cdecl boost::bind(R (__thiscall T::*)(void),A1)' : expects 2 arguments - 3 provid
ed
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(21) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::cmf0<R,T>,class boost::_bi::list1<class boost::_bi::value<R> > > __cdecl boost::bind(R (__thiscall T::*)(void) const,A1)' : expects 2 arguments - 3
 provided
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(31) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2784: 'class boost::_bi::bind_t<R,struct boost::_mfi::mf1<R,T,B1>,class boost::_bi::list2<class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(R (__thiscall T::*)(B1),A1,A2)' :
 could not deduce template argument for '<Unknown>' from 'struct std::plus<unsigned int>'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2784: 'class boost::_bi::bind_t<R,struct boost::_mfi::cmf1<R,T,B1>,class boost::_bi::list2<class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(R (__thiscall T::*)(B1) const,A1
,A2)' : could not deduce template argument for '<Unknown>' from 'struct std::plus<unsigned int>'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::mf2<R,T,B1,B2>,class boost::_bi::list3<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(R (
__thiscall T::*)(B1,B2),A1,A2,A3)' : expects 4 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(68) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::cmf2<R,T,B1,B2>,class boost::_bi::list3<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(R 
(__thiscall T::*)(B1,B2) const,A1,A2,A3)' : expects 4 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(79) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::mf3<R,T,B1,B2,B3>,class boost::_bi::list4<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<
R> > > __cdecl boost::bind(R (__thiscall T::*)(B1,B2,B3),A1,A2,A3,A4)' : expects 5 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(92) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::cmf3<R,T,B1,B2,B3>,class boost::_bi::list4<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value
<R> > > __cdecl boost::bind(R (__thiscall T::*)(B1,B2,B3) const,A1,A2,A3,A4)' : expects 5 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(103) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::mf4<R,T,B1,B2,B3,B4>,class boost::_bi::list5<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::val
ue<R>,class boost::_bi::value<R> > > __cdecl boost::bind(R (__thiscall T::*)(B1,B2,B3,B4),A1,A2,A3,A4,A5)' : expects 6 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(116) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::cmf4<R,T,B1,B2,B3,B4>,class boost::_bi::list5<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::va
lue<R>,class boost::_bi::value<R> > > __cdecl boost::bind(R (__thiscall T::*)(B1,B2,B3,B4) const,A1,A2,A3,A4,A5)' : expects 6 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(127) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::mf5<R,T,B1,B2,B3,B4,B5>,class boost::_bi::list6<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::
value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(R (__thiscall T::*)(B1,B2,B3,B4,B5),A1,A2,A3,A4,A5,A6)' : expects 7 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(140) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::cmf5<R,T,B1,B2,B3,B4,B5>,class boost::_bi::list6<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi:
:value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(R (__thiscall T::*)(B1,B2,B3,B4,B5) const,A1,A2,A3,A4,A5,A6)' : expects 7 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(151) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::mf6<R,T,B1,B2,B3,B4,B5,B6>,class boost::_bi::list7<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_b
i::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(R (__thiscall T::*)(B1,B2,B3,B4,B5,B6),A1,A2,A3,A4,A5,A6,A7)' : expects 8 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(164) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::cmf6<R,T,B1,B2,B3,B4,B5,B6>,class boost::_bi::list7<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_
bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(R (__thiscall T::*)(B1,B2,B3,B4,B5,B6) const,A1,A2,A3,A4,A5,A6,A7)' : expects 8 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(175) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::mf7<R,T,B1,B2,B3,B4,B5,B6,B7>,class boost::_bi::list8<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost:
:_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(R (__thiscall T::*)(B1,B2,B3,B4,B5,B6,B7),A1,A2,A3,A4,A5,A6,A7,A8)' : expects 9 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(188) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::cmf7<R,T,B1,B2,B3,B4,B5,B6,B7>,class boost::_bi::list8<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost
::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(R (__thiscall T::*)(B1,B2,B3,B4,B5,B6,B7) const,A1,A2,A3,A4,A5,A6,A7,A8)' : expects 9 arguments - 3 p
rovided
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(199) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::mf8<R,T,B1,B2,B3,B4,B5,B6,B7,B8>,class boost::_bi::list9<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boo
st::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(R (__thiscall T::*)(B1,B2,B3,B4,B5,B6,B7,B8),A1,A2,A3,A4,A5,A6,A7,A8,A9)
' : expects 10 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(212) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,struct boost::_mfi::cmf8<R,T,B1,B2,B3,B4,B5,B6,B7,B8>,class boost::_bi::list9<class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class bo
ost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R>,class boost::_bi::value<R> > > __cdecl boost::bind(R (__thiscall T::*)(B1,B2,B3,B4,B5,B6,B7,B8) const,A1,A2,A3,A4,A5,A6,A7
,A8,A9)' : expects 10 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind\bind_mf_cc.hpp(223) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::?$bind_t@ABVtemplate-parameter-BAB@V?$dm@$DBAB@$DBAC@@_mfi@boost@@V?$list1@V?$value@$DBAB@@_bi@boost@@@_bi@3@ __cdecl boost::bind(R T::*,A1)' : expects 2 arguments - 3 provided
        c:\program files\contrib\boost\boost\bind.hpp(1516) : see declaration of 'bind'
D:\PROGRAMMING\PROBA\bind\bind.cpp(35) : error C2780: '_Ty __cdecl std::accumulate(_II,_II,_Ty)' : expects 3 arguments - 4 provided
        c:\program files\microsoft visual studio\vc98\include\numeric(17) : see declaration of 'accumulate'
Error executing cl.exe.

bind.exe - 51 error(s), 0 warning(s)
Re[7]: Сумма размеров строк
От: php-coder Чехия http://slava-semushin.blogspot.com
Дата: 07.07.08 07:52
Оценка:
Здравствуйте, Amor, Вы писали:

A>D:\PROGRAMMING\PROBA\bind\bind.cpp(34) : error C2780: 'class boost::_bi::bind_t<R,F,class boost::_bi::list0> __cdecl boost::bind(F)' : expects 1 arguments — 3 provided

[skip]

Ээээ... В качестве предположения: в документации на bind() есть упоминания про __cdecl:

To use bind with __cdecl member functions, #define the macro BOOST_MEM_FN_ENABLE_CDECL before including <boost/bind.hpp>.


См.: http://www.boost.org/doc/libs/1_35_0/libs/bind/bind.html#stdcall

Не поможет ли это? (Возможно, что нет, я только в качестве предположения...)

A>D:\PROGRAMMING\PROBA\bind\bind.cpp(35) : error C2780: '_Ty __cdecl std::accumulate(_II,_II,_Ty)' : expects 3 arguments — 4 provided

A> c:\program files\microsoft visual studio\vc98\include\numeric(17) : see declaration of 'accumulate'

А вот это странно. И какой же прототип у accumulate() в вашем случае?
Re[8]: Сумма размеров строк
От: Amor Россия  
Дата: 07.07.08 08:01
Оценка:
Здравствуйте, php-coder, Вы писали:

[skip]

PC>

PC>To use bind with __cdecl member functions, #define the macro BOOST_MEM_FN_ENABLE_CDECL before including <boost/bind.hpp>.

PC>См.: http://www.boost.org/doc/libs/1_35_0/libs/bind/bind.html#stdcall
PC>Не поможет ли это? (Возможно, что нет, я только в качестве предположения...)

Не помогло... да и как-то непонятно причем тут cdecl..

A>>D:\PROGRAMMING\PROBA\bind\bind.cpp(35) : error C2780: '_Ty __cdecl std::accumulate(_II,_II,_Ty)' : expects 3 arguments — 4 provided

A>> c:\program files\microsoft visual studio\vc98\include\numeric(17) : see declaration of 'accumulate'
PC>А вот это странно. И какой же прототип у accumulate() в вашем случае?

accumulate стандартный. Это наверно к тому что, он не смог определить тип четвертого аргумента, поэтому ругнулся на несоответствие первого попавшегося прототипа ))))

template<class _II, class _Ty> inline
    _Ty accumulate(_II _F, _II _L, _Ty _V)

template<class _II, class _Ty, class _Bop> inline
    _Ty accumulate(_II _F, _II _L, _Ty _V, _Bop _B)
Re[9]: Сумма размеров строк
От: php-coder Чехия http://slava-semushin.blogspot.com
Дата: 07.07.08 08:28
Оценка: +1
Здравствуйте, Amor, Вы писали:

A>Не помогло... да и как-то непонятно причем тут cdecl..


Значит нужно "курить" http://www.boost.org/doc/libs/1_35_0/libs/bind/bind.html#err_msvc_using и дальше, пробовать и экспериментировать пока не заработает на вашем компиляторе.
Re[6]: Сумма размеров строк
От: ant_katcin Россия  
Дата: 08.07.08 17:21
Оценка:
Здравствуйте, Amor, Вы писали:


A>>Сейчас попробую в 2005-ой студии...


A>В 2005-ой, все ОК


а не проще ли её и использовать. у меня вообще ужастный осадок от работы в VC 6.0. Потому как там поддержкой стандарта и не пахнет...
... << RSDN@Home 1.2.0 alpha 4 rev. 1091>>
Re[7]: Сумма размеров строк
От: Sergey Chadov Россия  
Дата: 08.07.08 18:15
Оценка:
Здравствуйте, ant_katcin, Вы писали:


_>а не проще ли её и использовать. у меня вообще ужастный осадок от работы в VC 6.0. Потому как там поддержкой стандарта и не пахнет...


Еще бы, оно вышло _до_ стандарта
--
Sergey Chadov

... << RSDN@Home 1.2.0 alpha rev. 685>>
Re[8]: Сумма размеров строк
От: ant_katcin Россия  
Дата: 09.07.08 06:24
Оценка:
Здравствуйте, Sergey Chadov, Вы писали:

SC>Здравствуйте, ant_katcin, Вы писали:



_>>а не проще ли её и использовать. у меня вообще ужастный осадок от работы в VC 6.0. Потому как там поддержкой стандарта и не пахнет...


SC>Еще бы, оно вышло _до_ стандарта


Я в курсе, что до стандарта, просто удивляет, что несмотря на это её используют спустя десять лет.(или столько там точно 11? 12? больше? я тогда ещё маленький был, сями не увлекался )

Да, а пытаються на ней скомпилить такие вещи, которые и новые компиляторы-то только только начали понимать. (я не про данный конкретный случай, я про вообще)
... << RSDN@Home 1.2.0 alpha 4 rev. 1091>>
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.