annotate DEPENDENCIES/generic/include/boost/iostreams/detail/restrict_impl.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /*
Chris@16 2 * Distributed under the Boost Software License, Version 1.0.(See accompanying
Chris@16 3 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
Chris@16 4 *
Chris@16 5 * See http://www.boost.org/libs/iostreams for documentation.
Chris@16 6
Chris@16 7 * File: boost/iostreams/detail/restrict_impl.hpp
Chris@16 8 * Date: Sun Jan 06 12:57:30 MST 2008
Chris@16 9 * Copyright: 2007-2008 CodeRage, LLC
Chris@16 10 * Author: Jonathan Turkanis
Chris@16 11 * Contact: turkanis at coderage dot com
Chris@16 12 *
Chris@16 13 * If included with the macro BOOST_IOSTREAMS_RESTRICT undefined, defines the
Chris@16 14 * class template boost::iostreams::restriction. If included with the macro
Chris@16 15 * BOOST_IOSTREAMS_RESTRICT defined as an identifier, defines the overloaded
Chris@16 16 * function template boost::iostreams::BOOST_IOSTREAMS_RESTRICT, and object
Chris@16 17 * generator for boost::iostreams::restriction.
Chris@16 18 *
Chris@16 19 * This design allows <boost/iostreams/restrict.hpp> and
Chris@16 20 * <boost/iostreams/slice.hpp> to share an implementation.
Chris@16 21 */
Chris@16 22
Chris@16 23 #if !defined(BOOST_IOSTREAMS_RESTRICT_IMPL_HPP_INCLUDED) && \
Chris@16 24 !defined(BOOST_IOSTREAMS_RESTRICT)
Chris@16 25 # define BOOST_IOSTREAMS_RESTRICT_IMPL_HPP_INCLUDED
Chris@16 26
Chris@16 27 //------------------Implementation of restriction-----------------------------//
Chris@16 28
Chris@16 29 # include <algorithm> // min.
Chris@16 30 # include <utility> // pair.
Chris@16 31 # include <boost/cstdint.hpp> // intmax_t.
Chris@16 32 # include <boost/config.hpp> // DEDUCED_TYPENAME.
Chris@16 33 # include <boost/iostreams/categories.hpp>
Chris@16 34 # include <boost/iostreams/char_traits.hpp>
Chris@16 35 # include <boost/iostreams/detail/adapter/device_adapter.hpp>
Chris@16 36 # include <boost/iostreams/detail/adapter/filter_adapter.hpp>
Chris@16 37 # include <boost/iostreams/detail/call_traits.hpp>
Chris@16 38 # include <boost/iostreams/detail/enable_if_stream.hpp>
Chris@16 39 # include <boost/iostreams/detail/error.hpp>
Chris@16 40 # include <boost/iostreams/detail/ios.hpp> // failure.
Chris@16 41 # include <boost/iostreams/detail/select.hpp>
Chris@16 42 # include <boost/iostreams/operations.hpp>
Chris@16 43 # include <boost/iostreams/skip.hpp>
Chris@16 44 # include <boost/iostreams/traits.hpp> // mode_of, is_direct.
Chris@16 45 # include <boost/mpl/bool.hpp>
Chris@16 46 # include <boost/static_assert.hpp>
Chris@16 47 # include <boost/throw_exception.hpp>
Chris@16 48 # include <boost/type_traits/is_convertible.hpp>
Chris@16 49
Chris@16 50 # include <boost/iostreams/detail/config/disable_warnings.hpp>
Chris@16 51
Chris@16 52 namespace boost { namespace iostreams {
Chris@16 53
Chris@16 54 namespace detail {
Chris@16 55
Chris@16 56 //
Chris@16 57 // Template name: restricted_indirect_device.
Chris@16 58 // Description: Provides an restricted view of an indirect Device.
Chris@16 59 // Template parameters:
Chris@16 60 // Device - An indirect model of Device that models either Source or
Chris@16 61 // SeekableDevice.
Chris@16 62 //
Chris@16 63 template<typename Device>
Chris@16 64 class restricted_indirect_device : public device_adapter<Device> {
Chris@16 65 private:
Chris@16 66 typedef typename detail::param_type<Device>::type param_type;
Chris@16 67 public:
Chris@16 68 typedef typename char_type_of<Device>::type char_type;
Chris@16 69 typedef typename mode_of<Device>::type mode;
Chris@16 70 BOOST_STATIC_ASSERT(!(is_convertible<mode, detail::two_sequence>::value));
Chris@16 71 struct category
Chris@16 72 : mode,
Chris@16 73 device_tag,
Chris@16 74 closable_tag,
Chris@16 75 flushable_tag,
Chris@16 76 localizable_tag,
Chris@16 77 optimally_buffered_tag
Chris@16 78 { };
Chris@16 79 restricted_indirect_device( param_type dev, stream_offset off,
Chris@16 80 stream_offset len = -1 );
Chris@16 81 std::streamsize read(char_type* s, std::streamsize n);
Chris@16 82 std::streamsize write(const char_type* s, std::streamsize n);
Chris@16 83 std::streampos seek(stream_offset off, BOOST_IOS::seekdir way);
Chris@16 84 private:
Chris@16 85 stream_offset beg_, pos_, end_;
Chris@16 86 };
Chris@16 87
Chris@16 88 //
Chris@16 89 // Template name: restricted_direct_device.
Chris@16 90 // Description: Provides an restricted view of a Direct Device.
Chris@16 91 // Template parameters:
Chris@16 92 // Device - A model of Direct and Device.
Chris@16 93 //
Chris@16 94 template<typename Device>
Chris@16 95 class restricted_direct_device : public device_adapter<Device> {
Chris@16 96 public:
Chris@16 97 typedef typename char_type_of<Device>::type char_type;
Chris@16 98 typedef std::pair<char_type*, char_type*> pair_type;
Chris@16 99 typedef typename mode_of<Device>::type mode;
Chris@16 100 BOOST_STATIC_ASSERT(!(is_convertible<mode, detail::two_sequence>::value));
Chris@16 101 struct category
Chris@16 102 : mode_of<Device>::type,
Chris@16 103 device_tag,
Chris@16 104 direct_tag,
Chris@16 105 closable_tag,
Chris@16 106 localizable_tag
Chris@16 107 { };
Chris@16 108 restricted_direct_device( const Device& dev, stream_offset off,
Chris@16 109 stream_offset len = -1 );
Chris@16 110 pair_type input_sequence();
Chris@16 111 pair_type output_sequence();
Chris@16 112 private:
Chris@16 113 pair_type sequence(mpl::true_);
Chris@16 114 pair_type sequence(mpl::false_);
Chris@16 115 char_type *beg_, *end_;
Chris@16 116 };
Chris@16 117
Chris@16 118 //
Chris@16 119 // Template name: restricted_filter.
Chris@16 120 // Description: Provides an restricted view of a Filter.
Chris@16 121 // Template parameters:
Chris@16 122 // Filter - An indirect model of Filter.
Chris@16 123 //
Chris@16 124 template<typename Filter>
Chris@16 125 class restricted_filter : public filter_adapter<Filter> {
Chris@16 126 public:
Chris@16 127 typedef typename char_type_of<Filter>::type char_type;
Chris@16 128 typedef typename mode_of<Filter>::type mode;
Chris@16 129 BOOST_STATIC_ASSERT(!(is_convertible<mode, detail::two_sequence>::value));
Chris@16 130 struct category
Chris@16 131 : mode,
Chris@16 132 filter_tag,
Chris@16 133 multichar_tag,
Chris@16 134 closable_tag,
Chris@16 135 localizable_tag,
Chris@16 136 optimally_buffered_tag
Chris@16 137 { };
Chris@16 138 restricted_filter( const Filter& flt, stream_offset off,
Chris@16 139 stream_offset len = -1 );
Chris@16 140
Chris@16 141 template<typename Source>
Chris@16 142 std::streamsize read(Source& src, char_type* s, std::streamsize n)
Chris@16 143 {
Chris@16 144 using namespace std;
Chris@16 145 if (!open_)
Chris@16 146 open(src, BOOST_IOS::in);
Chris@16 147 std::streamsize amt =
Chris@16 148 end_ != -1 ?
Chris@16 149 (std::min) (n, static_cast<std::streamsize>(end_ - pos_)) :
Chris@16 150 n;
Chris@16 151 std::streamsize result =
Chris@16 152 iostreams::read(this->component(), src, s, amt);
Chris@16 153 if (result != -1)
Chris@16 154 pos_ += result;
Chris@16 155 return result;
Chris@16 156 }
Chris@16 157
Chris@16 158 template<typename Sink>
Chris@16 159 std::streamsize write(Sink& snk, const char_type* s, std::streamsize n)
Chris@16 160 {
Chris@16 161 if (!open_)
Chris@16 162 open(snk, BOOST_IOS::out);
Chris@16 163 if (end_ != -1 && pos_ + n >= end_) {
Chris@16 164 if(pos_ < end_)
Chris@16 165 pos_ += iostreams::write(this->component(),
Chris@16 166 snk, s, end_ - pos_);
Chris@16 167 boost::throw_exception(bad_write());
Chris@16 168 }
Chris@16 169 std::streamsize result =
Chris@16 170 iostreams::write(this->component(), snk, s, n);
Chris@16 171 pos_ += result;
Chris@16 172 return result;
Chris@16 173 }
Chris@16 174
Chris@16 175 template<typename Device>
Chris@16 176 std::streampos seek(Device& dev, stream_offset off, BOOST_IOS::seekdir way)
Chris@16 177 {
Chris@16 178 stream_offset next;
Chris@16 179 if (way == BOOST_IOS::beg) {
Chris@16 180 next = beg_ + off;
Chris@16 181 } else if (way == BOOST_IOS::cur) {
Chris@16 182 next = pos_ + off;
Chris@16 183 } else if (end_ != -1) {
Chris@16 184 next = end_ + off;
Chris@16 185 } else {
Chris@16 186 // Restriction is half-open; seek relative to the actual end.
Chris@16 187 pos_ = this->component().seek(dev, off, BOOST_IOS::end);
Chris@16 188 if (pos_ < beg_)
Chris@16 189 boost::throw_exception(bad_seek());
Chris@16 190 return offset_to_position(pos_ - beg_);
Chris@16 191 }
Chris@16 192 if (next < beg_ || (end_ != -1 && next >= end_))
Chris@16 193 boost::throw_exception(bad_seek());
Chris@16 194 pos_ = this->component().seek(dev, next, BOOST_IOS::cur);
Chris@16 195 return offset_to_position(pos_ - beg_);
Chris@16 196 }
Chris@16 197
Chris@16 198 template<typename Device>
Chris@16 199 void close(Device& dev)
Chris@16 200 {
Chris@16 201 open_ = false;
Chris@16 202 detail::close_all(this->component(), dev);
Chris@16 203 }
Chris@16 204
Chris@16 205 template<typename Device>
Chris@16 206 void close(Device& dev, BOOST_IOS::openmode which)
Chris@16 207 {
Chris@16 208 open_ = false;
Chris@16 209 iostreams::close(this->component(), dev, which);
Chris@16 210 }
Chris@16 211 private:
Chris@16 212 template<typename Device>
Chris@16 213 void open(Device& dev, BOOST_IOS::openmode which)
Chris@16 214 {
Chris@16 215 typedef typename is_convertible<mode, dual_use>::type is_dual_use;
Chris@16 216 open_ = true;
Chris@16 217 which = is_dual_use() ? which : (BOOST_IOS::in | BOOST_IOS::out);
Chris@16 218 iostreams::skip(this->component(), dev, beg_, which);
Chris@16 219 }
Chris@16 220
Chris@16 221 stream_offset beg_, pos_, end_;
Chris@16 222 bool open_;
Chris@16 223 };
Chris@16 224
Chris@16 225 template<typename T>
Chris@16 226 struct restriction_traits
Chris@16 227 : iostreams::select< // Disambiguation for Tru64.
Chris@16 228 is_filter<T>, restricted_filter<T>,
Chris@16 229 is_direct<T>, restricted_direct_device<T>,
Chris@16 230 else_, restricted_indirect_device<T>
Chris@16 231 >
Chris@16 232 { };
Chris@16 233
Chris@16 234 } // End namespace detail.
Chris@16 235
Chris@16 236 template<typename T>
Chris@16 237 struct restriction : public detail::restriction_traits<T>::type {
Chris@16 238 typedef typename detail::param_type<T>::type param_type;
Chris@16 239 typedef typename detail::restriction_traits<T>::type base_type;
Chris@16 240 restriction(param_type t, stream_offset off, stream_offset len = -1)
Chris@16 241 : base_type(t, off, len)
Chris@16 242 { }
Chris@16 243 };
Chris@16 244
Chris@16 245 namespace detail {
Chris@16 246
Chris@16 247 //--------------Implementation of restricted_indirect_device------------------//
Chris@16 248
Chris@16 249 template<typename Device>
Chris@16 250 restricted_indirect_device<Device>::restricted_indirect_device
Chris@16 251 (param_type dev, stream_offset off, stream_offset len)
Chris@16 252 : device_adapter<Device>(dev), beg_(off), pos_(off),
Chris@16 253 end_(len != -1 ? off + len : -1)
Chris@16 254 {
Chris@16 255 if (len < -1 || off < 0)
Chris@16 256 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad offset"));
Chris@16 257 iostreams::skip(this->component(), off);
Chris@16 258 }
Chris@16 259
Chris@16 260 template<typename Device>
Chris@16 261 inline std::streamsize restricted_indirect_device<Device>::read
Chris@16 262 (char_type* s, std::streamsize n)
Chris@16 263 {
Chris@16 264 using namespace std;
Chris@16 265 std::streamsize amt =
Chris@16 266 end_ != -1 ?
Chris@16 267 (std::min) (n, static_cast<std::streamsize>(end_ - pos_)) :
Chris@16 268 n;
Chris@16 269 std::streamsize result = iostreams::read(this->component(), s, amt);
Chris@16 270 if (result != -1)
Chris@16 271 pos_ += result;
Chris@16 272 return result;
Chris@16 273 }
Chris@16 274
Chris@16 275 template<typename Device>
Chris@16 276 inline std::streamsize restricted_indirect_device<Device>::write
Chris@16 277 (const char_type* s, std::streamsize n)
Chris@16 278 {
Chris@16 279 if (end_ != -1 && pos_ + n >= end_) {
Chris@16 280 if(pos_ < end_)
Chris@16 281 pos_ += iostreams::write(this->component(), s, end_ - pos_);
Chris@16 282 boost::throw_exception(bad_write());
Chris@16 283 }
Chris@16 284 std::streamsize result = iostreams::write(this->component(), s, n);
Chris@16 285 pos_ += result;
Chris@16 286 return result;
Chris@16 287 }
Chris@16 288
Chris@16 289 template<typename Device>
Chris@16 290 std::streampos restricted_indirect_device<Device>::seek
Chris@16 291 (stream_offset off, BOOST_IOS::seekdir way)
Chris@16 292 {
Chris@16 293 stream_offset next;
Chris@16 294 if (way == BOOST_IOS::beg) {
Chris@16 295 next = beg_ + off;
Chris@16 296 } else if (way == BOOST_IOS::cur) {
Chris@16 297 next = pos_ + off;
Chris@16 298 } else if (end_ != -1) {
Chris@16 299 next = end_ + off;
Chris@16 300 } else {
Chris@16 301 // Restriction is half-open; seek relative to the actual end.
Chris@16 302 pos_ = iostreams::seek(this->component(), off, BOOST_IOS::end);
Chris@16 303 if (pos_ < beg_)
Chris@16 304 boost::throw_exception(bad_seek());
Chris@16 305 return offset_to_position(pos_ - beg_);
Chris@16 306 }
Chris@16 307 if (next < beg_ || (end_ != -1 && next > end_))
Chris@16 308 boost::throw_exception(bad_seek());
Chris@16 309 pos_ = iostreams::seek(this->component(), next - pos_, BOOST_IOS::cur);
Chris@16 310 return offset_to_position(pos_ - beg_);
Chris@16 311 }
Chris@16 312
Chris@16 313 //--------------Implementation of restricted_direct_device--------------------//
Chris@16 314
Chris@16 315 template<typename Device>
Chris@16 316 restricted_direct_device<Device>::restricted_direct_device
Chris@16 317 (const Device& dev, stream_offset off, stream_offset len)
Chris@16 318 : device_adapter<Device>(dev), beg_(0), end_(0)
Chris@16 319 {
Chris@16 320 std::pair<char_type*, char_type*> seq =
Chris@16 321 sequence(is_convertible<category, input>());
Chris@16 322 if ( off < 0 || len < -1 ||
Chris@16 323 (len != -1 && off + len > seq.second - seq.first) )
Chris@16 324 {
Chris@16 325 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad offset"));
Chris@16 326 }
Chris@16 327 beg_ = seq.first + off;
Chris@16 328 end_ = len != -1 ?
Chris@16 329 seq.first + off + len :
Chris@16 330 seq.second;
Chris@16 331 }
Chris@16 332
Chris@16 333 template<typename Device>
Chris@16 334 typename restricted_direct_device<Device>::pair_type
Chris@16 335 restricted_direct_device<Device>::input_sequence()
Chris@16 336 {
Chris@16 337 BOOST_STATIC_ASSERT((is_convertible<category, input>::value));
Chris@16 338 return std::make_pair(beg_, end_);
Chris@16 339 }
Chris@16 340
Chris@16 341 template<typename Device>
Chris@16 342 typename restricted_direct_device<Device>::pair_type
Chris@16 343 restricted_direct_device<Device>::output_sequence()
Chris@16 344 {
Chris@16 345 BOOST_STATIC_ASSERT((is_convertible<category, output>::value));
Chris@16 346 return std::make_pair(beg_, end_);
Chris@16 347 }
Chris@16 348
Chris@16 349 template<typename Device>
Chris@16 350 typename restricted_direct_device<Device>::pair_type
Chris@16 351 restricted_direct_device<Device>::sequence(mpl::true_)
Chris@16 352 { return iostreams::input_sequence(this->component()); }
Chris@16 353
Chris@16 354 template<typename Device>
Chris@16 355 typename restricted_direct_device<Device>::pair_type
Chris@16 356 restricted_direct_device<Device>::sequence(mpl::false_)
Chris@16 357 { return iostreams::output_sequence(this->component()); }
Chris@16 358
Chris@16 359 //--------------Implementation of restricted_filter---------------------------//
Chris@16 360
Chris@16 361 template<typename Filter>
Chris@16 362 restricted_filter<Filter>::restricted_filter
Chris@16 363 (const Filter& flt, stream_offset off, stream_offset len)
Chris@16 364 : filter_adapter<Filter>(flt), beg_(off),
Chris@16 365 pos_(off), end_(len != -1 ? off + len : -1), open_(false)
Chris@16 366 {
Chris@16 367 if (len < -1 || off < 0)
Chris@16 368 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad offset"));
Chris@16 369 }
Chris@16 370
Chris@16 371 } // End namespace detail.
Chris@16 372
Chris@16 373 } } // End namespaces iostreams, boost.
Chris@16 374
Chris@16 375 #elif defined(BOOST_IOSTREAMS_RESTRICT)
Chris@16 376
Chris@16 377 namespace boost { namespace iostreams {
Chris@16 378
Chris@16 379 //--------------Implementation of restrict/slice------------------------------//
Chris@16 380
Chris@16 381 // Note: The following workarounds are patterned after resolve.hpp. It has not
Chris@16 382 // yet been confirmed that they are necessary.
Chris@16 383
Chris@16 384 # ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //------------------------//
Chris@16 385 # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //------------------------------//
Chris@16 386
Chris@16 387 template<typename T>
Chris@16 388 restriction<T>
Chris@16 389 BOOST_IOSTREAMS_RESTRICT( const T& t, stream_offset off, stream_offset len = -1
Chris@16 390 BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) )
Chris@16 391 { return restriction<T>(t, off, len); }
Chris@16 392
Chris@16 393 template<typename Ch, typename Tr>
Chris@16 394 restriction< std::basic_streambuf<Ch, Tr> >
Chris@16 395 BOOST_IOSTREAMS_RESTRICT( std::basic_streambuf<Ch, Tr>& sb, stream_offset off,
Chris@16 396 stream_offset len = -1 )
Chris@16 397 { return restriction< std::basic_streambuf<Ch, Tr> >(sb, off, len); }
Chris@16 398
Chris@16 399 template<typename Ch, typename Tr>
Chris@16 400 restriction< std::basic_istream<Ch, Tr> >
Chris@16 401 BOOST_IOSTREAMS_RESTRICT
Chris@16 402 (std::basic_istream<Ch, Tr>& is, stream_offset off, stream_offset len = -1)
Chris@16 403 { return restriction< std::basic_istream<Ch, Tr> >(is, off, len); }
Chris@16 404
Chris@16 405 template<typename Ch, typename Tr>
Chris@16 406 restriction< std::basic_ostream<Ch, Tr> >
Chris@16 407 BOOST_IOSTREAMS_RESTRICT
Chris@16 408 (std::basic_ostream<Ch, Tr>& os, stream_offset off, stream_offset len = -1)
Chris@16 409 { return restriction< std::basic_ostream<Ch, Tr> >(os, off, len); }
Chris@16 410
Chris@16 411 template<typename Ch, typename Tr>
Chris@16 412 restriction< std::basic_iostream<Ch, Tr> >
Chris@16 413 BOOST_IOSTREAMS_RESTRICT
Chris@16 414 (std::basic_iostream<Ch, Tr>& io, stream_offset off, stream_offset len = -1)
Chris@16 415 { return restriction< std::basic_iostream<Ch, Tr> >(io, off, len); }
Chris@16 416
Chris@16 417 # else // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //--------------------//
Chris@16 418
Chris@16 419 template<typename T>
Chris@16 420 restriction<T>
Chris@16 421 BOOST_IOSTREAMS_RESTRICT( const T& t, stream_offset off, stream_offset len = -1
Chris@16 422 BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) )
Chris@16 423 { return restriction<T>(t, off, len); }
Chris@16 424
Chris@16 425 restriction<std::streambuf>
Chris@16 426 BOOST_IOSTREAMS_RESTRICT
Chris@16 427 (std::streambuf& sb, stream_offset off, stream_offset len = -1)
Chris@16 428 { return restriction<std::streambuf>(sb, off, len); }
Chris@16 429
Chris@16 430 restriction<std::istream>
Chris@16 431 BOOST_IOSTREAMS_RESTRICT
Chris@16 432 (std::istream<Ch, Tr>& is, stream_offset off, stream_offset len = -1)
Chris@16 433 { return restriction<std::istream>(is, off, len); }
Chris@16 434
Chris@16 435 restriction<std::ostream>
Chris@16 436 BOOST_IOSTREAMS_RESTRICT
Chris@16 437 (std::ostream<Ch, Tr>& os, stream_offset off, stream_offset len = -1)
Chris@16 438 { return restriction<std::ostream>(os, off, len); }
Chris@16 439
Chris@16 440 restriction<std::iostream>
Chris@16 441 BOOST_IOSTREAMS_RESTRICT
Chris@16 442 (std::iostream<Ch, Tr>& io, stream_offset off, stream_offset len = -1)
Chris@16 443 { return restriction<std::iostream>(io, off, len); }
Chris@16 444
Chris@16 445 # endif // # ifndef BOOST_IOSTREAMS_NO_STREAM_TEMPLATES //-------------------//
Chris@16 446 # else // #ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //---------------//
Chris@16 447
Chris@16 448 template<typename T>
Chris@16 449 restriction<T>
Chris@16 450 BOOST_IOSTREAMS_RESTRICT
Chris@16 451 (const T& t, stream_offset off, stream_offset len, mpl::true_)
Chris@16 452 { // Bad overload resolution.
Chris@16 453 return restriction<T>(const_cast<T&>(t, off, len));
Chris@16 454 }
Chris@16 455
Chris@16 456 template<typename T>
Chris@16 457 restriction<T>
Chris@16 458 BOOST_IOSTREAMS_RESTRICT
Chris@16 459 (const T& t, stream_offset off, stream_offset len, mpl::false_)
Chris@16 460 { return restriction<T>(t, off, len); }
Chris@16 461
Chris@16 462 template<typename T>
Chris@16 463 restriction<T>
Chris@16 464 BOOST_IOSTREAMS_RESTRICT( const T& t, stream_offset off, stream_offset len = -1
Chris@16 465 BOOST_IOSTREAMS_DISABLE_IF_STREAM(T) )
Chris@16 466 { return BOOST_IOSTREAMS_RESTRICT(t, off, len, is_std_io<T>()); }
Chris@16 467
Chris@16 468 # if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && \
Chris@16 469 !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && \
Chris@16 470 !defined(__GNUC__) // ---------------------------------------------------//
Chris@16 471
Chris@16 472 template<typename T>
Chris@16 473 restriction<T>
Chris@16 474 BOOST_IOSTREAMS_RESTRICT(T& t, stream_offset off, stream_offset len = -1)
Chris@16 475 { return restriction<T>(t, off, len); }
Chris@16 476
Chris@16 477 # endif // Borland 5.x, VC6-7.0 or GCC 2.9x //-------------------------------//
Chris@16 478 # endif // #ifndef BOOST_IOSTREAMS_BROKEN_OVERLOAD_RESOLUTION //--------------//
Chris@16 479
Chris@16 480 } } // End namespaces iostreams, boost.
Chris@16 481
Chris@16 482 #endif // #if !defined(BOOST_IOSTREAMS_RESTRICT_IMPL_HPP_INCLUDED) ...