![]() |
|
|||
File indexing completed on 2025-07-14 08:27:45
0001 /* 0002 * Copyright Andrey Semashev 2022. 0003 * Distributed under the Boost Software License, Version 1.0. 0004 * (See accompanying file LICENSE_1_0.txt or copy at 0005 * http://www.boost.org/LICENSE_1_0.txt) 0006 */ 0007 /*! 0008 * \file fclose_deleter.hpp 0009 * \author Andrey Semashev 0010 * \date 21.09.2022 0011 * 0012 * This header contains an \c fclose_deleter implementation. This is a deleter 0013 * function object that invokes <tt>std::fclose</tt> on the passed pointer to 0014 * a <tt>std::FILE</tt> structure. 0015 */ 0016 0017 #ifndef BOOST_CORE_FCLOSE_DELETER_HPP 0018 #define BOOST_CORE_FCLOSE_DELETER_HPP 0019 0020 #include <cstdio> 0021 #include <boost/config.hpp> 0022 0023 #ifdef BOOST_HAS_PRAGMA_ONCE 0024 #pragma once 0025 #endif 0026 0027 namespace boost { 0028 0029 // Block unintended ADL 0030 namespace fclose_deleter_ns { 0031 0032 //! A function object that closes a file 0033 struct fclose_deleter 0034 { 0035 //! Function object result type 0036 typedef void result_type; 0037 /*! 0038 * Closes the file handle 0039 */ 0040 void operator() (std::FILE* p) const BOOST_NOEXCEPT 0041 { 0042 if (BOOST_LIKELY(!!p)) 0043 std::fclose(p); 0044 } 0045 }; 0046 0047 } // namespace fclose_deleter_ns 0048 0049 using fclose_deleter_ns::fclose_deleter; 0050 0051 } // namespace boost 0052 0053 #endif // BOOST_CORE_FCLOSE_DELETER_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |