OSDN Git Service

adapter/operator/bit/not.hpp Add.
authormyun2 <myun2@nwhite.info>
Wed, 6 Jun 2012 17:38:28 +0000 (02:38 +0900)
committermyun2 <myun2@nwhite.info>
Wed, 6 Jun 2012 17:38:28 +0000 (02:38 +0900)
roast/include/roast/adapter/operator/bit/not.hpp [new file with mode: 0644]

diff --git a/roast/include/roast/adapter/operator/bit/not.hpp b/roast/include/roast/adapter/operator/bit/not.hpp
new file mode 100644 (file)
index 0000000..158cd3f
--- /dev/null
@@ -0,0 +1,47 @@
+//     Roast+ License
+
+/*
+*/
+#ifndef __SFJP_ROAST__adapter__operator__bit__not_HPP__
+#define __SFJP_ROAST__adapter__operator__bit__not_HPP__
+
+namespace roast
+{
+       namespace adapter
+       {
+               /////////////////////////////////////////////////////////////////////////
+               
+               template <typename _ValueType>
+               class bit_not_adapter
+               {
+               protected:
+                       virtual _ValueType bit_not() const =0;
+                       
+               public:
+                       _ValueType operator ~() const {
+                               return bit_not();
+                       }
+               };
+               
+               /////////////////////////////////////////////////////////////////////////
+               
+               template <typename _Facade, typename _ValueType>
+               class value_bit_not_adapter : public bit_not_adapter<_ValueType>
+               {
+               private:
+                       _ValueType& m_value;
+               protected:
+                       _ValueType bit_not() const {
+                               return ~m_value;
+                       }
+               public:
+                       value_bit_not_adapter(_ValueType& value_ref) : m_value(value_ref) {}
+               };
+               
+               /////////////////////////////////////////////////////////////////////////
+       }
+       
+       using namespace adapter;
+}
+
+#endif//__SFJP_ROAST__adapter__operator__bit__not_HPP__