/////////////////////////////////////////////////////////////////////////////// /// \file literal.hpp /// The literal\<\> terminal wrapper, and the proto::lit() function for /// creating literal\<\> wrappers. // // Copyright 2007 Eric Niebler. Distributed under 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) #ifndef BOOST_PROTO_LITERAL_HPP_EAN_01_03_2007 #define BOOST_PROTO_LITERAL_HPP_EAN_01_03_2007 #include #include #include #include #include #include namespace boost { namespace proto { namespace utility { template struct literal : extends::type, literal, Domain> { typedef typename terminal::type terminal_type; typedef extends, Domain> base_type; template literal(U &u) : base_type(terminal_type::make(u)) {} template literal(U const &u) : base_type(terminal_type::make(u)) {} template literal(literal const &u) : base_type(terminal_type::make(proto::arg(u))) {} using base_type::operator =; }; } /// lit /// template inline literal lit(T &t) { return literal(t); } /// \overload /// template inline literal lit(T const &t) { #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable: 4180) // warning C4180: qualifier applied to function type has no meaning; ignored #endif return literal(t); #ifdef _MSC_VER #pragma warning(pop) #endif } }} #endif