Update of /cvsroot/boost/boost/boost/fusion/sequence/adapted
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13955

Modified Files:
        mpl.hpp std_pair.hpp 
Added Files:
        struct.hpp 
Log Message:
added struct wrapping facilities to make it very easy to make any struct a 
conforming fusion sequence

--- NEW FILE: struct.hpp ---
/*=============================================================================
    Copyright (c) 2001-2006 Joel de Guzman
    Copyright (c) 2005-2006 Dan Marsden

    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)
==============================================================================*/
#if !defined(BOOST_FUSION_STRUCT_24122005_1744)
#define BOOST_FUSION_STD_STRUCT_24122005_1744

#include <boost/fusion/sequence/adapted/struct/detail/is_view_impl.hpp>
#include <boost/fusion/sequence/adapted/struct/detail/is_sequence_impl.hpp>
#include <boost/fusion/sequence/adapted/struct/detail/category_of_impl.hpp>
#include <boost/fusion/sequence/adapted/struct/detail/begin_impl.hpp>
#include <boost/fusion/sequence/adapted/struct/detail/end_impl.hpp>
#include <boost/fusion/sequence/adapted/struct/detail/size_impl.hpp>
#include <boost/fusion/sequence/adapted/struct/detail/at_impl.hpp>
#include <boost/fusion/sequence/adapted/struct/detail/value_at_impl.hpp>

#endif

Index: mpl.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/fusion/sequence/adapted/mpl.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- mpl.hpp     26 Mar 2007 18:05:18 -0000      1.3
+++ mpl.hpp     2 Apr 2007 03:31:12 -0000       1.4
@@ -2,13 +2,12 @@
     Copyright (c) 2001-2006 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See 
accompanying 
+    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)
 
==============================================================================*/
 #if !defined(BOOST_FUSION_MPL_31122005_1152)
 #define BOOST_FUSION_MPL_31122005_1152
 
-#include <boost/fusion/sequence/adapted/mpl/mpl_iterator.hpp>
 #include <boost/fusion/sequence/adapted/mpl/detail/begin_impl.hpp>
 #include <boost/fusion/sequence/adapted/mpl/detail/end_impl.hpp>
 #include <boost/fusion/sequence/adapted/mpl/detail/is_sequence_impl.hpp>

Index: std_pair.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/fusion/sequence/adapted/std_pair.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- std_pair.hpp        2 Mar 2007 10:44:08 -0000       1.2
+++ std_pair.hpp        2 Apr 2007 03:31:12 -0000       1.3
@@ -2,20 +2,65 @@
     Copyright (c) 2001-2006 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
 
-    Distributed under the Boost Software License, Version 1.0. (See 
accompanying 
+    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)
 
==============================================================================*/
 #if !defined(BOOST_FUSION_STD_PAIR_24122005_1744)
 #define BOOST_FUSION_STD_PAIR_24122005_1744
 
-#include <boost/fusion/sequence/adapted/std_pair/tag_of.hpp>
-#include <boost/fusion/sequence/adapted/std_pair/detail/is_view_impl.hpp>
-#include <boost/fusion/sequence/adapted/std_pair/detail/is_sequence_impl.hpp>
-#include <boost/fusion/sequence/adapted/std_pair/detail/category_of_impl.hpp>
-#include <boost/fusion/sequence/adapted/std_pair/detail/begin_impl.hpp>
-#include <boost/fusion/sequence/adapted/std_pair/detail/end_impl.hpp>
-#include <boost/fusion/sequence/adapted/std_pair/detail/size_impl.hpp>
-#include <boost/fusion/sequence/adapted/std_pair/detail/at_impl.hpp>
-#include <boost/fusion/sequence/adapted/std_pair/detail/value_at_impl.hpp>
+#include <boost/fusion/support/tag_of_fwd.hpp>
+#include <boost/fusion/sequence/adapted/struct.hpp>
+#include <boost/mpl/int.hpp>
+#include <utility>
+
+namespace boost { namespace fusion
+{
+    struct struct_tag;
+
+    namespace traits
+    {
+        template <typename T1, typename T2>
+        struct tag_of<std::pair<T1, T2> >
+        {
+            typedef struct_tag type;
+        };
+    }
+
+    namespace extension
+    {
+        template <typename Struct, int N>
+        struct struct_member;
+
+        template <typename Struct>
+        struct struct_size;
+
+        template <typename T1, typename T2>
+        struct struct_member<std::pair<T1, T2>, 0>
+        {
+            typedef T1 type;
+
+            static type& call(std::pair<T1, T2>& pair)
+            {
+                return pair.first;
+            }
+        };
+
+        template <typename T1, typename T2>
+        struct struct_member<std::pair<T1, T2>, 1>
+        {
+            typedef T2 type;
+
+            static type& call(std::pair<T1, T2>& pair)
+            {
+                return pair.second;
+            }
+        };
+
+        template <typename T1, typename T2>
+        struct struct_size<std::pair<T1, T2> > : mpl::int_<2>
+        {
+        };
+    }
+}}
 
 #endif


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to