Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52585 - in sandbox/SOC/2009/fusion: mini-fusion workaround/conceptgcc
From: mr.chr.schmidt_at_[hidden]
Date: 2009-04-24 20:05:52


Author: cschmidt
Date: 2009-04-24 20:05:51 EDT (Fri, 24 Apr 2009)
New Revision: 52585
URL: http://svn.boost.org/trac/boost/changeset/52585

Log:
Added Copy-constructors
Text files modified:
   sandbox/SOC/2009/fusion/mini-fusion/concepts.hpp | 28 +++++-----------------------
   sandbox/SOC/2009/fusion/mini-fusion/convenience.hpp | 13 +++++++++----
   sandbox/SOC/2009/fusion/mini-fusion/test.cpp | 19 +++++++++++++++++--
   sandbox/SOC/2009/fusion/mini-fusion/vector.hpp | 23 +++++++++++++++++++++++
   sandbox/SOC/2009/fusion/workaround/conceptgcc/utility | 2 ++
   5 files changed, 56 insertions(+), 29 deletions(-)

Modified: sandbox/SOC/2009/fusion/mini-fusion/concepts.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/mini-fusion/concepts.hpp (original)
+++ sandbox/SOC/2009/fusion/mini-fusion/concepts.hpp 2009-04-24 20:05:51 EDT (Fri, 24 Apr 2009)
@@ -6,42 +6,23 @@
 
 //Based on these concepts the convenience functions are implemented!
 
-/*auto concept MetaFunction<class Type>
-{
- typename type;
-}
-
+/*
 auto concept ForwardIterator<class Type>
 {
- MetaFunction get_next;
 }
 
 auto concept BidirectionalIterator<class Type>
 {
         requires ForwardIterator<Type>;
-
- MetaFunction get_prior;
 }
 
 auto concept RandomAccessIterator<class Type>
 {
- MetaFunction advance;
- MetaFunction get_distance;
-}
-
-auto concept FusionSequence<class Type>
-{
- class get_begin;
- //MetaFunction get_begin;
- //requires MetaFunction<get_next>;
- MetaFunction get_end;
+ requires BidirectionalIterator<Type>;
 }
 
 auto concept ForwardSequence<class Type>
 {
- requires FusionSequence<Type>;
-
- MetaFunction get_size;
 }
 
 auto concept BidirectionalSequence<class Type>
@@ -51,5 +32,6 @@
 
 auto concept RandomAccessSequence<class Type>
 {
- requires FusionSequence<Type>;
-}*/
+ requires BidirectionalSequence<Type>;
+}
+*/

Modified: sandbox/SOC/2009/fusion/mini-fusion/convenience.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/mini-fusion/convenience.hpp (original)
+++ sandbox/SOC/2009/fusion/mini-fusion/convenience.hpp 2009-04-24 20:05:51 EDT (Fri, 24 Apr 2009)
@@ -4,7 +4,7 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 #pragma once
 
-//TODO: constexpr!!!
+//TODO: constexpr
 
 #include <type_traits>
 #include <cstddef>
@@ -14,6 +14,12 @@
 namespace boost{namespace fusion{namespace gsoc{
         namespace detail
         {
+ template<class IteratorA,class IteratorB>class is_compareable
+ {
+ static_assert(std::is_same<typename IteratorA::tag,typename IteratorB::tag>::value,"Different iterator types specified");
+ static_assert(std::is_same<typename IteratorA::sequence,typename IteratorB::sequence>::value,"Different iterator sequences");
+ };
+
                 template<class Arg>class always_false
                 {
                 public:
@@ -104,10 +110,9 @@
                 }
 
                 template<class IteratorA,class IteratorB>class distance:
+ private detail::is_compareable<IteratorA,IteratorB>,
                         public impl::distance<typename IteratorA::tag>::template apply<IteratorA,IteratorB>
                 {
- //!!!
- static_assert(std::is_same<typename IteratorA::tag,typename IteratorB::tag>::value,"Different iterator types specified");
                 };
         }
         template<class IteratorA,class IteratorB> typename result_of::distance<IteratorA,IteratorB>::type
@@ -197,9 +202,9 @@
                 }
 
                 template<class IteratorA,class IteratorB>class equal_to:
+ private detail::is_compareable<IteratorA,IteratorB>,
                         public impl::equal_to<typename IteratorA::tag>::template apply<IteratorA,IteratorB>
                 {
- static_assert(std::is_same<typename IteratorA::tag,typename IteratorB::tag>::value,"Different iterator types specified");
                 };
         }
         template<class IteratorA,class IteratorB> typename result_of::equal_to<IteratorA,IteratorB>::type

Modified: sandbox/SOC/2009/fusion/mini-fusion/test.cpp
==============================================================================
--- sandbox/SOC/2009/fusion/mini-fusion/test.cpp (original)
+++ sandbox/SOC/2009/fusion/mini-fusion/test.cpp 2009-04-24 20:05:51 EDT (Fri, 24 Apr 2009)
@@ -99,16 +99,31 @@
                 }
 
                 {
- const bt b(0xDEADBEEF,1337.0f,42);
+ bt b(0xDEADBEEF,1337.0f,42);
 
                         using namespace gsoc;
                         assert(deref(begin(b))==0xDEADBEEF);
- //at_c<0>(b)=0xBEEFDEEF;
+ at_c<0>(b)=0xBEEFDEEF;
                         assert(at_c<0>(b)==0xBEEFDEEF);
                 }
         }
 
         {
+ using namespace gsoc;
+ //equal_to(begin(vector<long long>()),begin(vector<int>()));
+ assert(equal_to(begin(vector<long long>()),begin(vector<long long>()))==true);
+ }
+
+ {
+ using namespace gsoc::result_of;
+
+ typedef const gsoc::vector<float> f;
+ static_assert(std::is_same<deref<begin<f>::type>::type,const float&>::value,"");
+ static_assert(std::is_same<deref<advance_c<begin<f>::type,0>::type>::type,const float&>::value,"");
+
+ }
+
+ {
                 gsoc::vector<moveable,moveable> c;
                 gsoc::vector<moveable,moveable> d;
                 c=std::move(d);

Modified: sandbox/SOC/2009/fusion/mini-fusion/vector.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/mini-fusion/vector.hpp (original)
+++ sandbox/SOC/2009/fusion/mini-fusion/vector.hpp 2009-04-24 20:05:51 EDT (Fri, 24 Apr 2009)
@@ -22,6 +22,7 @@
                 class vector_iterator_tag;
                 template<class Vector,std::size_t Index> class vector_iterator
                 {
+ template<class,class>friend class is_compareable;
                         friend class result_of::impl::end<vector_tag>;
                         friend class result_of::impl::begin<vector_tag>;
                         friend class result_of::impl::advance_c<vector_iterator_tag>;
@@ -43,6 +44,18 @@
                                 _vector(vector)
                         {
                         }
+
+ public:
+ vector_iterator(const vector_iterator& other_iterator):
+ _vector(other_iterator._vector)
+ {
+ }
+
+ vector_iterator& operator=(const vector_iterator& other_iterator)
+ {
+ _vector=other_iterator._vector;
+ return *this;
+ }
                 };
 
                 template<class... Elements> class vector_impl;
@@ -210,6 +223,11 @@
                                 public:
                                         typedef gsoc::detail::vector_iterator<Vector,0> type;
 
+ static type call(Vector&& vector)
+ {
+ return type(vector);
+ }
+
                                         static type call(Vector& vector)
                                         {
                                                 return type(vector);
@@ -232,6 +250,11 @@
                                 public:
                                         typedef gsoc::detail::vector_iterator<Vector,Vector::num_elements::value> type;
 
+ static type call(Vector&& vector)
+ {
+ return type(vector);
+ }
+
                                         static type call(Vector& vector)
                                         {
                                                 return type(vector);

Modified: sandbox/SOC/2009/fusion/workaround/conceptgcc/utility
==============================================================================
--- sandbox/SOC/2009/fusion/workaround/conceptgcc/utility (original)
+++ sandbox/SOC/2009/fusion/workaround/conceptgcc/utility 2009-04-24 20:05:51 EDT (Fri, 24 Apr 2009)
@@ -3,6 +3,8 @@
 // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
+//Missing classes in ConceptGCC's <utility> implementation
+
 #pragma once
 
 #include <type_traits>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk