<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: AbsoluteGoddus</title>
    <description>The latest articles on DEV Community by AbsoluteGoddus (@absolutegoddus).</description>
    <link>https://dev.to/absolutegoddus</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1510737%2Fe18407ba-bd6f-4053-a39e-c1055dc20e5d.png</url>
      <title>DEV Community: AbsoluteGoddus</title>
      <link>https://dev.to/absolutegoddus</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/absolutegoddus"/>
    <language>en</language>
    <item>
      <title>Weird Error while working with std:unique_ptr</title>
      <dc:creator>AbsoluteGoddus</dc:creator>
      <pubDate>Tue, 21 May 2024 13:33:59 +0000</pubDate>
      <link>https://dev.to/absolutegoddus/weird-error-while-working-with-stduniqueptr-15fi</link>
      <guid>https://dev.to/absolutegoddus/weird-error-while-working-with-stduniqueptr-15fi</guid>
      <description>&lt;p&gt;I'm currently developing my own game engine, C-Engine, and I've hit an unexpected roadblock while implementing scenes. Suddenly, I encountered an error that has left me stumped.&lt;/p&gt;

&lt;p&gt;the error seems to be something along the lines of&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;In file included from C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/vector:65,
                 from F:/Cpp/C-Engine/engine/headers.hpp:20,
                 from F:/Cpp/C-Engine/engine/GameObject.hpp:8,
                 from F:/Cpp/C-Engine/engine/engine.hpp:8,
                 from F:/Cpp/C-Engine/main.cpp:1:
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_uninitialized.h: In instantiation of 'constexpr bool std::__check_constructible() [with _ValueType = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;; _Tp = const unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;&amp;amp;]':
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_uninitialized.h:182:4:   required from '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator&amp;lt;const unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*, vector&amp;lt;unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt; &amp;gt;; _ForwardIterator = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*]'
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_uninitialized.h:373:37:   required from 'constexpr _ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, allocator&amp;lt;_Tp&amp;gt;&amp;amp;) [with _InputIterator = __gnu_cxx::__normal_iterator&amp;lt;const unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*, vector&amp;lt;unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt; &amp;gt;; _ForwardIterator = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*; _Tp = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;]'
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_vector.h:601:31:   required from 'constexpr std::vector&amp;lt;_Tp, _Alloc&amp;gt;::vector(const std::vector&amp;lt;_Tp, _Alloc&amp;gt;&amp;amp;) [with _Tp = std::unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;; _Alloc = std::allocator&amp;lt;std::unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt;]'
F:/Cpp/C-Engine/engine/GameObject.hpp:13:11:   required from here
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_uninitialized.h:90:56: error: static assertion failed: result type must be constructible from input type
   90 |       static_assert(is_constructible&amp;lt;_ValueType, _Tp&amp;gt;::value,
      |                                                        ^~~~~
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_uninitialized.h:90:56: note: 'std::integral_constant&amp;lt;bool, false&amp;gt;::value' evaluates to false
In file included from C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_iterator.h:85,
                 from C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_algobase.h:67,
                 from C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/specfun.h:43,
                 from C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/cmath:3716,
                 from F:/Tools/Vulkan/Include/glm/exponential.hpp:21,
                 from F:/Tools/Vulkan/Include/glm/detail/func_geometric.inl:1,
                 from F:/Tools/Vulkan/Include/glm/geometric.hpp:116,
                 from F:/Tools/Vulkan/Include/glm/detail/func_matrix.inl:1,
                 from F:/Tools/Vulkan/Include/glm/matrix.hpp:161,
                 from F:/Tools/Vulkan/Include/glm/detail/type_mat4x4.inl:1,
                 from F:/Tools/Vulkan/Include/glm/detail/type_mat4x4.hpp:188,
                 from F:/Tools/Vulkan/Include/glm/ext/matrix_double4x4.hpp:5,
                 from F:/Tools/Vulkan/Include/glm/mat4x4.hpp:5,
                 from F:/Cpp/C-Engine/engine/headers.hpp:15:
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_construct.h: In instantiation of 'constexpr void std::_Construct(_Tp*, _Args&amp;amp;&amp;amp; ...) [with _Tp = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;; _Args = {const unique_ptr&amp;lt;engine::GameObjectBehavior, default_delete&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt;&amp;amp;}]':
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_uninitialized.h:120:21:   required from 'constexpr _ForwardIterator std::__do_uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator&amp;lt;const unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*, vector&amp;lt;unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt; &amp;gt;; _ForwardIterator = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*]'
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_uninitialized.h:371:30:   required from 'constexpr _ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, allocator&amp;lt;_Tp&amp;gt;&amp;amp;) [with _InputIterator = __gnu_cxx::__normal_iterator&amp;lt;const unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*, vector&amp;lt;unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt; &amp;gt;; _ForwardIterator = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*; _Tp = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;]'
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_vector.h:601:31:   required from 'constexpr std::vector&amp;lt;_Tp, _Alloc&amp;gt;::vector(const std::vector&amp;lt;_Tp, _Alloc&amp;gt;&amp;amp;) [with _Tp = std::unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;; _Alloc = std::allocator&amp;lt;std::unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt;]'
F:/Cpp/C-Engine/engine/GameObject.hpp:13:11:   required from here
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_construct.h:115:28: error: no matching function for call to 'construct_at(std::unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*&amp;amp;, const std::unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;&amp;amp;)'
  115 |           std::construct_at(__p, std::forward&amp;lt;_Args&amp;gt;(__args)...);
      |           ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_construct.h:94:5: note: candidate: 'template&amp;lt;class _Tp, class ... _Args&amp;gt; constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&amp;amp;&amp;amp; ...)'
   94 |     construct_at(_Tp* __location, _Args&amp;amp;&amp;amp;... __args)
      |     ^~~~~~~~~~~~
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_construct.h:94:5: note:   template argument deduction/substitution failed:
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_construct.h: In substitution of 'template&amp;lt;class _Tp, class ... _Args&amp;gt; constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&amp;amp;&amp;amp; ...) [with _Tp = std::unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;; _Args = {const std::unique_ptr&amp;lt;engine::GameObjectBehavior, std::default_delete&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt;&amp;amp;}]':
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_construct.h:115:21:   required from 'constexpr void std::_Construct(_Tp*, _Args&amp;amp;&amp;amp; ...) [with _Tp = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;; _Args = {const unique_ptr&amp;lt;engine::GameObjectBehavior, default_delete&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt;&amp;amp;}]'
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_uninitialized.h:120:21:   required from 'constexpr _ForwardIterator std::__do_uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator&amp;lt;const unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*, vector&amp;lt;unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt; &amp;gt;; _ForwardIterator = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*]'
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_uninitialized.h:371:30:   required from 'constexpr _ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, allocator&amp;lt;_Tp&amp;gt;&amp;amp;) [with _InputIterator = __gnu_cxx::__normal_iterator&amp;lt;const unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*, vector&amp;lt;unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt; &amp;gt;; _ForwardIterator = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*; _Tp = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;]'
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_vector.h:601:31:   required from 'constexpr std::vector&amp;lt;_Tp, _Alloc&amp;gt;::vector(const std::vector&amp;lt;_Tp, _Alloc&amp;gt;&amp;amp;) [with _Tp = std::unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;; _Alloc = std::allocator&amp;lt;std::unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt;]'
F:/Cpp/C-Engine/engine/GameObject.hpp:13:11:   required from here
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_construct.h:96:17: error: use of deleted function 'std::unique_ptr&amp;lt;_Tp, _Dp&amp;gt;::unique_ptr(const std::unique_ptr&amp;lt;_Tp, _Dp&amp;gt;&amp;amp;) [with _Tp = engine::GameObjectBehavior; _Dp = std::default_delete&amp;lt;engine::GameObjectBehavior&amp;gt;]'
   96 |     -&amp;gt; decltype(::new((void*)0) _Tp(std::declval&amp;lt;_Args&amp;gt;()...))
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/std_thread.h:43,
                 from C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/stop_token:37,
                 from C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/thread:42,
                 from F:/Cpp/C-Engine/engine/headers.hpp:22:
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/unique_ptr.h:522:7: note: declared here
  522 |       unique_ptr(const unique_ptr&amp;amp;) = delete;
      |       ^~~~~~~~~~
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_construct.h: In instantiation of 'constexpr void std::_Construct(_Tp*, _Args&amp;amp;&amp;amp; ...) [with _Tp = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;; _Args = {const unique_ptr&amp;lt;engine::GameObjectBehavior, default_delete&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt;&amp;amp;}]':
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_uninitialized.h:120:21:   required from 'constexpr _ForwardIterator std::__do_uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator&amp;lt;const unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*, vector&amp;lt;unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt; &amp;gt;; _ForwardIterator = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*]'
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_uninitialized.h:371:30:   required from 'constexpr _ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, allocator&amp;lt;_Tp&amp;gt;&amp;amp;) [with _InputIterator = __gnu_cxx::__normal_iterator&amp;lt;const unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*, vector&amp;lt;unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt; &amp;gt;; _ForwardIterator = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;*; _Tp = unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;]'
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_vector.h:601:31:   required from 'constexpr std::vector&amp;lt;_Tp, _Alloc&amp;gt;::vector(const std::vector&amp;lt;_Tp, _Alloc&amp;gt;&amp;amp;) [with _Tp = std::unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;; _Alloc = std::allocator&amp;lt;std::unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt; &amp;gt;]'
F:/Cpp/C-Engine/engine/GameObject.hpp:13:11:   required from here
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/stl_construct.h:119:7: error: use of deleted function 'std::unique_ptr&amp;lt;_Tp, _Dp&amp;gt;::unique_ptr(const std::unique_ptr&amp;lt;_Tp, _Dp&amp;gt;&amp;amp;) [with _Tp = engine::GameObjectBehavior; _Dp = std::default_delete&amp;lt;engine::GameObjectBehavior&amp;gt;]'
  119 |       ::new((void*)__p) _Tp(std::forward&amp;lt;_Args&amp;gt;(__args)...);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/absol/AppData/Local/Programs/CLion/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/unique_ptr.h:522:7: note: declared here
  522 |       unique_ptr(const unique_ptr&amp;amp;) = delete;
      |       ^~~~~~~~~~
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Complete error is on github if you wan't to look at it. (&lt;a href="https://github.com/AbsoluteGoddus/C-Engine/blob/main/error.txt"&gt;https://github.com/AbsoluteGoddus/C-Engine/blob/main/error.txt&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;I've tried to seperate the error but can't seem to fin the source but im suspecting that the error is somere in here&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//
// Created by absol on 5/20/2024.
//

#ifndef C_ENGINE_SCENE_HPP
#define C_ENGINE_SCENE_HPP

#include "headers.hpp"
#include "GameObject.hpp"

namespace engine {
    class Scene {
    private:
        std::vector&amp;lt;GameObject&amp;gt; gameObjects;

    public:
        std::string name;
        long int ID;

        void pushObject(GameObject object) {
            gameObjects.push_back(std::move(object));
        }

        void init() {
            for (auto &amp;amp;object : gameObjects) {
                object.init();
            }
        }

        void update() {
            for (auto &amp;amp;object : gameObjects) {
                object.preUpdate();
            }

            for (auto &amp;amp;object : gameObjects) {
                object.update();
            }

            for (auto &amp;amp;object : gameObjects) {
                object.postUpdate();
            }
        }

        GameObject* getObjectById(long int ID) {
            for (auto &amp;amp;object : gameObjects) {
                if (object.ID == ID) {
                    return &amp;amp;object;
                }
            }
            return nullptr;
        }

        GameObject* getObjectByName(std::string name) {
            for (auto &amp;amp;object: gameObjects) {
                if (object.name == name) {
                    return &amp;amp;object;
                }
            }
            return nullptr;
        }

        void destroy() {
            for (auto &amp;amp;object : gameObjects) {
                object.destroy();
            }
        }

        void terminate() {
            for (auto &amp;amp;object : gameObjects) {
                object.terminate();
            }
            gameObjects.clear();
        }
    };
}

#endif //C_ENGINE_SCENE_HPP

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or here&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//
// Created by absol on 5/18/2024.
//

#ifndef C_ENGINE_GAMEOBJECT_HPP
#define C_ENGINE_GAMEOBJECT_HPP

#include "headers.hpp"
#include "GameObjectBehavior.hpp"
#include "util.hpp"

namespace engine {
    class GameObject {

    public:
        GameObject() {};

        long int ID;
        std::string name;
        std::vector&amp;lt;Behavior&amp;gt; Behaviors;

        void init() {
            for (auto &amp;amp;behavior : Behaviors) {
                behavior-&amp;gt;init();
            }
        }

        void preUpdate() {
            for (auto &amp;amp;behavior : Behaviors) {
                behavior-&amp;gt;preUpdate();
            }
        }

        void update() {
            for (auto &amp;amp;behavior : Behaviors) {
                behavior-&amp;gt;update();
            }
        }

        void postUpdate() {
            for (auto &amp;amp;behavior : Behaviors) {
                behavior-&amp;gt;postUpdate();
            }
        }

        void destroy() {
            for (auto &amp;amp;behavior : Behaviors) {
                behavior-&amp;gt;destroy();
            }
        }

        void terminate() {
            for (auto &amp;amp;behavior : Behaviors) {
                behavior-&amp;gt;terminate();
            }
        }
    };
}

#endif //C_ENGINE_GAMEOBJECT_HPP

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or here&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#ifndef C_ENGINE_GAMEOBJECTBEHAVIOR_HPP
#define C_ENGINE_GAMEOBJECTBEHAVIOR_HPP

namespace engine {
    class GameObjectBehavior {
    public:
        virtual void init() {
            // Definition for init
        }

        virtual void preUpdate() {
            // Definition for preUpdate
        }

        virtual void update() {
            // Definition for update
        }

        virtual void postUpdate() {
            // Definition for postUpdate
        }

        virtual void destroy() {
            // Definition for destroy
        }

        virtual void terminate() {
            // Definition for termination
        }
    };
}

#endif //C_ENGINE_GAMEOBJECTBEHAVIOR_HPP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Util.hpp is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using Behavior = std::unique_ptr&amp;lt;engine::GameObjectBehavior&amp;gt;;

template &amp;lt;typename T&amp;gt;
Behavior make_behavior() {
    return std::make_unique&amp;lt;T&amp;gt;();
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(Sorry for bad Grammar)&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>gameengine</category>
    </item>
  </channel>
</rss>
