Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:19:31

0001 //
0002 // Copyright (c) 2019-2023 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 
0008 #ifndef BOOST_MYSQL_DETAIL_ACCESS_HPP
0009 #define BOOST_MYSQL_DETAIL_ACCESS_HPP
0010 
0011 #include <utility>
0012 
0013 namespace boost {
0014 namespace mysql {
0015 namespace detail {
0016 
0017 // Exposes access to the implementation of public access, which is sometimes
0018 // required by library internals.
0019 struct access
0020 {
0021     template <class T>
0022     static decltype(std::declval<T>().impl_)& get_impl(T& obj) noexcept
0023     {
0024         return obj.impl_;
0025     }
0026 
0027     template <class T>
0028     static const decltype(std::declval<T>().impl_)& get_impl(const T& obj) noexcept
0029     {
0030         return obj.impl_;
0031     }
0032 
0033     template <class T, class... Args>
0034     static T construct(Args&&... args)
0035     {
0036         return T(std::forward<Args>(args)...);
0037     }
0038 };
0039 
0040 }  // namespace detail
0041 }  // namespace mysql
0042 }  // namespace boost
0043 
0044 #endif