Форум программистов, компьютерный форум, киберфорум
С++ для начинающих
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 5.00/13: Рейтинг темы: голосов - 13, средняя оценка - 5.00
0 / 0 / 0
Регистрация: 01.06.2013
Сообщений: 8
1

Шаблоны omanip и imanip

06.11.2013, 21:22. Показов 2500. Ответов 1
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Пытаюсь использовать omanip и imanip, подключая библиотеку iomanip (Visual Studio 2012). Гугл уже подсказал, что методичке верить нельзя и этих шаблонов там не будет, но вот что делать без них, понятия не имею. Люди с опытом, подскажите пожалуйста, как быть?
0
Лучшие ответы (1)
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
06.11.2013, 21:22
Ответы с готовыми решениями:

Хранить шаблоны документов в базе и выводить данные в эти шаблоны
Доброго времени суток. Интересует вопрос: мне необходимо формировать вордовские документы по...

Чем отличаются шаблоны HTML и шаблоны WordPress
В чём различие между шаблонами HTML и WordPress. Кроме того, что создаются они разными способами....

«Шаблоны шаблонов» vs «шаблоны с параметрами-шаблонами».
«Шаблоны шаблонов» vs «шаблоны с параметрами-шаблонами». Есть ли разница в этих понятиях? Если...

Шаблоны. Плохо понимаемые моменты из книги "Шаблоны С++. Справочник разработчика". (Вандевурд, Джосаттис)
Так как изучаю эту книгу, то в некоторых местах возникают вопросы. Чтобы не плодить много тем,...

1
267 / 189 / 33
Регистрация: 15.01.2011
Сообщений: 681
06.11.2013, 21:42 2
Лучший ответ Сообщение было отмечено JulietteDrew как решение

Решение

чего именно там нет ?
<iomanip>
vs2012 iomanip.h :
Кликните здесь для просмотра всего текста

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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
// iomanip standard header
#pragma once
#ifndef _IOMANIP_
#define _IOMANIP_
#ifndef RC_INVOKED
#include <istream>
 
#include <type_traits>
 
#include <xlocmon>
#include <xloctime>
 
 #pragma pack(push,_CRT_PACKING)
 #pragma warning(push,3)
 #pragma push_macro("new")
 #undef new
 
_STD_BEGIN
        // TEMPLATE STRUCT _Fillobj
template<class _Elem>
    struct _Fillobj
    {   // store fill character
    _Fillobj(_Elem _Ch)
        : _Fill(_Ch)
        {   // construct from fill character
        }
 
    _Elem _Fill;    // the fill character
    };
 
        // TEMPLATE FUNCTION setfill
template<class _Elem> inline
    _Fillobj<_Elem> setfill(_Elem _Ch)
    {   // return a _Fillobj manipulator
    return (_Fillobj<_Elem>(_Ch));
    }
 
template<class _Elem,
    class _Traits,
    class _Elem2> inline
    basic_istream<_Elem, _Traits>&
        operator>>(basic_istream<_Elem, _Traits>& _Istr,
            const _Fillobj<_Elem2>& _Manip)
    {   // set fill character in input stream
    static_assert((is_same<_Elem, _Elem2>::value),
        "wrong character type for setfill");
 
    _Istr.fill(_Manip._Fill);
    return (_Istr);
    }
 
template<class _Elem,
    class _Traits,
    class _Elem2> inline
    basic_ostream<_Elem, _Traits>&
        operator<<(basic_ostream<_Elem, _Traits>& _Ostr,
            const _Fillobj<_Elem2>& _Manip)
    {   // set fill character in output stream
    static_assert((is_same<_Elem, _Elem2>::value),
        "wrong character type for setfill");
 
    _Ostr.fill(_Manip._Fill);
    return (_Ostr);
    }
 
 #if _HAS_CPP0X
        // TEMPLATE STRUCT _Monobj
template<class _Money>
    struct _Monobj
    {   // store reference to monetary amount
    _Monobj(_Money& _Val_arg, bool _Intl_arg)
        : _Val(_Val_arg), _Intl(_Intl_arg)
        {   // construct from monetary amount reference and int'l flag
        }
 
    _Money& _Val;   // the monetary amount reference
    bool _Intl;     // international flag
 
    private:
        _Monobj& operator=(const _Monobj&);
    };
 
        // TEMPLATE FUNCTION get_money
template<class _Money> inline
    _Monobj<_Money> get_money(_Money& _Val_arg,
        bool _Intl_arg = false)
    {   // return a _Monobj manipulator
    return (_Monobj<_Money>(_Val_arg, _Intl_arg));
    }
 
template<class _Elem,
    class _Traits,
    class _Money> inline
    basic_istream<_Elem, _Traits>&
        operator>>(basic_istream<_Elem, _Traits>& _Istr,
            const _Monobj<_Money>& _Manip)
    {   // get monetary amount from input stream
    typedef basic_istream<_Elem, _Traits> _Myis;
    typedef istreambuf_iterator<_Elem, _Traits> _Iter;
    typedef money_get<_Elem, _Iter> _Mymget;
 
    ios_base::iostate _State = ios_base::goodbit;
    const typename _Myis::sentry _Ok(_Istr);
 
    if (_Ok)
        {   // state okay, extract monetary amount
        const _Mymget& _Mget_fac = _USE(_Istr.getloc(), _Mymget);
        _TRY_IO_BEGIN
        _Mget_fac.get(_Iter(_Istr.rdbuf()), _Iter(0), _Manip._Intl,
            _Istr, _State, _Manip._Val);
        _CATCH_IO_(_Istr)
        }
 
    _Istr.setstate(_State);
    return (_Istr);
    }
 
        // TEMPLATE FUNCTION put_money
template<class _Money> inline
    _Monobj<const _Money>
        put_money(const _Money& _Val_arg,
            bool _Intl_arg = false)
    {   // return a _Monobj manipulator
    return (_Monobj<const _Money>(_Val_arg, _Intl_arg));
    }
 
template<class _Elem,
    class _Traits,
    class _Money> inline
    basic_ostream<_Elem, _Traits>&
        operator<<(basic_ostream<_Elem, _Traits>& _Ostr,
            const _Monobj<_Money>& _Manip)
    {   // put monetary amount to output stream
    typedef basic_ostream<_Elem, _Traits> _Myos;
    typedef ostreambuf_iterator<_Elem, _Traits> _Iter;
    typedef money_put<_Elem, _Iter> _Mymput;
 
    ios_base::iostate _State = ios_base::goodbit;
    const typename _Myos::sentry _Ok(_Ostr);
 
    if (_Ok)
        {   // state okay, insert monetary amount
        const _Mymput& _Mput_fac = _USE(_Ostr.getloc(), _Mymput);
        _TRY_IO_BEGIN
        if (_Mput_fac.put(_Iter(_Ostr.rdbuf()), _Manip._Intl,
            _Ostr, _Ostr.fill(), _Manip._Val).failed())
                _State |= ios_base::badbit;
        _CATCH_IO_(_Ostr)
        }
 
    _Ostr.setstate(_State);
    return (_Ostr);
    }
 
        // TEMPLATE STRUCT _Timeobj
template<class _Elem>
    struct _Timeobj
    {   // store reference to tm object and format
    _Timeobj(struct tm *_Tptr_arg, const _Elem *_Fmt_arg)
        : _Tptr(_Tptr_arg), _Fmtfirst(_Fmt_arg)
        {   // construct from tm pointer and format pointer
        for (_Fmtlast = _Fmtfirst; *_Fmtlast != 0; ++_Fmtlast)
            ;   // find end of format string
        }
 
    struct tm *_Tptr;   // the tm struct pointer
    const _Elem *_Fmtfirst; // format string start
    const _Elem *_Fmtlast;  // format string end
    };
 
        // TEMPLATE FUNCTION get_time
template<class _Elem> inline
    _Timeobj<_Elem>
        get_time(struct tm *_Tptr_arg, const _Elem *_Fmt_arg)
    {   // return a _Timeobj manipulator
    return (_Timeobj<_Elem>(_Tptr_arg, _Fmt_arg));
    }
 
template<class _Elem,
    class _Traits,
    class _Elem2> inline
    basic_istream<_Elem, _Traits>&
        operator>>(basic_istream<_Elem, _Traits>& _Istr,
            const _Timeobj<_Elem2>& _Manip)
    {   // get time information from input stream
    typedef basic_istream<_Elem, _Traits> _Myis;
    typedef istreambuf_iterator<_Elem, _Traits> _Iter;
    typedef time_get<_Elem2, _Iter> _Mytget;
 
    static_assert((is_same<_Elem, _Elem2>::value),
        "wrong character type for get_time");
 
    ios_base::iostate _State = ios_base::goodbit;
    const typename _Myis::sentry _Ok(_Istr);
 
    if (_Ok)
        {   // state okay, extract time amounts
        const _Mytget& _Tget_fac = _USE(_Istr.getloc(), _Mytget);
        _TRY_IO_BEGIN
        _Tget_fac.get(_Iter(_Istr.rdbuf()), _Iter(0), _Istr, _State,
            _Manip._Tptr, _Manip._Fmtfirst, _Manip._Fmtlast);
        _CATCH_IO_(_Istr)
        }
 
    _Istr.setstate(_State);
    return (_Istr);
    }
 
        // TEMPLATE FUNCTION put_time
template<class _Elem> inline
    _Timeobj<_Elem>
        put_time(struct tm *_Tptr_arg, const _Elem *_Fmt_arg)
    {   // return a _Timeobj manipulator
    return (_Timeobj<_Elem>(_Tptr_arg, _Fmt_arg));
    }
 
template<class _Elem,
    class _Traits,
    class _Elem2> inline
    basic_ostream<_Elem, _Traits>&
        operator<<(basic_ostream<_Elem, _Traits>& _Ostr,
            const _Timeobj<_Elem2>& _Manip)
    {   // put time information to output stream
    typedef basic_ostream<_Elem, _Traits> _Myos;
    typedef ostreambuf_iterator<_Elem, _Traits> _Iter;
    typedef time_put<_Elem2, _Iter> _Mytput;
 
    static_assert((is_same<_Elem, _Elem2>::value),
        "wrong character type for put_time");
 
    ios_base::iostate _State = ios_base::goodbit;
    const typename _Myos::sentry _Ok(_Ostr);
 
    if (_Ok)
        {   // state okay, insert monetary amount
        const _Mytput& _Tput_fac = _USE(_Ostr.getloc(), _Mytput);
        _TRY_IO_BEGIN
        if (_Tput_fac.put(_Iter(_Ostr.rdbuf()), _Ostr, _Ostr.fill(),
            _Manip._Tptr, _Manip._Fmtfirst, _Manip._Fmtlast).failed())
            _State |= ios_base::badbit;
        _CATCH_IO_(_Ostr)
        }
 
    _Ostr.setstate(_State);
    return (_Ostr);
    }
 #endif /* _HAS_CPP0X */
 
        // TEMPLATE STRUCT _Smanip
template<class _Arg>
    struct _Smanip
    {   // store function pointer and argument value
    _Smanip(void (__cdecl *_Left)(ios_base&, _Arg), _Arg _Val)
        : _Pfun(_Left), _Manarg(_Val)
        {   // construct from function pointer and argument value
        }
 
    void (__cdecl *_Pfun)(ios_base&, _Arg); // the function pointer
    _Arg _Manarg;   // the argument value
    };
 
template<class _Elem,
    class _Traits,
    class _Arg> inline
    basic_istream<_Elem, _Traits>& operator>>(
        basic_istream<_Elem, _Traits>& _Istr, const _Smanip<_Arg>& _Manip)
    {   // extract by calling function with input stream and argument
    (*_Manip._Pfun)(_Istr, _Manip._Manarg);
    return (_Istr);
    }
 
template<class _Elem,
    class _Traits,
    class _Arg> inline
    basic_ostream<_Elem, _Traits>& operator<<(
        basic_ostream<_Elem, _Traits>& _Ostr, const _Smanip<_Arg>& _Manip)
    {   // insert by calling function with output stream and argument
    (*_Manip._Pfun)(_Ostr, _Manip._Manarg);
    return (_Ostr);
    }
 
        // INSTANTIATIONS
_MRTIMP2 _Smanip<ios_base::fmtflags> __cdecl resetiosflags(ios_base::fmtflags);
_MRTIMP2 _Smanip<ios_base::fmtflags> __cdecl setiosflags(ios_base::fmtflags);
_MRTIMP2 _Smanip<int> __cdecl setbase(int);
_MRTIMP2 _Smanip<streamsize> __cdecl setprecision(streamsize);
_MRTIMP2 _Smanip<streamsize> __cdecl setw(streamsize);
_STD_END
 #pragma pop_macro("new")
 #pragma warning(pop)
 #pragma pack(pop)
#endif /* RC_INVOKED */
#endif /* _IOMANIP_ */
 
/*
 * Copyright (c) 1992-2012 by P.J. Plauger.  ALL RIGHTS RESERVED.
 * Consult your license regarding permissions and restrictions.
V6.00:0009 */
1
06.11.2013, 21:42
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
06.11.2013, 21:42
Помогаю со студенческими работами здесь

Помогите писать на С++ через шаблоны. Консуле я писал, но надо писать исползуя шаблоны
В одномерном массиве, состоящем из п вещественных элементов, вычислить: 1) количество элементов...

шаблоны
Помогите пож. разобраться с шаблонами. Шаблоны у которых параметры тоже шаблоны. из книги:...

Шаблоны
День Добрый! Есть такая функция: Template &lt;typename T&gt; void push_el(std::vector &lt;T&gt;&amp;v,const T...

Шаблоны
Посоветуйте шаблоны для портала? Добавлено через 1 минуту Вот нашел сайт websny.ru - какой...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru