Topic: Is the overload of std::begin/end generalizable to
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Fri, 09 May 2014 14:48:01 +0200
Raw View
Hi,
C++11 allows to overload std::begin/end.
Having two different overloads for the same type results on a violation
of the ODR (One Definition Rule), isn't it?
//f1.hpp
#include "X.hpp"
auto begin(X const& x) -> decltype(x.first()) {...}
//f2.hpp
#include "X.hpp"
auto begin(X const&) -> decltype(x.first()) {...}
Does it means that it is a good idea to propose non-member function
interfaces for other concepts, e.g. the functor/monad functions fmap(),
mbind(), then() that can be implemented differently depending on the
specific monad model (optional<T>, future<T> or other UDT)?
If yes, should a proposal define all the overloads for all the C++ types
that can be seen as a monad, as e.g. pointers, smart pointers,
containers, range?
Any insight on this subject is welcome.
Best,
Vicente
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
.