๐Ÿ˜Ž ๊ณต๋ถ€ํ•˜๋Š” ์ง•์ง•์•ŒํŒŒ์นด๋Š” ์ฒ˜์Œ์ด์ง€?

wsl bash ์—ด ๋•Œ๋งˆ๋‹ค LifeGoal ๋„์šฐ๊ธฐ by PICO ๋ณธ๋ฌธ

๐Ÿ‘ฉ‍๐Ÿ’ป IoT (Embedded)/C++

wsl bash ์—ด ๋•Œ๋งˆ๋‹ค LifeGoal ๋„์šฐ๊ธฐ by PICO

์ง•์ง•์•ŒํŒŒ์นด 2023. 12. 28. 15:16
728x90
๋ฐ˜์‘ํ˜•

๐Ÿ’— wsl ์—ด ๋•Œ๋งˆ๋‹ค.. ์ž๊ทน๋˜๋Š” ๋ฌธ๊ตฌ LifeGoal! ๋„์šฐ๊ธฐ

// shell์— export PICO ๋“ฑ๋ก์‹œํ‚ค๊ธฐ!!
// ์„ค์ • ํŒŒ์ผ ๋งจ ๋ฐ‘์—... ํ”„๋กœ๊ทธ๋žจ ๋„ฃ์œผ๋ฉด ๋จ

vim .bashrc

// .bashrc ์— ์ถ”๊ฐ€ํ•  ๊ฒƒ
export PICO_SDK_PATH=~/pico/pico-sdk
cd (๋‚ด ํ™ˆ ๋””๋ ‰ํ„ฐ๋ฆฌ, or main.out ํŒŒ์ผ ์œ„์น˜)
./main.out
// ๋‚˜์˜ LifeGoal ์„ wsl ์‹คํ–‰๋งˆ๋‹ค ์ƒ๊ธฐ ์‹œํ‚ค๊ธฐ
// shell์— export PICO ๋“ฑ๋ก์‹œํ‚ค๊ธฐ!!
// export PICO_SDK_PATH=~/pico/pico-sdk
// vim .bashrc
// ์„ค์ • ํŒŒ์ผ ๋งจ ๋ฐ‘์—... ํ”„๋กœ๊ทธ๋žจ ๋„ฃ์œผ๋ฉด ๋จ
// cd (๋‚ด ํ™ˆ ๋””๋ ‰ํ„ฐ๋ฆฌ)
// ./main.out

#include <string>
#include <vector>
#include <iostream>

#include <vector>
#include <boost/pfr.hpp>
#include <boost/pfr/core_name.hpp>

using namespace std;

struct NextYear
{
    vector<string> Personal;
    vector<string> Career;
    vector<string> Business;
    vector<string> Economic;
    vector<string> Toy;
    vector<string> Adventure;
    vector<string> Contrubution;
};

struct TenYear
{
    vector<string> Personal;
    vector<string> Career;
    vector<string> Business;
    vector<string> Economic;
    vector<string> Toy;
    vector<string> Adventure;
    vector<string> Contrubution;
};

struct LifeGoal
{
    struct NextYear next;
    struct TenYear ten;
};

int main()
{
    struct LifeGoal goal;

    goal.next.Personal.push_back("IT ์ทจ์—… ์ค€๋น„ ๋ฐ ํ•ฉ๊ฒฉ");
    goal.next.Career.push_back("C ๊ธฐ๋ฐ˜ ์ž„๋ฒ ๋””๋“œ ๊ต์œก์ƒ");
    goal.next.Business.push_back("์•ˆ์ •์  ๋งค์ถœ ๋งŒ๋“ค๊ธฐ");
    goal.next.Economic.push_back("์ฒญ๋…„ ์ €์ถ• ๊ฐ€์ž…");
    goal.next.Toy.push_back("์• ํ”Œ ์กฐ์ด์Šคํ‹ฑ ๊ฒŒ์ž„๊ธฐ ์‚ฌ๊ธฐ");
    goal.next.Adventure.push_back("์ „๊ตญ ํˆฌ์–ดํ•˜๊ธฐ");
    goal.next.Contrubution.push_back("์ทจ์ค€์ƒ๋“ค์—๊ฒŒ ๋ฉ˜ํ†  ๋˜์–ด์ฃผ๊ธฐ");


    goal.ten.Personal.push_back("๋งŒ๋ฌผ์˜ ์ดˆ์—ฐ๊ฒฐ์„ ์–ด์šฐ๋ฅด๋Š” ์ „๋ฌธ๊ฐ€ ๋˜๊ธฐ");
    goal.ten.Career.push_back("๋ฉ‹์Ÿ์ด ์ƒ์‚ฌ");
    goal.ten.Business.push_back("๋” ๋„“์€ ๋ถ„์•ผ ์ง„์ถœ");
    goal.ten.Economic.push_back("์žํƒ ์‚ฌ๊ธฐ");
    goal.ten.Toy.push_back("์ฆ๊ฐ•ํ˜„์‹ค (VR) ์—์„œ ์นœ๊ตฌ๋“ค ๋งŒ๋‚˜๊ธฐ");
    goal.ten.Adventure.push_back("์ŠคํŽ˜์ธ๊ฐ€์„œ ๊ฐ€์šฐ๋”” ๊ฑด์ถ•๋ฌผ ๋ณด๊ณ  ์˜๊ฐ ์–ป๊ธฐ");
    goal.ten.Contrubution.push_back("ํ•ด์™ธ ์˜๋ฃŒ ๋ด‰์‚ฌ ๊ฐ€๊ธฐ");

    cout << "------------------------------LIFE GOAL------------------------------" << endl;
    // LifeGoal ์ถœ๋ ฅ

    constexpr auto names = boost::pfr::names_as_array<LifeGoal>();

    boost::pfr::for_each_field(
        goal.next,
        [&names](const auto &fields, std::size_t idx)
        {
            // cout << idx << endl;
            cout << names[idx] << endl;

            for (auto it = fields.begin(); it < fields.end(); ++it)
            {
                auto field = *it;
                cout << "\t" << field << endl;
            }
        });


    return 0;
}

728x90
๋ฐ˜์‘ํ˜•
Comments