[/============================================================================== Copyright (C) 2001-2010 Joel de Guzman Copyright (C) 2001-2005 Dan Marsden Copyright (C) 2001-2010 Thomas Heller 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) ===============================================================================/] [section Custom Terminals] Custom Terminals are used in Phoenix to handle special values transparently. For example, as Phoenix captures everything by value, we needed to use `boost::reference_wrapper` to bring reference semantics into Phoenix. Custom terminals could be any wrapper class: template struct is_custom_terminal; needs to be specialized in order for Phoenix to recognize this wrapper type. `default_action` calls `custom_terminal`. Example: // Call out boost::reference_wrapper for special handling template struct is_custom_terminal > : mpl::true_ {}; // Special handling for boost::reference_wrapper template struct custom_terminal > { typedef T &result_type; template T &operator()(boost::reference_wrapper r, Context &) const { return r; } }; [endsect]