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

Use of std::cbegin causes problems with custom storage classes. #63

Closed
shiozaki opened this issue Jul 26, 2014 · 5 comments
Closed

Use of std::cbegin causes problems with custom storage classes. #63

shiozaki opened this issue Jul 26, 2014 · 5 comments
Assignees

Comments

@shiozaki
Copy link
Contributor

Recent changes by Ed breaks BAGEL. In short, that is because my custom storage class has a member function cbegin, but there is no std::cbegin(my_storage).

Yes I know there are cbegin(strorage) and storage.cbegin(), and the former is more fashionable these days in the light of C++11, but I believe introducing a new requirement for mere philosophy is a bad idea.

My suggestion is to use storage.begin() and to wait till std::cbegin is part of the standard.

@shiozaki
Copy link
Contributor Author

The following is the error. The last version that worked with BAGEL was the one right after Telluride.

../../../btas/tensorview_iterator.h: In instantiation of 'const typename btas::TensorViewIterator<Range, Storage>::base_type::reference btas::TensorViewIterator<Range, Storage>::operator*() const [with Range = btas::RangeNd<(CBLAS_ORDER)102u>; Storage = const bagel::varray<double>; typename btas::TensorViewIterator<Range, Storage>::base_type::reference = const double&]':
../../../src/math/matrix_base.h:276:49:   required from 'void bagel::Matrix_base<DataType>::copy_block(int, int, int, int, btas::TensorView2<DataType>) [with DataType = double; btas::TensorView2<DataType> = btas::TensorView<double, btas::RangeNd<(CBLAS_ORDER)102u>, bagel::varray<double>, btas::TensorViewPolicy<(btas::TensorViewPolicy_ConstnessPolicy)1u> >]'
../../../src/math/matrix_base.cc:28:23:   required from here
../../../btas/tensorview_iterator.h:96:42: error: no matching function for call to 'cbegin(const bagel::varray<double>&)'
         return *(cbegin(storageref_.get()) + *iter_);

@shiozaki
Copy link
Contributor Author

842b0a5 was the one that worked fine.

@shiozaki
Copy link
Contributor Author

Even if I change that to storage.cbegin(), it does not compile (too many errors to assess...).
I guess there should be a test case that uses a custom storage class that is compliant with BTAS spec. Also see #50 that is still open and has not been addressed.

@evaleev
Copy link
Member

evaleev commented Jul 28, 2014

@shiozaki this is leftover from trying to use T* as Storage ... did not work well (required reimplementation of reference_wrapper<T*> or metaprogramming).

In 02675d8 implemented std::cbegin/cend/other missing pieces if C++14 is not available. Your classes now should be usable. Please add a separate issue for the compilation errors.

@evaleev evaleev closed this as completed Jul 28, 2014
@shiozaki
Copy link
Contributor Author

Thanks. Also the recent changes seem to have fixed the compilation problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants