summaryrefslogtreecommitdiffstats
blob: bdba8f051c9e5d9e7e45d3fed1da7853e3385bb3 (plain)
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
//  boost/filesystem/fstream.hpp  --------------------------------------------//

//  Copyright Beman Dawes 2002.
//  Use, modification, and distribution is subject to the Boost Software
//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)

//  See library home page at http://www.boost.org/libs/filesystem

//----------------------------------------------------------------------------// 

#ifndef BOOST_FILESYSTEM_FSTREAM_HPP
#define BOOST_FILESYSTEM_FSTREAM_HPP

#include <boost/filesystem/operations.hpp> // for 8.3 hack (see below)
#include <boost/utility/enable_if.hpp>
#include <boost/detail/workaround.hpp>

#include <iosfwd>
#include <fstream>

#include <boost/config/abi_prefix.hpp> // must be the last #include

// NOTE: fstream.hpp for Boost 1.32.0 and earlier supplied workarounds for
// various compiler problems. They have been removed to ease development of the
// basic i18n functionality. Once the new interface is stable, the workarounds
// will be reinstated for any compilers that otherwise can support the rest of
// the library after internationalization.

namespace boost
{
  namespace filesystem
  {
    namespace detail
    {
#   if defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM_NARROW_ONLY)
#     if !defined(BOOST_DINKUMWARE_STDLIB) || BOOST_DINKUMWARE_STDLIB < 405
      // The 8.3 hack:
      // C++98 does not supply a wchar_t open, so try to get an equivalent
      // narrow char name based on the short, so-called 8.3, name.
      // Not needed for Dinkumware 405 and later as they do supply wchar_t open.
      BOOST_FILESYSTEM_DECL bool create_file_api( const std::wstring & ph,
        std::ios_base::openmode mode ); // true if succeeds
      BOOST_FILESYSTEM_DECL std::string narrow_path_api(
        const std::wstring & ph ); // return is empty if fails

      inline std::string path_proxy( const std::wstring & file_ph,
        std::ios_base::openmode mode )
      // Return a non-existant path if cannot supply narrow short path.
      // An empty path doesn't work because some Dinkumware versions
      // assert the path is non-empty.  
      {
        std::string narrow_ph;
        bool created_file( false );
        if ( !exists( file_ph )
          && (mode & std::ios_base::out) != 0
          && create_file_api( file_ph, mode ) )
        {
          created_file = true;
        }
        narrow_ph = narrow_path_api( file_ph );
        if ( narrow_ph.empty() )
        {
          if ( created_file ) remove_api( file_ph );
          narrow_ph = "\x01";
        }
        return narrow_ph;
      }
#     else
      // Dinkumware 405 and later does supply wchar_t functions
      inline const std::wstring & path_proxy( const std::wstring & file_ph,
        std::ios_base::openmode )
        { return file_ph; }
#     endif
#   endif 

      inline const std::string & path_proxy( const std::string & file_ph,
        std::ios_base::openmode )
        { return file_ph; }

    } // namespace detail

    template < class charT, class traits = std::char_traits<charT> >
    class basic_filebuf : public std::basic_filebuf<charT,traits>
    {
    private: // disallow copying
      basic_filebuf( const basic_filebuf & );
      const basic_filebuf & operator=( const basic_filebuf & ); 
    public:
      basic_filebuf() {}
      virtual ~basic_filebuf() {}

#   ifndef BOOST_FILESYSTEM_NARROW_ONLY
      template<class Path>
      typename boost::enable_if<is_basic_path<Path>,
        basic_filebuf<charT,traits> *>::type
      open( const Path & file_ph, std::ios_base::openmode mode );

      basic_filebuf<charT,traits> *
      open( const wpath & file_ph, std::ios_base::openmode mode );
#   endif

#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
      basic_filebuf<charT,traits> *
      open( const path & file_ph, std::ios_base::openmode mode );
#   endif
    };

    template < class charT, class traits = std::char_traits<charT> >
    class basic_ifstream : public std::basic_ifstream<charT,traits>
    {
    private: // disallow copying
      basic_ifstream( const basic_ifstream & );
      const basic_ifstream & operator=( const basic_ifstream & ); 
    public:
      basic_ifstream() {}

      // use two signatures, rather than one signature with default second
      // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)

#   ifndef BOOST_FILESYSTEM_NARROW_ONLY
      template<class Path>
      explicit basic_ifstream( const Path & file_ph,
        typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 );

      template<class Path>
      basic_ifstream( const Path & file_ph, std::ios_base::openmode mode,
        typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 );

      template<class Path>
      typename boost::enable_if<is_basic_path<Path>, void>::type
      open( const Path & file_ph );

      template<class Path>
      typename boost::enable_if<is_basic_path<Path>, void>::type
      open( const Path & file_ph, std::ios_base::openmode mode );

      explicit basic_ifstream( const wpath & file_ph );
      basic_ifstream( const wpath & file_ph, std::ios_base::openmode mode );
      void open( const wpath & file_ph );
      void open( const wpath & file_ph, std::ios_base::openmode mode );
#   endif

      explicit basic_ifstream( const path & file_ph );
      basic_ifstream( const path & file_ph, std::ios_base::openmode mode );
#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
      void open( const path & file_ph );
      void open( const path & file_ph, std::ios_base::openmode mode );
#   endif
      virtual ~basic_ifstream() {}
    };

    template < class charT, class traits = std::char_traits<charT> >
    class basic_ofstream : public std::basic_ofstream<charT,traits>
    {
    private: // disallow copying
      basic_ofstream( const basic_ofstream & );
      const basic_ofstream & operator=( const basic_ofstream & ); 
    public:
      basic_ofstream() {}

      // use two signatures, rather than one signature with default second
      // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)

#   ifndef BOOST_FILESYSTEM_NARROW_ONLY

      template<class Path>
      explicit basic_ofstream( const Path & file_ph,
        typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 );
      explicit basic_ofstream( const wpath & file_ph );

      template<class Path>
      basic_ofstream( const Path & file_ph, std::ios_base::openmode mode,
        typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 );
      basic_ofstream( const wpath & file_ph, std::ios_base::openmode mode );

      template<class Path>
      typename boost::enable_if<is_basic_path<Path>, void>::type
      open( const Path & file_ph );
      void open( const wpath & file_ph );

      template<class Path>
      typename boost::enable_if<is_basic_path<Path>, void>::type
      open( const Path & file_ph, std::ios_base::openmode mode );
      void open( const wpath & file_ph, std::ios_base::openmode mode );

#   endif

      explicit basic_ofstream( const path & file_ph );
      basic_ofstream( const path & file_ph, std::ios_base::openmode mode );
#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
      void open( const path & file_ph );
      void open( const path & file_ph, std::ios_base::openmode mode );
#   endif
      virtual ~basic_ofstream() {}
    };

    template < class charT, class traits = std::char_traits<charT> >
    class basic_fstream : public std::basic_fstream<charT,traits>
    {
    private: // disallow copying
      basic_fstream( const basic_fstream & );
      const basic_fstream & operator=( const basic_fstream & ); 
    public:
      basic_fstream() {}

      // use two signatures, rather than one signature with default second
      // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416)

#   ifndef BOOST_FILESYSTEM_NARROW_ONLY

      template<class Path>
      explicit basic_fstream( const Path & file_ph,
        typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 );
      explicit basic_fstream( const wpath & file_ph );

      template<class Path>
      basic_fstream( const Path & file_ph, std::ios_base::openmode mode,
        typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 );
      basic_fstream( const wpath & file_ph, std::ios_base::openmode mode );

      template<class Path>
      typename boost::enable_if<is_basic_path<Path>, void>::type
      open( const Path & file_ph );
      void open( const wpath & file_ph );

      template<class Path>
      typename boost::enable_if<is_basic_path<Path>, void>::type
      open( const Path & file_ph, std::ios_base::openmode mode );
      void open( const wpath & file_ph, std::ios_base::openmode mode );

#   endif

      explicit basic_fstream( const path & file_ph );
      basic_fstream( const path & file_ph, std::ios_base::openmode mode );
#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
      void open( const path & file_ph );
      void open( const path & file_ph, std::ios_base::openmode mode );
#   endif
      virtual ~basic_fstream() {}

    };
 
    typedef basic_filebuf<char> filebuf;
    typedef basic_ifstream<char> ifstream;
    typedef basic_ofstream<char> ofstream;
    typedef basic_fstream<char> fstream;

# ifndef BOOST_FILESYSTEM_NARROW_ONLY
    typedef basic_filebuf<wchar_t> wfilebuf;
    typedef basic_ifstream<wchar_t> wifstream;
    typedef basic_fstream<wchar_t> wfstream;
    typedef basic_ofstream<wchar_t> wofstream;
# endif
    
# ifndef BOOST_FILESYSTEM_NARROW_ONLY

//  basic_filebuf definitions  -----------------------------------------------//

    template <class charT, class traits>
    template<class Path>
    typename boost::enable_if<is_basic_path<Path>,
      basic_filebuf<charT,traits> *>::type
    basic_filebuf<charT,traits>::open( const Path & file_ph,
      std::ios_base::openmode mode )
    {
      return (std::basic_filebuf<charT,traits>::open( detail::path_proxy(
        file_ph.external_file_string(), mode ).c_str(), mode )
          == 0) ? 0 : this;
    }

    template <class charT, class traits>
    basic_filebuf<charT,traits> *
    basic_filebuf<charT, traits>::open( const wpath & file_ph,
      std::ios_base::openmode mode )
    {
      return this->BOOST_NESTED_TEMPLATE open<wpath>( file_ph, mode );
    }

//  basic_ifstream definitions  ----------------------------------------------//

    template <class charT, class traits> template<class Path>
    basic_ifstream<charT,traits>::basic_ifstream(const Path & file_ph,
      typename boost::enable_if<is_basic_path<Path> >::type* )
      : std::basic_ifstream<charT,traits>(
        detail::path_proxy( file_ph.external_file_string(),
          std::ios_base::in ).c_str(), std::ios_base::in ) {}

    template <class charT, class traits>
    basic_ifstream<charT,traits>::basic_ifstream( const wpath & file_ph )
      : std::basic_ifstream<charT,traits>(
        detail::path_proxy( file_ph.external_file_string(),
          std::ios_base::in ).c_str(), std::ios_base::in ) {}
    
    template <class charT, class traits> template<class Path>
    basic_ifstream<charT,traits>::basic_ifstream( const Path & file_ph,
      std::ios_base::openmode mode,
      typename boost::enable_if<is_basic_path<Path> >::type* )
      : std::basic_ifstream<charT,traits>(
        detail::path_proxy( file_ph.external_file_string(),
          mode ).c_str(), mode | std::ios_base::in ) {}

    template <class charT, class traits>
    basic_ifstream<charT,traits>::basic_ifstream( const wpath & file_ph,
      std::ios_base::openmode mode )
      : std::basic_ifstream<charT,traits>(
        detail::path_proxy( file_ph.external_file_string(),
          mode ).c_str(), mode | std::ios_base::in ) {}

    template <class charT, class traits> template<class Path>
    typename boost::enable_if<is_basic_path<Path>, void>::type
    basic_ifstream<charT,traits>::open( const Path & file_ph )
    {
      std::basic_ifstream<charT,traits>::open(
        detail::path_proxy( file_ph.external_file_string(),
          std::ios_base::in ).c_str(), std::ios_base::in );
    }

    template <class charT, class traits>
    void basic_ifstream<charT,traits>::open( const wpath & file_ph )
    {
      std::basic_ifstream<charT,traits>::open(
        detail::path_proxy( file_ph.external_file_string(),
          std::ios_base::in ).c_str(), std::ios_base::in );
    }
    
    template <class charT, class traits> template<class Path>
    typename boost::enable_if<is_basic_path<Path>, void>::type
    basic_ifstream<charT,traits>::open( const Path & file_ph,
      std::ios_base::openmode mode )
    {
      std::basic_ifstream<charT,traits>::open(
        detail::path_proxy( file_ph.external_file_string(),
          mode ).c_str(), mode | std::ios_base::in );
    }
    
    template <class charT, class traits>
    void basic_ifstream<charT,traits>::open( const wpath & file_ph,
      std::ios_base::openmode mode )
    {
      std::basic_ifstream<charT,traits>::open(
        detail::path_proxy( file_ph.external_file_string(),
          mode ).c_str(), mode | std::ios_base::in );
    }

//  basic_ofstream definitions  ----------------------------------------------//

    template <class charT, class traits> template<class Path>
    basic_ofstream<charT,traits>::basic_ofstream(const Path & file_ph,
      typename boost::enable_if<is_basic_path<Path> >::type* )
      : std::basic_ofstream<charT,traits>(
        detail::path_proxy( file_ph.external_file_string(),
          std::ios_base::out ).c_str(), std::ios_base::out ) {}

    template <class charT, class traits>
    basic_ofstream<charT,traits>::basic_ofstream( const wpath & file_ph )
      : std::basic_ofstream<charT,traits>(
        detail::path_proxy( file_ph.external_file_string(),
          std::ios_base::out ).c_str(), std::ios_base::out ) {}

    template <class charT, class traits> template<class Path>
    basic_ofstream<charT,traits>::basic_ofstream( const Path & file_ph,
      std::ios_base::openmode mode,
      typename boost::enable_if<is_basic_path<Path> >::type* )
      : std::basic_ofstream<charT,traits>(
        detail::path_proxy( file_ph.external_file_string(),
          mode ).c_str(), mode | std::ios_base::out ) {}

    template <class charT, class traits>
    basic_ofstream<charT,traits>::basic_ofstream( const wpath & file_ph,
      std::ios_base::openmode mode )
      : std::basic_ofstream<charT,traits>(
        detail::path_proxy( file_ph.external_file_string(),
          mode ).c_str(), mode | std::ios_base::out ) {}
    
    template <class charT, class traits> template<class Path>
    typename boost::enable_if<is_basic_path<Path>, void>::type
    basic_ofstream<charT,traits>::open( const Path & file_ph )
    {
      std::basic_ofstream<charT,traits>::open(
        detail::path_proxy( file_ph.external_file_string(),
          std::ios_base::out ).c_str(), std::ios_base::out );
    }
    
    template <class charT, class traits>
    void basic_ofstream<charT,traits>::open( const wpath & file_ph )
    {
      std::basic_ofstream<charT,traits>::open(
        detail::path_proxy( file_ph.external_file_string(),
          std::ios_base::out ).c_str(), std::ios_base::out );
    }
    
    template <class charT, class traits> template<class Path>
    typename boost::enable_if<is_basic_path<Path>, void>::type
    basic_ofstream<charT,traits>::open( const Path & file_ph,
      std::ios_base::openmode mode )
    {
      std::basic_ofstream<charT,traits>::open(
        detail::path_proxy( file_ph.external_file_string(),
          mode ).c_str(), mode | std::ios_base::out );
    }

    template <class charT, class traits>
    void basic_ofstream<charT,traits>::open( const wpath & file_ph,
      std::ios_base::openmode mode )
    {
      std::basic_ofstream<charT,traits>::open(
        detail::path_proxy( file_ph.external_file_string(),
          mode ).c_str(), mode | std::ios_base::out );
    }

//  basic_fstream definitions  -----------------------------------------------//

    template <class charT, class traits> template<class Path>
    basic_fstream<charT,traits>::basic_fstream(const Path & file_ph,
      typename boost::enable_if<is_basic_path<Path> >::type* )
      : std::basic_fstream<charT,traits>(
        detail::path_proxy( file_ph.external_file_string(),
          std::ios_base::in|std::ios_base::out ).c_str(),
          std::ios_base::in|std::ios_base::out ) {}

    template <class charT, class traits>
    basic_fstream<charT,traits>::basic_fstream( const wpath & file_ph )
      : std::basic_fstream<charT,traits>(
        detail::path_proxy( file_ph.external_file_string(),
          std::ios_base::in|std::ios_base::out ).c_str(),
          std::ios_base::in|std::ios_base::out ) {}

    template <class charT, class traits> template<class Path>
    basic_fstream<charT,traits>::basic_fstream( const Path & file_ph,
      std::ios_base::openmode mode,
      typename boost::enable_if<is_basic_path<Path> >::type* )
      : std::basic_fstream<charT,traits>(
        detail::path_proxy( file_ph.external_file_string(),
          mode ).c_str(), mode | std::ios_base::in | std::ios_base::out ) {}
    
    template <class charT, class traits>
    basic_fstream<charT,traits>::basic_fstream( const wpath & file_ph,
      std::ios_base::openmode mode )
      : std::basic_fstream<charT,traits>(
        detail::path_proxy( file_ph.external_file_string(),
          mode ).c_str(), mode | std::ios_base::in | std::ios_base::out ) {}
      
    template <class charT, class traits> template<class Path>
    typename boost::enable_if<is_basic_path<Path>, void>::type
    basic_fstream<charT,traits>::open( const Path & file_ph )
    {
      std::basic_fstream<charT,traits>::open(
        detail::path_proxy( file_ph.external_file_string(),
          std::ios_base::in|std::ios_base::out ).c_str(),
          std::ios_base::in|std::ios_base::out );
    }

    template <class charT, class traits>
    void basic_fstream<charT,traits>::open( const wpath & file_ph )
    {
      std::basic_fstream<charT,traits>::open(
        detail::path_proxy( file_ph.external_file_string(),
          std::ios_base::in|std::ios_base::out ).c_str(),
          std::ios_base::in|std::ios_base::out );
    }
    
    template <class charT, class traits> template<class Path>
    typename boost::enable_if<is_basic_path<Path>, void>::type
    basic_fstream<charT,traits>::open( const Path & file_ph,
      std::ios_base::openmode mode )
    {
      std::basic_fstream<charT,traits>::open(
        detail::path_proxy( file_ph.external_file_string(),
          mode ).c_str(), mode | std::ios_base::in | std::ios_base::out );
    }

    template <class charT, class traits>
    void basic_fstream<charT,traits>::open( const wpath & file_ph,
      std::ios_base::openmode mode )
    {
      std::basic_fstream<charT,traits>::open(
        detail::path_proxy( file_ph.external_file_string(),
          mode ).c_str(), mode | std::ios_base::in | std::ios_base::out );
    }

# endif

#  if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
    template <class charT, class traits>
    basic_filebuf<charT,traits> *
    basic_filebuf<charT, traits>::open( const path & file_ph,
      std::ios_base::openmode mode )
    {
      return std::basic_filebuf<charT,traits>::open(
        file_ph.file_string().c_str(), mode ) == 0 ? 0 : this;
    }
#  endif

    template <class charT, class traits>
    basic_ifstream<charT,traits>::basic_ifstream( const path & file_ph )
      : std::basic_ifstream<charT,traits>(
          file_ph.file_string().c_str(), std::ios_base::in ) {}

    template <class charT, class traits>
    basic_ifstream<charT,traits>::basic_ifstream( const path & file_ph,
      std::ios_base::openmode mode )
      : std::basic_ifstream<charT,traits>(
          file_ph.file_string().c_str(), mode ) {}
    
#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
    template <class charT, class traits>
    void basic_ifstream<charT,traits>::open( const path & file_ph )
    {
      std::basic_ifstream<charT,traits>::open(
        file_ph.file_string().c_str(), std::ios_base::in );
    }
    
    template <class charT, class traits>
    void basic_ifstream<charT,traits>::open( const path & file_ph,
      std::ios_base::openmode mode )
    {
      std::basic_ifstream<charT,traits>::open(
        file_ph.file_string().c_str(), mode );
    }
#   endif

    template <class charT, class traits>
    basic_ofstream<charT,traits>::basic_ofstream( const path & file_ph )
      : std::basic_ofstream<charT,traits>(
          file_ph.file_string().c_str(), std::ios_base::out ) {}

    template <class charT, class traits>
    basic_ofstream<charT,traits>::basic_ofstream( const path & file_ph,
      std::ios_base::openmode mode )
      : std::basic_ofstream<charT,traits>(
          file_ph.file_string().c_str(), mode ) {}
    
#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
    template <class charT, class traits>
    void basic_ofstream<charT,traits>::open( const path & file_ph )
    {
      std::basic_ofstream<charT,traits>::open(
        file_ph.file_string().c_str(), std::ios_base::out );
    }
    
    template <class charT, class traits>
    void basic_ofstream<charT,traits>::open( const path & file_ph,
      std::ios_base::openmode mode )
    {
      std::basic_ofstream<charT,traits>::open(
        file_ph.file_string().c_str(), mode );
    }
#   endif

    template <class charT, class traits>
    basic_fstream<charT,traits>::basic_fstream( const path & file_ph )
      : std::basic_fstream<charT,traits>(
          file_ph.file_string().c_str(),
          std::ios_base::in|std::ios_base::out ) {}


    template <class charT, class traits>
    basic_fstream<charT,traits>::basic_fstream( const path & file_ph,
      std::ios_base::openmode mode )
      : std::basic_fstream<charT,traits>(
          file_ph.file_string().c_str(), mode ) {}

#   if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
    template <class charT, class traits>
    void basic_fstream<charT,traits>::open( const path & file_ph )
    {
      std::basic_fstream<charT,traits>::open(
        file_ph.file_string().c_str(), std::ios_base::in|std::ios_base::out );
    }

    template <class charT, class traits>
    void basic_fstream<charT,traits>::open( const path & file_ph,
      std::ios_base::openmode mode )
    {
      std::basic_fstream<charT,traits>::open(
        file_ph.file_string().c_str(), mode );
    }
#   endif
  } // namespace filesystem
} // namespace boost

#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
#endif  // BOOST_FILESYSTEM_FSTREAM_HPP