Форум программистов, компьютерный форум CyberForum.ru
Наши страницы

STL Iterators - C++

Войти
Регистрация
Восстановить пароль
Другие темы раздела
C++ Перевод из кодировки UTF - 8 в ANSI http://www.cyberforum.ru/cpp-beginners/thread634420.html
Всем привет! Пишу прогу на линухе, результаты работы вывожу в html файл. Так вот когда открываю файл для прочтения с помощью браузера там иероглифы, с помощью текстового редактора в linux то все ок....
C++ Книги для использования оконных приложений Всем привет. Консольные приложение это хорошо, но я уже прочитал книгу, и более менее знаю азы c++. Но хотелось бы создавать уже нормальные, красивые приложения с использованием Windows Forms... http://www.cyberforum.ru/cpp-beginners/thread634416.html
C++ Разыменования указателя
Добрий день подскажите пожалуйса можно ли разыменовать такое вот виражения pt->str char*pt-указатель str объект класса _bstr_t нужно получить данные которые находятся в str если сделать вот так...
C++ Засада с машинным эпсилон, или Либо я дурак
Эту задачку выполняют все начинающие. Так вот, берём два простеньких кода. Они настолько коротки, тупы и очевидны, что я даже не комментировал их. Первый, работает нормально. #include...
C++ Тема: Записи. Работа с текстовыми файлами http://www.cyberforum.ru/cpp-beginners/thread634393.html
Тема: Записи. Работа с текстовыми файлами. Дан файл f, содержащий сведения о багаже нескольких пассажиров. Багаж пассажира характеризуется количеством вещей и общим весом вещей. Сведения о багаже...
C++ Отобразить вектор в обратном порядке не используя реверсивные итераторы Отобразить вектор в обратном порядке не используя реверсивные итераторы никак не могу в цикле вывести последний(самый первый) элемент подробнее

Показать сообщение отдельно
Leeto
7 / 7 / 0
Регистрация: 23.12.2011
Сообщений: 372
Записей в блоге: 1
13.08.2012, 21:45  [ТС]
Цитата Сообщение от ForEveR Посмотреть сообщение
Как вариант.
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <iostream>
#include <vector>
#include <map>
 
template<typename T>
T get_el(const T& value)
{
    return value;
}
 
template<typename T, typename T2>
T2 get_el(const std::pair<const T, T2>& value)
{
    return value.second;
}
 
template<typename Container>
double sum(const Container& cnt)
{
   typedef typename Container::const_iterator c_iter;
   double sum = 0;
   for (c_iter i = cnt.begin();
        i != cnt.end();
        ++i)
   {
      sum += get_el(*i);
   }
   return sum;
}
 
template<typename Iterator>
double sum(Iterator first, Iterator last)
{
    double sum = 0;
    for (; first != last; ++first)
    {
        sum += get_el(*first);
    }
    return sum;
}
 
int main()
{
   double array[] = {1, 2};
   std::vector<double> v(array, array + sizeof(array) / sizeof(*array));
   std::cout << sum(v) << std::endl;
   std::pair<int, double> map[] = 
   {
     std::make_pair(1, 1.0),
     std::make_pair(2, 2.0)
   };
   std::map<int, double> m(map, map + sizeof(map) / sizeof(*map));
   std::cout << sum(m) << std::endl;
   std::cout << "By iters " << sum(m.begin(), m.end()) << std::endl;
}
main.cpp
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include <iostream>
#include <map>
 
 
template<typename T>
T GetElement(const T& value)
{
    return value;
}
 
template<typename T, typename T2>
T2 GetElement(const std::pair<const T, T2>&  value) 
    {   
        return value.second;    
    }
 
 
 
template<typename T> 
 
double Sum(const T& MyContainer)
{   
   typedef typename T::const_iterator c_iter;
   double Sum = 0;
   for (c_iter MyConstIterator = MyContainer.begin(); MyConstIterator != MyContainer.end(); ++MyConstIterator)
       { 
          Sum += GetElement(*MyConstIterator);
       }
   return Sum; /
}
 
 
 
template<typename Iterator>
double Sum(Iterator myFirstIterator, Iterator mySecondIterator)
{
    double Sum = 0;
    for (; myFirstIterator != mySecondIterator; ++myFirstIterator)
        {
            Sum += GetElement(*myFirstIterator);
        }
    return Sum;
}
 
int main ()
{
 
    const unsigned int size_of_data_array = 35; 
 
        double data_doubles[size_of_data_array] 
                    =  { 1830 , 190.1, 1914. , 1863 , 1839 ,        // 0 - 4
                          } ;       
 
 
    
    
    
        std::map <int, double > My_SumTest_Map;
 
        for (int i=0;i<10;i++) My_SumTest_Map[i] = i*10.5;
 
        std::map<std::string, double > MapStringDouble;
        
        MapStringDouble ["The Wireless"] = data_doubles[1];
        MapStringDouble ["WWI"] = data_doubles[2];
        MapStringDouble ["Alfred Nobel"] = data_doubles[3];
 
        std::map<std::string, double>::const_iterator iMy_Map_Iterator = MapStringDouble.cbegin();
 
        //std::map<int, double>::const_iterator iMy_Map_Iterator = My_SumTest_Map.cbegin();
    
        std::cout << "\n-----Print without accumlating------" << std::endl;
 
        for (iMy_Map_Iterator; iMy_Map_Iterator != MapStringDouble.cend(); ++iMy_Map_Iterator)
                {
                    std::cout   << "\n["    ; iMy_Map_Iterator->first   ;
                    std::cout       << "] -> " 
                                << "("      << iMy_Map_Iterator->second<<")";
                }
 
 
            //std::cout << "\n Sum of all MyMap elements   is  :  " <<  Sum(My_SumTest_Map) ;
        std::cout << "\n Sum of all MyMap elements   is  :  "   <<  Sum(MapStringDouble) ;
            std::cout << "\n\n\n";
return 0;
}


Ребят подскажите в чем дело если делать map <int,double > то все ок если делать std::map<std::string, double> то все как то не радужно... вылезают какие ошибки связанные с const и все такое

вот список ошибок
errors

1>------ Build started: Project: L7_ex2_map_string_problem, Configuration: Debug Win32 ------
1> main.cpp
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::list<_Ty,_Ax> &,const std::list<_Ty,_Ax> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\list(1588) : see declaration of 'std::operator <'
1> c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(124) : while compiling class template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const'
1> with
1> [
1> _Ty=std::string
1> ]
1> c:\program files\microsoft visual studio 10.0\vc\include\map(71) : see reference to class template instantiation 'std::less<_Ty>' being compiled
1> with
1> [
1> _Ty=std::string
1> ]
1> c:\program files\microsoft visual studio 10.0\vc\include\xtree(451) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=double,
1> _Pr=std::less<std::string>,
1> _Alloc=std::allocator<std:air<const std::string,double>>,
1> _Mfl=false
1> ]
1> c:\program files\microsoft visual studio 10.0\vc\include\xtree(520) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std:air<const std::string,double>>,false>
1> ]
1> c:\program files\microsoft visual studio 10.0\vc\include\xtree(659) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std:air<const std::string,double>>,false>
1> ]
1> c:\program files\microsoft visual studio 10.0\vc\include\map(81) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std:air<const std::string,double>>,false>
1> ]
1> c:\all my\с++\lab_for_level_7_8\l7_ex2_map_string_problem\main.cpp(63) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=double
1> ]
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::list<_Ty,_Ax> &,const std::list<_Ty,_Ax> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\list(1588) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::list<_Ty,_Ax> &,const std::list<_Ty,_Ax> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\list(1588) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::vector<_Ty,_Ax> &,const std::vector<_Ty,_Ax> &)' : could not deduce template argument for 'const std::vector<_Ty,_Ax> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\vector(1502) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::vector<_Ty,_Ax> &,const std::vector<_Ty,_Ax> &)' : could not deduce template argument for 'const std::vector<_Ty,_Ax> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\vector(1502) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::vector<_Ty,_Ax> &,const std::vector<_Ty,_Ax> &)' : could not deduce template argument for 'const std::vector<_Ty,_Ax> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\vector(1502) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\memory(2582) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\memory(2582) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\memory(2582) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xutility(1356) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xutility(1356) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xutility(1356) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xutility(1179) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xutility(1179) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xutility(1179) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std:air<_Ty1,_Ty2> &,const std:air<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std:air<_Ty1,_Ty2> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\utility(318) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std:air<_Ty1,_Ty2> &,const std:air<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std:air<_Ty1,_Ty2> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\utility(318) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std:air<_Ty1,_Ty2> &,const std:air<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std:air<_Ty1,_Ty2> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\utility(318) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2676: binary '<' : 'const std::string' does not define this operator or a conversion to a type acceptable to the predefined operator
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



Добавлено через 17 минут
Цитата Сообщение от Leeto Посмотреть сообщение
main.cpp
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include <iostream>
#include <map>
 
 
template<typename T>
T GetElement(const T& value)
{
    return value;
}
 
template<typename T, typename T2>
T2 GetElement(const std::pair<const T, T2>&  value) 
    {   
        return value.second;    
    }
 
 
 
template<typename T> 
 
double Sum(const T& MyContainer)
{   
   typedef typename T::const_iterator c_iter;
   double Sum = 0;
   for (c_iter MyConstIterator = MyContainer.begin(); MyConstIterator != MyContainer.end(); ++MyConstIterator)
       { 
          Sum += GetElement(*MyConstIterator);
       }
   return Sum; /
}
 
 
 
template<typename Iterator>
double Sum(Iterator myFirstIterator, Iterator mySecondIterator)
{
    double Sum = 0;
    for (; myFirstIterator != mySecondIterator; ++myFirstIterator)
        {
            Sum += GetElement(*myFirstIterator);
        }
    return Sum;
}
 
int main ()
{
 
    const unsigned int size_of_data_array = 35; 
 
        double data_doubles[size_of_data_array] 
                    =  { 1830 , 190.1, 1914. , 1863 , 1839 ,        // 0 - 4
                          } ;       
 
 
    
    
    
        std::map <int, double > My_SumTest_Map;
 
        for (int i=0;i<10;i++) My_SumTest_Map[i] = i*10.5;
 
        std::map<std::string, double > MapStringDouble;
        
        MapStringDouble ["The Wireless"] = data_doubles[1];
        MapStringDouble ["WWI"] = data_doubles[2];
        MapStringDouble ["Alfred Nobel"] = data_doubles[3];
 
        std::map<std::string, double>::const_iterator iMy_Map_Iterator = MapStringDouble.cbegin();
 
        //std::map<int, double>::const_iterator iMy_Map_Iterator = My_SumTest_Map.cbegin();
    
        std::cout << "\n-----Print without accumlating------" << std::endl;
 
        for (iMy_Map_Iterator; iMy_Map_Iterator != MapStringDouble.cend(); ++iMy_Map_Iterator)
                {
                    std::cout   << "\n["    ; iMy_Map_Iterator->first   ;
                    std::cout       << "] -> " 
                                << "("      << iMy_Map_Iterator->second<<")";
                }
 
 
            //std::cout << "\n Sum of all MyMap elements   is  :  " <<  Sum(My_SumTest_Map) ;
        std::cout << "\n Sum of all MyMap elements   is  :  "   <<  Sum(MapStringDouble) ;
            std::cout << "\n\n\n";
return 0;
}


Ребят подскажите в чем дело если делать map <int,double > то все ок если делать std::map<std::string, double> то все как то не радужно... вылезают какие ошибки связанные с const и все такое

вот список ошибок
errors

1>------ Build started: Project: L7_ex2_map_string_problem, Configuration: Debug Win32 ------
1> main.cpp
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::list<_Ty,_Ax> &,const std::list<_Ty,_Ax> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\list(1588) : see declaration of 'std::operator <'
1> c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(124) : while compiling class template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const'
1> with
1> [
1> _Ty=std::string
1> ]
1> c:\program files\microsoft visual studio 10.0\vc\include\map(71) : see reference to class template instantiation 'std::less<_Ty>' being compiled
1> with
1> [
1> _Ty=std::string
1> ]
1> c:\program files\microsoft visual studio 10.0\vc\include\xtree(451) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=double,
1> _Pr=std::less<std::string>,
1> _Alloc=std::allocator<std:air<const std::string,double>>,
1> _Mfl=false
1> ]
1> c:\program files\microsoft visual studio 10.0\vc\include\xtree(520) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std:air<const std::string,double>>,false>
1> ]
1> c:\program files\microsoft visual studio 10.0\vc\include\xtree(659) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std:air<const std::string,double>>,false>
1> ]
1> c:\program files\microsoft visual studio 10.0\vc\include\map(81) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std:air<const std::string,double>>,false>
1> ]
1> c:\all my\с++\lab_for_level_7_8\l7_ex2_map_string_problem\main.cpp(63) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=double
1> ]
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::list<_Ty,_Ax> &,const std::list<_Ty,_Ax> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\list(1588) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::list<_Ty,_Ax> &,const std::list<_Ty,_Ax> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\list(1588) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::vector<_Ty,_Ax> &,const std::vector<_Ty,_Ax> &)' : could not deduce template argument for 'const std::vector<_Ty,_Ax> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\vector(1502) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::vector<_Ty,_Ax> &,const std::vector<_Ty,_Ax> &)' : could not deduce template argument for 'const std::vector<_Ty,_Ax> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\vector(1502) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::vector<_Ty,_Ax> &,const std::vector<_Ty,_Ax> &)' : could not deduce template argument for 'const std::vector<_Ty,_Ax> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\vector(1502) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\memory(2582) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\memory(2582) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\memory(2582) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xutility(1356) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xutility(1356) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xutility(1356) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xutility(1179) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xutility(1179) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\xutility(1179) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std:air<_Ty1,_Ty2> &,const std:air<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std:air<_Ty1,_Ty2> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\utility(318) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std:air<_Ty1,_Ty2> &,const std:air<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std:air<_Ty1,_Ty2> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\utility(318) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std:air<_Ty1,_Ty2> &,const std:air<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std:air<_Ty1,_Ty2> &' from 'const std::string'
1> c:\program files\microsoft visual studio 10.0\vc\include\utility(318) : see declaration of 'std::operator <'
1>c:\program files\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2676: binary '<' : 'const std::string' does not define this operator or a conversion to a type acceptable to the predefined operator
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

надо было инклюднуть
#include <string>
0
 
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Рейтинг@Mail.ru