Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

939 de-template BaseElmProxy over ColT #983

Merged
merged 1 commit into from
Aug 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/vt/vrt/collection/proxy_traits/proxy_elm_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace vt { namespace vrt { namespace collection {
namespace elm_proxy {

template <typename ColT, typename IndexT>
using Chain4 = LBable<ColT,IndexT,BaseCollectionElmProxy<ColT,IndexT>>;
using Chain4 = LBable<ColT,IndexT,BaseCollectionElmProxy<IndexT>>;

template <typename ColT, typename IndexT>
using Chain3 = Gettable<ColT,IndexT,Chain4<ColT,IndexT>>;
Expand Down
5 changes: 2 additions & 3 deletions src/vt/vrt/proxy/base_collection_elm_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@

namespace vt { namespace vrt { namespace collection {

template <typename ColT, typename IndexT>
template <typename IndexT>
struct BaseCollectionElmProxy {
using CollectionType = ColT;
using IndexType = IndexT;
using ProxyType = VirtualProxyType;
using ElementProxyType = BaseElmProxy<ColT, IndexT>;
using ElementProxyType = BaseElmProxy<IndexT>;

BaseCollectionElmProxy() = default;
BaseCollectionElmProxy(
Expand Down
8 changes: 4 additions & 4 deletions src/vt/vrt/proxy/base_collection_elm_proxy.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@

namespace vt { namespace vrt { namespace collection {

template <typename ColT, typename IndexT>
BaseCollectionElmProxy<ColT, IndexT>::BaseCollectionElmProxy(
template <typename IndexT>
BaseCollectionElmProxy<IndexT>::BaseCollectionElmProxy(
ProxyType const& in_col_proxy, ElementProxyType const& in_elm_proxy
) : col_proxy_(in_col_proxy), elm_proxy_(in_elm_proxy)
{ }

template <typename ColT, typename IndexT>
template <typename IndexT>
template <typename SerializerT>
void BaseCollectionElmProxy<ColT, IndexT>::serialize(SerializerT& s) {
void BaseCollectionElmProxy<IndexT>::serialize(SerializerT& s) {
s | col_proxy_ | elm_proxy_;
}

Expand Down
15 changes: 7 additions & 8 deletions src/vt/vrt/proxy/base_elm_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ namespace vt { namespace vrt { namespace collection {
static struct virtual_proxy_elm_empty { } virtual_proxy_elm_empty_tag { };
#pragma GCC diagnostic pop

template <typename ColT, typename IndexT>
template <typename IndexT>
struct BaseElmProxy {
using IndexType = IndexT;
using CollectionType = ColT;

explicit BaseElmProxy(IndexT const& in_idx)
: idx_(in_idx)
Expand Down Expand Up @@ -90,14 +89,14 @@ struct BaseElmProxy {

}}} /* end namespace vt::vrt::collection */

template <typename ColT, typename IndexT>
using ElmType = ::vt::vrt::collection::BaseElmProxy<ColT,IndexT>;
template <typename IndexT>
using ElmType = ::vt::vrt::collection::BaseElmProxy<IndexT>;

namespace std {
template <typename ColT, typename IndexT>
struct hash<ElmType<ColT,IndexT>> {
size_t operator()(ElmType<ColT,IndexT> const& in) const {
return std::hash<typename ElmType<ColT,IndexT>::IndexType>()(
template <typename IndexT>
struct hash<ElmType<IndexT>> {
size_t operator()(ElmType<IndexT> const& in) const {
return std::hash<typename ElmType<IndexT>::IndexType>()(
in.getIndex()
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/vt/vrt/proxy/collection_elm_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct VrtElmProxy : ProxyCollectionElmTraits<ColT, IndexT> {

VrtElmProxy(
VirtualProxyType const& in_col_proxy,
BaseElmProxy<ColT, IndexT> const& in_elm_proxy
BaseElmProxy<IndexT> const& in_elm_proxy
) : ProxyCollectionElmTraits<ColT, IndexT>(in_col_proxy, in_elm_proxy)
{ }

Expand Down
2 changes: 1 addition & 1 deletion src/vt/vrt/proxy/collection_proxy.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ CollectionProxy<ColT, IndexT>::operator()(Tp&& tp, Tn&&... tn) const {
template <typename ColT, typename IndexT>
typename CollectionProxy<ColT, IndexT>::ElmProxyType
CollectionProxy<ColT, IndexT>::index(IndexT const& idx) const {
return ElmProxyType{this->proxy_,BaseElmProxy<ColT, IndexT>{idx}};
return ElmProxyType{this->proxy_,BaseElmProxy<IndexT>{idx}};
}

template <typename ColT, typename IndexT>
Expand Down
2 changes: 1 addition & 1 deletion src/vt/vrt/proxy/collection_proxy_untyped.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace vt { namespace vrt { namespace collection {
template <typename ColT, typename IndexT>
CollectionUntypedProxy::ElmProxyType<ColT, IndexT>
CollectionUntypedProxy::index(IndexT const& idx) const {
return ElmProxyType<ColT, IndexT>{proxy_,BaseElmProxy<ColT,IndexT>{idx}};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can ColT also be removed from ElmProxyType?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite possibly, but let's integrate this in small steps, so that we don't generate merge conflicts all over the place with a long-lived, sprawling PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check into the specific possibility (i.e. looking for uses of the template parameter) and open an issue if you believe it to be feasible.

return ElmProxyType<ColT, IndexT>{proxy_,BaseElmProxy<IndexT>{idx}};
}

template <typename ColT, typename IndexT>
Expand Down