Breath
eof_value.hpp
Go to the documentation of this file.
1 // =========================================================================
2 // Copyright 2011 Gennaro Prota
3 //
4 // Licensed under the BSD 3-Clause License.
5 // (See accompanying file BSD_3_CLAUSE_LICENSE.txt or
6 // <https://opensource.org/licenses/BSD-3-Clause>)
7 // _________________________________________________________________________
8 //
11 // -------------------------------------------------------------------------
12 //
32 // NOTE: there's no .tpp file, here; it seemed just overkill.
33 // Also, it seemed natural to add an is_eof_value(), since
34 // using eq_int_type would still require #including the
35 // <string> header.
36 // -------------------------------------------------------------------------
37 
38 #ifndef BREATH_GUARD_9qsz7UnvkOIvyedOe6ND5qSGfNeCMIU0
39 #define BREATH_GUARD_9qsz7UnvkOIvyedOe6ND5qSGfNeCMIU0
40 
41 #include <string>
42 
43 namespace breath {
44 
45 template< typename Stream >
46 typename Stream::int_type
47 eof_value( Stream const & )
48 {
49  return Stream::traits_type::eof() ;
50 }
51 
52 template< typename Stream >
53 bool
54 is_eof_value( typename Stream::int_type x, Stream const & )
55 {
56  return Stream::traits_type::eq_int_type( x,
57  Stream::traits_type::eof() ) ;
58 }
59 
60 }
61 
62 #endif
63 
64 // Local Variables:
65 // mode: c++
66 // indent-tabs-mode: nil
67 // c-basic-offset: 4
68 // End:
69 // vim: set ft=cpp et sts=4 sw=4:
A convenience source file to separate out the crazy #includes required for using EOF or char_traits<...
Definition: eof_value.hpp:43