Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52976 - in sandbox/SOC/2009/fusion/workaround: . conceptgcc conceptgcc/test conceptgcc/test/mini-fusion
From: mr.chr.schmidt_at_[hidden]
Date: 2009-05-13 15:48:03


Author: cschmidt
Date: 2009-05-13 15:47:59 EDT (Wed, 13 May 2009)
New Revision: 52976
URL: http://svn.boost.org/trac/boost/changeset/52976

Log:
cleanup
Added:
   sandbox/SOC/2009/fusion/workaround/
   sandbox/SOC/2009/fusion/workaround/conceptgcc/
   sandbox/SOC/2009/fusion/workaround/conceptgcc/test/
   sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/
   sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/Jamfile.v2 (contents, props changed)
   sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/categories.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/concepts.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/convenience.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/test.cpp (contents, props changed)
   sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/vector.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/workaround/conceptgcc/utility (contents, props changed)

Added: sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/Jamfile.v2 2009-05-13 15:47:59 EDT (Wed, 13 May 2009)
@@ -0,0 +1,8 @@
+# Copyright Christopher Schmidt 2009.
+# 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)
+
+exe mini-fusion : [ glob *.cpp ]
+# : <toolset>gcc-conceptgcc
+ ;

Added: sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/categories.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/categories.hpp 2009-05-13 15:47:59 EDT (Wed, 13 May 2009)
@@ -0,0 +1,15 @@
+// Copyright Christopher Schmidt 2009.
+// 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)
+#pragma once
+
+namespace boost{namespace fusion{namespace gsoc{
+ class forward_iterator_category;
+ class bidirectional_iterator_category;
+ class random_access_iterator_category;
+
+ class forward_sequence_category;
+ class bidirectional_sequence_category;
+ class random_access_sequence_category;
+}}}

Added: sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/concepts.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/concepts.hpp 2009-05-13 15:47:59 EDT (Wed, 13 May 2009)
@@ -0,0 +1,77 @@
+// Copyright Christopher Schmidt 2009.
+// 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)
+#pragma once
+
+#include <concepts>
+
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/contains.hpp>
+#include <boost/mpl/bool.hpp>
+
+namespace boost{namespace fusion{namespace gsoc{
+ //Fusion-iterators and sequences are defined through a set of (meta-)functions rather than their own public interface.
+ //Unfortunately some of these (meta-)functions are not valid for specific valid types (e.g. next is invalid on an end
+ //iterator). We also need arguments for most (meta-)functions, which cannot be provided easily in the context of a concept.
+ //Therefore we ignore these (meta-)functions here.
+
+ namespace detail
+ {
+ typedef mpl::vector<forward_iterator_category,bidirectional_iterator_category,random_access_iterator_category> forward_iterator_categories;
+ typedef mpl::vector<bidirectional_iterator_category,random_access_iterator_category> bidirectional_iterator_categories;
+ typedef mpl::vector<random_access_iterator_category> random_access_iterator_categories;
+ }
+
+ auto concept ForwardIterator<class Iterator> :
+ std::CopyConstructible<Iterator>//, std::HasEqualTo<Iterator,Iterator>, std::HasNotEqualTo<Iterator,Iterator>
+ {
+ typename tag=typename Iterator::tag;
+ typename category=typename Iterator::category;
+
+ //requires std::SameType<mpl::contains<detail::forward_iterator_categories,tag>::type,mpl::true_>; segfaults in ConceptGCC!
+ typename detail_is_valid=typename mpl::contains<detail::forward_iterator_categories,category>::type;
+ requires std::SameType<detail_is_valid,mpl::true_>;
+ }
+
+ auto concept BidirectionalIterator<class Iterator> : ForwardIterator<Iterator>
+ {
+ typename detail_is_valid=typename mpl::contains<detail::bidirectional_iterator_categories,category>::type;
+ requires std::SameType<detail_is_valid,mpl::true_>;
+ }
+
+ auto concept RandomAccessIterator<class Iterator> : BidirectionalIterator<Iterator>
+ {
+ typename detail_is_valid=typename mpl::contains<detail::random_access_iterator_categories,category>::type;
+ requires std::SameType<detail_is_valid,mpl::true_>;
+ }
+
+ namespace detail
+ {
+ typedef mpl::vector<forward_sequence_category,bidirectional_sequence_category,random_access_sequence_category> forward_sequence_categories;
+ typedef mpl::vector<bidirectional_sequence_category,random_access_sequence_category> bidirectional_sequence_categories;
+ typedef mpl::vector<random_access_sequence_category> random_access_sequence_categories;
+ }
+
+ auto concept ForwardSequence<class Sequence> :
+ std::CopyConstructible<Sequence>//, std::HasEqualTo<Sequence,Sequence>, std::HasNotEqualTo<Sequence,Sequence>
+ {
+ typename tag=typename Sequence::tag;
+ typename category=typename Sequence::category;
+
+ typename detail_is_valid=typename mpl::contains<detail::forward_sequence_categories,category>::type;
+ requires std::SameType<detail_is_valid,mpl::true_>;
+ }
+
+ auto concept BidirectionalSequence<class Sequence> : ForwardSequence<Sequence>
+ {
+ typename detail_is_valid=typename mpl::contains<detail::bidirectional_sequence_categories,category>::type;
+ requires std::SameType<detail_is_valid,mpl::true_>;
+ }
+
+ auto concept RandomAccessSequence<class Sequence> : BidirectionalSequence<Sequence>
+ {
+ typename detail_is_valid=typename mpl::contains<detail::random_access_sequence_categories,category>::type;
+ requires std::SameType<detail_is_valid,mpl::true_>;
+ }
+}}}

Added: sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/convenience.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/convenience.hpp 2009-05-13 15:47:59 EDT (Wed, 13 May 2009)
@@ -0,0 +1,348 @@
+// Copyright Christopher Schmidt 2009.
+// 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)
+#pragma once
+
+//TODO: constexpr
+
+#include "categories.hpp"
+#include "concepts.hpp"
+
+#include <type_traits>
+#include <cstddef>
+
+#include <boost/mpl/bool.hpp>
+
+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:
+ typedef boost::mpl::false_ type;
+ };
+ }
+
+ //begin
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<class Tag>class begin
+ {
+ static_assert(detail::always_false<Tag>::type::value, "Unsupported sequence");
+ };
+ }
+
+ template<class Sequence> class begin:
+ public impl::begin<typename Sequence::tag>::template apply<Sequence>
+ {
+ };
+ }
+ template<class Sequence> typename result_of::begin<typename std::remove_reference<Sequence>::type>::type begin(Sequence&& sequence)
+ {
+ return result_of::begin<typename std::remove_reference<Sequence>::type>::call(std::forward<Sequence>(sequence));
+ }
+ template<class Sequence> typename result_of::begin<const Sequence>::type begin(const Sequence& sequence)
+ {
+ return result_of::begin<const Sequence>::call(sequence);
+ }
+
+ //end
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<class Tag>class end
+ {
+ static_assert(detail::always_false<Tag>::type::value, "Unsupported sequence");
+ };
+ }
+
+ template<class Sequence>class end:
+ public impl::end<typename Sequence::tag>::template apply<Sequence>
+ {
+ };
+ }
+ template<class Sequence> typename result_of::end<typename std::remove_reference<Sequence>::type>::type end(Sequence&& sequence)
+ {
+ return result_of::end<typename std::remove_reference<Sequence>::type>::call(std::forward<Sequence>(sequence));
+ }
+ template<class Sequence> typename result_of::end<const Sequence>::type end(const Sequence& sequence)
+ {
+ return result_of::end<const Sequence>::call(sequence);
+ }
+
+ //advance_c
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<class Tag>class advance_c
+ {
+ static_assert(detail::always_false<Tag>::type::value, "Unsupported iterator");
+ };
+ }
+
+ template<class Iterator,int Distance> class advance_c:
+ public impl::advance_c<typename Iterator::tag>::template apply<Iterator,Distance>
+ {
+ };
+ }
+ template<int Distance,class Iterator> typename result_of::advance_c<Iterator,Distance>::type advance_c(const Iterator& iterator)
+ {
+ return result_of::advance_c<Iterator,Distance>::call(iterator);
+ }
+
+ //distance
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<class Tag>class distance
+ {
+ static_assert(detail::always_false<Tag>::type::value, "Unsupported iterator");
+ };
+ }
+
+ template<class IteratorA,class IteratorB>class distance:
+ private detail::is_compareable<IteratorA,IteratorB>,
+ public impl::distance<typename IteratorA::tag>::template apply<IteratorA,IteratorB>
+ {
+ };
+ }
+ template<class IteratorA,class IteratorB> typename result_of::distance<IteratorA,IteratorB>::type
+ distance(const IteratorA& iteratora,const IteratorB& iteratorb)
+ {
+ return typename result_of::distance<IteratorA,IteratorB>::type();
+ }
+
+ //next
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<class Tag>class next
+ {
+ public:
+ template<class Iterator>class apply
+ {
+ public:
+ typedef typename result_of::advance_c<Iterator,1>::type type;
+
+ static type call(const Iterator& iterator)
+ {
+ return gsoc::advance_c<1>(iterator);
+ }
+ };
+ };
+ }
+
+ template<class Iterator>class next:
+ public impl::next<typename Iterator::tag>::template apply<Iterator>
+ {
+ };
+ }
+ template<class Iterator> typename result_of::next<Iterator>::type next(const Iterator& iterator)
+ {
+ return result_of::next<Iterator>::call(iterator);
+ }
+
+ //prior
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<class Tag>class prior
+ {
+ public:
+ template<class Iterator>class apply
+ {
+ public:
+ typedef typename result_of::advance_c<Iterator,-1>::type type;
+
+ static type call(const Iterator& iterator)
+ {
+ return gsoc::advance_c<-1>(iterator);
+ }
+ };
+ };
+ }
+
+ template<class Iterator>class prior:
+ public impl::prior<typename Iterator::tag>::template apply<Iterator>
+ {
+ };
+ }
+ template<class Iterator> typename result_of::prior<Iterator>::type prior(const Iterator& iterator)
+ {
+ return result_of::prior<Iterator>::call(iterator);
+ }
+
+ //equal_to
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<class Tag>class equal_to
+ {
+ public:
+ template<class IteratorA,class IteratorB>class apply
+ {
+ public:
+ typedef mpl::bool_<std::is_same<
+ typename std::add_const<IteratorA>::type,
+ typename std::add_const<IteratorB>::type>::value> type;
+ };
+ };
+ }
+
+ 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>
+ {
+ };
+ }
+ template<class IteratorA,class IteratorB> typename result_of::equal_to<IteratorA,IteratorB>::type
+ equal_to(const IteratorA& iteratora,const IteratorB& iteratorb)
+ {
+ return typename result_of::equal_to<IteratorA,IteratorB>::type();
+ }
+
+ //size
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<class Tag>class size
+ {
+ public:
+ template<class Sequence>class apply:
+ public result_of::distance<typename result_of::begin<Sequence>::type,typename result_of::end<Sequence>::type>
+ {
+ };
+ };
+ }
+
+ template<class Sequence>class size :
+ public impl::size<typename Sequence::tag>::template apply<Sequence>
+ {
+ };
+ }
+ template<class Sequence> typename result_of::size<Sequence>::type size(const Sequence&)
+ {
+ return typename result_of::size<Sequence>::type();
+ }
+
+ //empty
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<class Tag>class empty
+ {
+ public:
+ template<class Sequence> class apply
+ {
+ public:
+ typedef mpl::bool_<result_of::equal_to<
+ typename result_of::begin<Sequence>::type,
+ typename result_of::end<Sequence>::type>::type::value> type;
+ };
+ };
+ }
+
+ template<class Sequence>class empty:
+ public impl::empty<typename Sequence::tag>::template apply<Sequence>
+ {
+ };
+ }
+ template<class Sequence> typename result_of::empty<Sequence>::type empty(const Sequence&)
+ {
+ return typename result_of::empty<Sequence>::type();
+ }
+
+ //value_of
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<class Tag>class value_of
+ {
+ static_assert(detail::always_false<Tag>::type::value, "Unsupported iterator");
+ };
+ }
+
+ template<class Iterator>class value_of:
+ public impl::value_of<typename Iterator::tag>::template apply<Iterator>
+ {
+ };
+ }
+
+ //deref
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<class Tag>class deref
+ {
+ static_assert(detail::always_false<Tag>::type::value, "Unsupported iterator");
+ };
+ }
+
+ template<class Iterator>class deref:
+ public impl::deref<typename Iterator::tag>::template apply<Iterator>
+ {
+ };
+ }
+ template<class Iterator>typename result_of::deref<Iterator>::type deref(const Iterator& iterator)
+ {
+ return result_of::deref<Iterator>::call(iterator);
+ }
+
+ //at_c
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<class Tag>class at_c
+ {
+ public:
+ template<class Container,std::size_t Index>class apply
+ {
+ public:
+ typedef typename result_of::deref<
+ typename result_of::advance_c<typename result_of::begin<Container>::type,Index>::type>::type type;
+
+ static type call(Container& container)
+ {
+ return gsoc::deref(gsoc::advance_c<Index>(gsoc::begin(container)));
+ }
+ };
+ };
+ }
+
+ template<class Container,std::size_t Index>class at_c:
+ public impl::at_c<typename Container::tag>::template apply<Container,Index>
+ {
+ };
+ }
+
+ template<std::size_t Index,class Container>typename result_of::at_c<const Container,Index>::type at_c(const Container& container)
+ {
+ return result_of::at_c<const Container,Index>::call(container);
+ }
+
+ template<std::size_t Index,class Container>typename result_of::at_c<Container,Index>::type at_c(Container& container)
+ {
+ return result_of::at_c<Container,Index>::call(container);
+ }
+}}}
+

Added: sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/test.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/test.cpp 2009-05-13 15:47:59 EDT (Wed, 13 May 2009)
@@ -0,0 +1,147 @@
+// Copyright Christopher Schmidt 2009.
+// 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)
+
+//!!!These are my local testfiles - hardly any comments, "#pragma once" in headers and #include "" etc.!!!
+
+#include "vector.hpp"
+#include "convenience.hpp"
+#include "concepts.hpp"
+
+#include <cassert>
+
+class copyable
+{
+public:
+ copyable()
+ {
+ }
+ copyable(const copyable&)
+ {
+ }
+ copyable& operator=(const copyable&)
+ {
+ return *this;
+ }
+};
+
+class moveable
+{
+private:
+ moveable(const moveable&);
+
+public:
+ moveable()
+ {
+ }
+ moveable(moveable&&)
+ {
+ }
+ moveable& operator=(moveable&&)
+ {
+ return *this;
+ }
+};
+
+int main()
+{
+ namespace gsoc=boost::fusion::gsoc;
+
+ {
+ typedef gsoc::vector<> at;
+
+ {
+ using namespace gsoc::result_of;
+ static_assert(equal_to<advance_c<begin<at>::type,0>::type,end<at>::type>::type::value,"");
+ static_assert(!distance<begin<at>::type,end<at>::type>::type::value,"");
+ static_assert(!size<at>::type::value,"");
+ static_assert(empty<at>::type::value,"");
+ }
+
+ {
+ at a;
+
+ using namespace gsoc;
+ assert(equal_to(advance_c<0>(begin(a)),end(a)));
+ assert(!distance(begin(a),end(a)));
+ assert(!size(a));
+ assert(empty(a));
+ }
+ }
+
+ {
+ typedef gsoc::vector<long long,float,char> bt;
+
+ {
+ using namespace gsoc::result_of;
+ static_assert(equal_to<advance_c<begin<bt>::type,3>::type,end<bt>::type>::type::value,"");
+ static_assert(distance<begin<bt>::type,end<bt>::type>::type::value==3,"");
+ static_assert(distance<next<begin<bt>::type>::type,prior<end<bt>::type>::type>::type::value==1,"");
+ static_assert(size<bt>::type::value==3,"");
+ static_assert(!empty<bt>::type::value,"");
+
+ static_assert(std::is_same<value_of<begin<bt>::type>::type,long long>::value,"");
+ }
+
+ {
+ bt b(0xDEADBEEF,1337.0f,42);
+
+ using namespace gsoc;
+ assert(equal_to(advance_c<3>(begin(b)),end(b)));
+ assert(distance(begin(b),end(b))==3);
+ assert(distance(next(begin(b)),prior(end(b)))==1);
+ assert(size(b)==3);
+ assert(!empty(b));
+
+ assert(deref(begin(b))==0xDEADBEEF);
+ at_c<0>(b)=0xBEEFDEEF;
+ assert(at_c<0>(b)==0xBEEFDEEF);
+ }
+
+ {
+ bt b(0xDEADBEEF,1337.0f,42);
+
+ using namespace gsoc;
+ assert(deref(begin(b))==0xDEADBEEF);
+ 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);
+ }
+
+ {
+ gsoc::vector<copyable,copyable> c;
+ gsoc::vector<copyable,copyable> d;
+ c=d;
+ c=std::move(d);
+ }
+
+ {
+ gsoc::vector<moveable,copyable> c;
+ gsoc::vector<moveable,copyable> d;
+ c=std::move(d);
+ }
+
+ return 0;
+}

Added: sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/vector.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/workaround/conceptgcc/test/mini-fusion/vector.hpp 2009-05-13 15:47:59 EDT (Wed, 13 May 2009)
@@ -0,0 +1,382 @@
+// Copyright Christopher Schmidt 2009.
+// 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)
+#pragma once
+
+#include "categories.hpp"
+#include "convenience.hpp"
+
+#include <utility>
+#include <type_traits>
+#include <cstddef>
+
+#include <boost/mpl/size_t.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/identity.hpp>
+
+namespace boost{namespace fusion{namespace gsoc{
+ class vector_tag;
+
+ namespace detail
+ {
+ 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>;
+ friend class result_of::impl::distance<vector_iterator_tag>;
+ friend class result_of::impl::value_of<vector_iterator_tag>;
+ friend class result_of::impl::deref<vector_iterator_tag>;
+
+ public:
+ typedef random_access_iterator_category category;
+ typedef vector_iterator_tag tag;
+ typedef mpl::bool_<std::is_const<Vector>::value> is_const;
+
+ private:
+ typedef Vector sequence;
+ typedef mpl::size_t<Index> index;
+
+ Vector& _vector;
+
+ vector_iterator(Vector& vector):
+ _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;
+ template<> class vector_impl<>{};
+
+ template<class Head,class...Other>class vector_impl<Head,Other...> :
+ public vector_impl<Other...>
+ {
+ public:
+ friend class result_of::impl::deref<detail::vector_iterator_tag>;
+
+ typedef vector_impl<Other...> base;
+ typedef Head head_type;
+
+ private:
+ Head _element;
+
+ public:
+ vector_impl()
+ {
+ }
+
+ vector_impl(const vector_impl& other_impl):
+ base(static_cast<const base&>(other_impl)),
+ _element(other_impl._element)
+ {
+ }
+
+ vector_impl(vector_impl&& other_impl):
+ base(std::move(static_cast<base&>(other_impl))),
+ _element(std::move(other_impl._element))
+ {
+ }
+
+ template<class OtherHead,class... OtherElements>vector_impl(const OtherHead& other_head,const OtherElements&... other_elements):
+ base(other_elements...),
+ _element(other_head)
+ {
+ }
+
+ template<class OtherHead,class... OtherElements>vector_impl(OtherHead&& other_head,OtherElements&&... other_elements):
+ base(std::forward<OtherElements>(other_elements)...),
+ _element(std::forward<OtherHead>(other_head))
+ {
+ }
+
+ template<class OtherHead,class... OtherElements>vector_impl(const vector_impl<OtherHead,OtherElements...>& other_impl):
+ base(static_cast<const typename vector_impl<OtherHead,OtherElements...>::base&>(other_impl)),
+ _element(other_impl._element)
+ {
+ }
+
+ template<class OtherHead,class... OtherElements>vector_impl(vector_impl<OtherHead,OtherElements...>&& other_impl):
+ base(std::move(static_cast<typename vector_impl<OtherHead,OtherElements...>::base&>(other_impl))),
+ _element(std::move(other_impl._element))
+ {
+ }
+
+ void operator=(const vector_impl& other_impl)
+ {
+ _element=other_impl._element;
+ static_cast<base&>(*this)=static_cast<const base&>(other_impl);
+ }
+
+ void operator=(vector_impl&& other_impl)
+ {
+ _element=std::move(other_impl._element);
+ static_cast<base&>(*this)=std::move(static_cast<base&>(other_impl));
+ }
+
+ template<class OtherHead,class... OtherElements>void operator=(const vector_impl<OtherHead,OtherElements...>& other_impl)
+ {
+ _element=other_impl._element;
+ static_cast<base&>(*this)=static_cast<const typename vector_impl<OtherHead,OtherElements...>::base&>(other_impl);
+ }
+
+ template<class OtherHead,class... OtherElements>void operator=(vector_impl<OtherHead,OtherElements...>&& other_impl)
+ {
+ _element=std::move(other_impl._element);
+ static_cast<base&>(*this)=std::move(static_cast<typename vector_impl<OtherHead,OtherElements...>::base&>(other_impl));
+ }
+ };
+ }
+
+ template<class... Elements>class vector:
+ private detail::vector_impl<Elements...>
+ {
+ friend class result_of::impl::end<vector_tag>;
+ friend class result_of::impl::begin<vector_tag>;
+ friend class result_of::impl::value_of<detail::vector_iterator_tag>;
+ friend class result_of::impl::deref<detail::vector_iterator_tag>;
+
+ private:
+ typedef detail::vector_impl<Elements...> base;
+ typedef mpl::size_t<sizeof...(Elements)> num_elements;
+
+ public:
+ typedef random_access_sequence_category category;
+ typedef vector_tag tag;
+
+ vector()
+ {
+ }
+
+ vector(const vector& other_vector):
+ base(other_vector)
+ {
+ }
+
+ vector(vector&& other_vector):
+ base(std::move(other_vector))
+ {
+ }
+
+ template<class... OtherElements> vector(const vector<OtherElements...>& other_vector):
+ base(other_vector)
+ {
+ }
+
+ template<class... OtherElements> vector(vector<OtherElements...>&& other_vector):
+ base(std::move(other_vector))
+ {
+ }
+
+ template<class... OtherElements> explicit vector(const OtherElements&... other_elements):
+ base(std::forward<OtherElements>(other_elements)...)
+ {
+ }
+
+ template<class... OtherElements> explicit vector(OtherElements&&... other_elements):
+ base(std::forward<OtherElements>(other_elements)...)
+ {
+ }
+
+ /*template<class OtherSequence> vector(OtherSequence&& other_sequence)
+ {
+ }
+
+ template<class OtherSequence> vector(const OtherSequence& other_sequence)
+ {
+ }*/
+
+ vector& operator=(const vector& other_vector)
+ {
+ static_cast<base&>(*this)=other_vector;
+ return *this;
+ }
+
+ vector& operator=(vector&& other_vector)
+ {
+ static_cast<base&>(*this)=std::move(other_vector);
+ return *this;
+ }
+ };
+
+ //begin
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<>class begin<vector_tag>
+ {
+ public:
+ template<class Vector>class apply
+ {
+ 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);
+ }
+ };
+ };
+ }
+ }
+
+ //end
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<>class end<vector_tag>
+ {
+ public:
+ template<class Vector> class apply
+ {
+ 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);
+ }
+ };
+ };
+ }
+ }
+
+ //advance_c
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<>class advance_c<gsoc::detail::vector_iterator_tag>
+ {
+ public:
+ template<class Iterator,int Distance>class apply
+ {
+ public:
+ typedef gsoc::detail::vector_iterator<typename Iterator::sequence,Iterator::index::value+Distance> type;
+
+ static type call(const Iterator& iterator)
+ {
+ return type(iterator._vector);
+ }
+ };
+ };
+ }
+ }
+
+ //distance
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<>class distance<gsoc::detail::vector_iterator_tag>
+ {
+ public:
+ template<class IteratorA,class IteratorB>class apply
+ {
+ public:
+ typedef mpl::size_t<IteratorB::index::value-IteratorA::index::value> type;
+ };
+ };
+ }
+ }
+
+ //value_of
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<>class value_of<gsoc::detail::vector_iterator_tag>
+ {
+ public:
+ template<class Iterator>class apply
+ {
+ private:
+ template<class VectorImpl,std::size_t Counter>class impl
+ {
+ public:
+ typedef typename mpl::eval_if_c<!Counter,
+ mpl::identity<typename VectorImpl::head_type>,
+ impl<typename VectorImpl::base,Counter-1> >::type type;
+ };
+
+ public:
+ typedef typename impl<typename Iterator::sequence::base,Iterator::index::value>::type type;
+ };
+ };
+ }
+ }
+
+ //deref
+ namespace result_of
+ {
+ namespace impl
+ {
+ template<>class deref<gsoc::detail::vector_iterator_tag>
+ {
+ public:
+ template<class Iterator>class apply
+ {
+ private:
+ typedef typename result_of::value_of<Iterator>::type value_type;
+ public:
+ typedef typename std::add_reference<
+ typename std::conditional<Iterator::is_const::value,typename std::add_const<value_type>::type,value_type>::type
+ >::type type;
+
+ private:
+ template<std::size_t Index,class VectorImpl>static typename std::enable_if<!Index,type>::type impl(VectorImpl& impl)
+ {
+ return impl._element;
+ }
+
+ template<std::size_t Index,class VectorImpl>static typename std::enable_if<Index,type>::type impl(VectorImpl& impl)
+ {
+ return impl<Index-1>(static_cast<typename VectorImpl::base&>(impl));
+ }
+
+ template<std::size_t Index,class VectorImpl>static typename std::enable_if<!Index,type>::type impl(const VectorImpl& impl)
+ {
+ return impl._element;
+ }
+
+ template<std::size_t Index,class VectorImpl>static typename std::enable_if<Index,type>::type impl(const VectorImpl& impl)
+ {
+ return impl<Index-1>(static_cast<const typename VectorImpl::base&>(impl));
+ }
+
+ public:
+ static type call(const Iterator& iterator)
+ {
+ return impl<Iterator::index::value>(iterator._vector);
+ }
+ };
+ };
+ }
+ }
+}}}

Added: sandbox/SOC/2009/fusion/workaround/conceptgcc/utility
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/workaround/conceptgcc/utility 2009-05-13 15:47:59 EDT (Wed, 13 May 2009)
@@ -0,0 +1,67 @@
+// Copyright Christopher Schmidt 2009.
+// 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)
+
+//Missing classes in ConceptGCC's <utility> implementation
+#ifndef WORKAROUND_CONCEPTGCC_UTILITY
+#define WORKAROUND_CONCEPTGCC_UTILITY
+
+#include <type_traits>
+#include_next <utility>
+
+namespace std
+{
+ template<bool, class>class enable_if
+ {
+ };
+
+ template<class Type>class enable_if<true, Type>
+ {
+ public:
+ typedef Type type;
+ };
+
+ template<bool, class TrueType, class>class conditional
+ {
+ public:
+ typedef TrueType type;
+ };
+
+ template<class TrueType, class FalseType>
+ class conditional<false, TrueType, FalseType>
+ {
+ public:
+ typedef FalseType type;
+ };
+
+ namespace detail
+ {
+ //20.3.2...
+ template<class Type>struct identity
+ {
+ typedef Type type;
+ };
+ }
+
+ template<class Type>
+ Type&& forward(typename detail::identity<Type>::type&& type)
+ {
+ return type;
+ }
+
+ template<class Type>
+ typename remove_reference<Type>::type&& move(Type&& type)
+ {
+ return type;
+ }
+
+ template<class Type> void swap(Type& a, Type& b)
+ {
+ Type temp = move(a);
+ a = move(b);
+ b = move(temp);
+ }
+}
+
+#endif


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