Skip to content

Instantly share code, notes, and snippets.

@afabri
Created July 3, 2023 22:09
Show Gist options
  • Save afabri/1d772a2807459ad07e85450f6c7477af to your computer and use it in GitHub Desktop.
Save afabri/1d772a2807459ad07e85450f6c7477af to your computer and use it in GitHub Desktop.
#include <boost/property_map/property_map.hpp>
#include <boost/swap.hpp> // compiles if removed
#include <memory>
#include <tuple>
template <typename Type>
class No_copy_class
{
// Forbid using copy constructor
No_copy_class(const No_copy_class&) { } // compiles if not private
public:
No_copy_class() { }
};
template <typename T>
class Wrap
{
No_copy_class<int> m;
};
template <class Type>
struct Property_map
: public boost::put_get_helper<int&, Property_map<Type> >
{
int& operator[](std::size_t);
};
template<typename W>
void f(W&& w)
{
std::shared_ptr<std::tuple<W> > args; // compiles with boost::tuple
args = std::make_shared<std::tuple<W> >(std::forward<W>(w));
}
int main (int, char**)
{
Wrap<Property_map<int> > w;
f(w);
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment