Created
February 21, 2014 20:36
-
-
Save mgaunard/9142922 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template<class T, class X> | |
| struct soa_proxy | |
| { | |
| BOOST_FORCEINLINE soa_proxy(native<T, X>& data_, std::size_t index_) : data(data_), index(index_) | |
| { | |
| } | |
| BOOST_FORCEINLINE soa_proxy& operator=(T const& other) const | |
| { | |
| typename dispatch::make_functor<tag::insert_, T>::type()(other, data, index); | |
| return *this; | |
| } | |
| BOOST_FORCEINLINE soa_proxy& operator=(soa_proxy const& other) const | |
| { | |
| typename dispatch::make_functor<tag::insert_, T>::type()(other(), data, index); | |
| return *this; | |
| } | |
| BOOST_FORCEINLINE operator T() const | |
| { | |
| return typename dispatch::make_functor<tag::extract_, T>::type()(data, index); | |
| } | |
| BOOST_FORCEINLINE T const operator()() const | |
| { | |
| return static_cast<T const&>(*this); | |
| } | |
| native<T, X>& data; | |
| std::size_t index; | |
| friend BOOST_FORCEINLINE bool operator!(soa_proxy const& a0) { return !a0(); } | |
| friend BOOST_FORCEINLINE bool operator==(soa_proxy const& a0, soa_proxy const& a1) { return a0() == a1(); } | |
| template<class U> friend BOOST_FORCEINLINE bool operator==(U const& a0, soa_proxy const& a1) { return a0 == a1(); } | |
| template<class U> friend BOOST_FORCEINLINE bool operator==(soa_proxy const& a0, U const& a1) { return a0() == a1; } | |
| friend BOOST_FORCEINLINE bool operator!=(soa_proxy const& a0, soa_proxy const& a1) { return a0() != a1(); } | |
| template<class U> friend BOOST_FORCEINLINE bool operator!=(U const& a0, soa_proxy const& a1) { return a0 != a1(); } | |
| template<class U> friend BOOST_FORCEINLINE bool operator!=(soa_proxy const& a0, U const& a1) { return a0() != a1; } | |
| friend BOOST_FORCEINLINE std::ostream& operator<<(std::ostream& a0, soa_proxy const& a1) { return a0 << a1(); } | |
| private: | |
| soa_proxy(soa_proxy const&); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment