Skip to content

Instantly share code, notes, and snippets.

@titouancreach
Last active January 10, 2017 08:55
Show Gist options
  • Save titouancreach/4a7c7ac215cebd79a82f92808ceed695 to your computer and use it in GitHub Desktop.
Save titouancreach/4a7c7ac215cebd79a82f92808ceed695 to your computer and use it in GitHub Desktop.
Plus besoin de fonction init !
#include <iostream>
#include <cstdlib>
typedef int handle_type;
namespace uEye
{
class uEye
{
public:
handle_type getCamera() { return 1; }
};
class Memory
{
public:
Memory() = default;
Memory(Memory&& rhs) = default; // mv
Memory& operator=(Memory&& rhs) = default;
Memory& operator=(const Memory& rhs) = delete; // cpy
Memory(const Memory& rhs) = delete;
Memory(const handle_type& camera) : m_camera(camera)
{}
handle_type m_camera = { -1 };
};
}
int main(int argc, char** argv)
{
uEye::uEye uEye;
uEye::Memory memory; // constructeur par défaut
std::cout << memory.m_camera << std::endl; // -1 (objet non construit)
memory = uEye.getCamera(); // operator=(&&)
std::cout << memory.m_camera << std::endl; // 1 (objet construit et utilisable)
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment