как сделать модификатор для мультииндекса структуры с общим указателем, чтобы увеличить серверную часть регистратора, чтобы сбросить эту внутреннюю часть?

Я пытаюсь изменить мультииндекс структур, структура имеет элемент, который является общим указателем, чтобы повысить общий указатель регистратора для бэкэнда, внешнего интерфейса и регистратора.
По своей природе мультииндекса каждая структура считается константой при создании итератора.
Поэтому, когда я возьмите итератор с помощью find или equal_range для определенного индекса, этот итератор является константным.
когда я пытаюсь изменить общий указатель члена структуры, чтобы сбросить его, он дает мне ошибку и не будет компилироваться.
это ошибка:

cannot convert 'this' pointer from 'const boost::shared_ptr<boost::log::v2s_mt_nt6::sinks::text_file_backend>' to 'boost::shared_ptr<boost::log::v2s_mt_nt6::sinks::text_file_backend> &'

а это модификатор:

if (it_US_MUS_update->BackendSharedPointer.unique() == true)
            {
                assert(US_MUS_index.modify(it_US_MUS_update, change_BSP(it_US_MUS_update->BackendSharedPointer.reset())));
                //assert(it_US_MUS_update->BackendSharedPointer.reset());
            }
            else if (it_US_MUS_update->BackendSharedPointer.unique() != true)
            {
                throw;
            }

а это определение модификатора change_BSP:

struct change_BSP
{
change_BSP(const boost::shared_ptr<sinks::text_file_backend> & new_BSP) :new_BSP_m(new_BSP) {}

void operator()(Log_file_Dur_Sig_F_Map_struct& e)
{
    e.BackendSharedPointer = new_BSP_m;
}

private:
boost::shared_ptr<sinks::text_file_backend> new_BSP_m;
};

Что я делаю неправильно? почему элемент общего указателя считается константным??
на что указывает «этот» указатель???мультииндексный контейнер или структура или общий указатель члена структуры или объект, на который указывает общий указатель или модификатор struct change_BSP???
если нужно больше кода, я отредактирую, но я не хочу загромождать вопрос ненужным кодом?

это файлы:

//targetver.h //https://mega.nz/#!eDpmDARL!rmuyRtJUO3D6BbiUGUPYS2ZTMcTUxiLuTGcNgihkLOw
//stdafx.cpp
//    https://mega.nz/#!TKgiTaqT!GCEh7seVt41e2GsfNLpzJwA5nRvdilQ0NWgtUenPuSk
//stdafx.h
//    https://mega.nz/#!jTg2TKiQ!fOTHl9VQQuMbjGtfLi1hu4PZFAycimKob21GaE7nc7I




1- https://mega.nz/#!WW4gyCrS!wRE7PV1Qsi5-xza-kQgDaQK80ImgWwi9yDmqiQJQXo0  
2- https://mega.nz/#!eLxCQSbI!BE8bMK6p7NTqK88fqSOWvPJ3WyhKYRP3juNiQNcgwBU  
3- https://mega.nz/#!fSwAyCba!fZHUVNWiuMlonMnvhQTPcSInKoICdBn_7rBw6uX8V9U

файл 1: my_logger_class_single_map_reduced.h

    //#pragma once
#ifndef MY_LOGGER_CLASS_SINGLE_MAP_O_H   // if my_logger.h hasn't been included yet...
#define MY_LOGGER_CLASS_SINGLE_MAP_O_H   //   #define this so the compiler knows it has been included

#include <boost/config.hpp>

#if !defined(NDEBUG)
#define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING
#define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE
#endif

#include <boost/multi_index_container.hpp>
#include <boost/multi_index/composite_key.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>

using boost::multi_index_container;
using namespace boost::multi_index;


#include <algorithm>
#include <iterator>
#include <string>
#include <iostream>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <vector>

#include <boost/log/core.hpp>
#include <boost/log/expressions.hpp>
#include <boost/log/sinks/unlocked_frontend.hpp>
#include <boost/log/sinks/basic_sink_backend.hpp>
#include <boost/log/sinks/frontend_requirements.hpp>
#include <boost/log/sources/severity_channel_logger.hpp>
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log/sinks/sync_frontend.hpp>
#include <boost/log/sinks/text_file_backend.hpp>
//for cout logger
#include <boost/log/sinks/text_ostream_backend.hpp>
#include <boost/core/null_deleter.hpp>

#include <boost/log/attributes.hpp> //for attr:
#include <boost/log/sources/logger.hpp> //for loggers
#include <boost/log/common.hpp> //for macros

#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/log/support/date_time.hpp>

#include <boost/bimap.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/unordered_set_of.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/bimap/vector_of.hpp>
#include <boost/bimap/list_of.hpp>
using namespace boost::bimaps;

#include <boost/ref.hpp>

#include <boost/filesystem.hpp>
using namespace boost::filesystem;

////#include "boost_create_directory_2.h"

#include "boost/date_time/gregorian/gregorian.hpp" //include all types plus i/o
using namespace boost::gregorian;

#include <boost/fusion/adapted/struct.hpp>
#include <boost/fusion/include/for_each.hpp>
#include <boost/phoenix/phoenix.hpp>
using boost::phoenix::arg_names::arg1;

//=============================================================

namespace sinks = boost::log::sinks;
namespace logging = boost::log;
namespace keywords = boost::log::keywords;
namespace expr = boost::log::expressions;
namespace attrs = boost::log::attributes;
namespace src = boost::log::sources;

// Complete sink type
typedef sinks::synchronous_sink< sinks::text_file_backend > file_sink;
//for cout logger
typedef sinks::synchronous_sink< sinks::text_ostream_backend > cout_sink;
//make the RCF ban map using US USvalue and duration
struct RCF_Ban_Map_struct   //
{
    std::string Duration = "";
    std::string UniqueSignal = "";
    std::string UniqueSignalvalue = "";

    RCF_Ban_Map_struct()
    {
    }

    RCF_Ban_Map_struct(const std::string& duration, const std::string& UniqueSignal, std::string const& UniqueSignalvalue) : Duration(duration), UniqueSignal(UniqueSignal), UniqueSignalvalue(UniqueSignalvalue)
    {
    }

    //bool operator<(const Log_file_Dur_Sig_F_Map_struct& e)const { return Duration < e.Duration; }

};

struct change_D_RCF_Ban_Map_struct
{
    change_D_RCF_Ban_Map_struct(const std::string& new_D) :new_D_m(new_D) {}

    void operator()(RCF_Ban_Map_struct& e)
    {
        e.Duration = new_D_m;
    }

private:
    std::string new_D_m;
};
struct change_US_RCF_Ban_Map_struct
{
    change_US_RCF_Ban_Map_struct(const std::string& new_US) :new_US_m(new_US) {}

    void operator()(RCF_Ban_Map_struct& e)
    {
        e.UniqueSignal = new_US_m;
    }

private:
    std::string new_US_m;
};
struct change_USvalue_RCF_Ban_Map_struct
{
    change_USvalue_RCF_Ban_Map_struct(const std::string& new_USvalue) :new_USvalue_m(new_USvalue) {}

    void operator()(RCF_Ban_Map_struct& e)
    {
        e.UniqueSignalvalue = new_USvalue_m;
    }

private:
    std::string new_USvalue_m;
};


// tags for accessing the corresponding indices of  //
struct US_USvalue_D {};
struct D {};
struct US_USvalue {};



/*
*NB: The use of derivation here instead of simple typedef is explained in
* Compiler specifics : type hiding.
*/
////check if we need to define composite_key_compare
struct US_USvalue_D_key :composite_key <
    RCF_Ban_Map_struct,
    BOOST_MULTI_INDEX_MEMBER(RCF_Ban_Map_struct, std::string, UniqueSignal),
    BOOST_MULTI_INDEX_MEMBER(RCF_Ban_Map_struct, std::string, UniqueSignalvalue),
    BOOST_MULTI_INDEX_MEMBER(RCF_Ban_Map_struct, std::string, Duration)

> {};

// reducing symbol names through type hiding
// type hide the index specifier list within employee_set_indices

struct RCF_Ban_Map_struct_set_indices :
    indexed_by <
    ordered_non_unique<
    tag<US_USvalue_D>, US_USvalue_D_key >
    >
{};

typedef multi_index_container<
    RCF_Ban_Map_struct,
    RCF_Ban_Map_struct_set_indices
> RCF_Ban_Map_struct_set;

typedef RCF_Ban_Map_struct_set::index<US_USvalue_D>::type RCF_Ban_Map_struct_set_by_US_USvalue_D;

BOOST_FUSION_ADAPT_STRUCT(RCF_Ban_Map_struct, (std::string, UniqueSignal)(std::string, UniqueSignalvalue) (std::string, Duration));

struct Log_file_Dur_Sig_F_Map_struct   //Duration_Signal_Folder_Map_struct >>>log file destination
{

    int         Id;
    std::string Duration;
    std::string FolderDuration;//??
    std::string FolderDurationSpecefied;
    std::string FolderDurationPathString;//??
    std::string FolderDurationSpecefiedPathString;

    //make fields for UniqueSignal and ModifiedUniqueSignal
    std::string UniqueSignal = "";
    std::string ModifiedUniqueSignal = "";
    std::string ModifiedUniqueSignalCertainUniqueSignal = "";

    std::string FolderDurationSpecefiedUniqueSignal="";
    std::string FolderDurationSpecefiedUniqueSignalPathString = "";
    std::string FolderDurationSpecefiedModifiedUniqueSignalCertainUniqueSignal="";
    std::string FolderDurationSpecefiedModifiedUniqueSignalCertainUniqueSignalPathString = "";

    //5
    //make fields for Backend
    std::string UniqueSignalvalue = "";
    std::string BackendName{ "" };
    std::string BackendFileName{ "" };
    std::string BackendFileNamePathString{ "" };
    std::string BackendFileNamePathString_parent{ "" };
    boost::shared_ptr<sinks::text_file_backend> BackendSharedPointer{ nullptr };//12-23-2019 study shared pointer //default constructed empty

    //make fields for logger
    std::string loggerChannelName{""};
    boost::shared_ptr<src::channel_logger_mt<>> loggerChannelSharedPointer{ nullptr };//default constructed empty

    //make fields for FrontendName
    std::string FrontendName { "" };    
    boost::shared_ptr<file_sink> FrontendSharedPointer{ nullptr };//default constructed empty

    Log_file_Dur_Sig_F_Map_struct(const std::string& duration, const std::string& folderdurationspecefied, std::string const& folderdurationspecefiedpathstring, const path folderdurationspecefiedpath) : Duration(duration), FolderDurationSpecefied(folderdurationspecefied), FolderDurationSpecefiedPathString(folderdurationspecefiedpathstring)
    {
        if (duration == "AllTime")
        {
            Id = 0;
        }
        else if (duration == "Yearly")
        {
            Id = 1;
        }
        else if (duration == "Monthly")
        {
            Id = 2;
        }
        else if (duration == "Daily")
        {
            Id = 3;
        }

        FolderDuration = folderdurationspecefiedpath.parent_path().filename().generic_string();//why i get Duration in arguments???>>>>>>>>>>>>>>>>>>>>x1>>because duration means the time duration and FolderDuration means the folder built for time duration which include certain time like 2019 or 00 month...
        FolderDurationPathString = folderdurationspecefiedpath.parent_path().generic_string() ;
    }
    bool operator<(const Log_file_Dur_Sig_F_Map_struct& e)const { return Id<e.Id; }
};

BOOST_FUSION_ADAPT_STRUCT(Log_file_Dur_Sig_F_Map_struct, (int, Id)(std::string, Duration)(std::string, FolderDuration)(std::string, FolderDurationSpecefied)(std::string, FolderDurationPathString)(std::string, FolderDurationSpecefiedPathString)(std::string, UniqueSignal)(std::string, ModifiedUniqueSignal)(std::string, ModifiedUniqueSignalCertainUniqueSignal)(std::string, FolderDurationSpecefiedUniqueSignal)(std::string, FolderDurationSpecefiedUniqueSignalPathString)(std::string, FolderDurationSpecefiedModifiedUniqueSignalCertainUniqueSignal) (std::string, FolderDurationSpecefiedModifiedUniqueSignalCertainUniqueSignalPathString) (std::string ,UniqueSignalvalue) (std::string, BackendName)(std::string, BackendFileName)(std::string, BackendFileNamePathString)  (std::string, BackendFileNamePathString_parent) (std::string ,loggerChannelName)(std::string ,FrontendName)(boost::shared_ptr<sinks::text_file_backend>, BackendSharedPointer));//12-23-2019 study shared pointer (boost::shared_ptr<sinks::text_file_backend>, BackendSharedPointer)(boost::shared_ptr<file_sink> ,FrontendSharedPointer)(boost::shared_ptr<src::channel_logger_mt<>> ,loggerChannelSharedPointer)

struct change_BName
{
    change_BName(const std::string& new_BName) :new_BName_m(new_BName) {}

    void operator()(Log_file_Dur_Sig_F_Map_struct& e)
    {
        e.BackendName = new_BName_m;
    }

private:
    std::string new_BName_m;
};

struct change_BSP
{
    change_BSP(const boost::shared_ptr<sinks::text_file_backend> & new_BSP) :new_BSP_m(new_BSP) {}

    void operator()(Log_file_Dur_Sig_F_Map_struct& e)
    {
        e.BackendSharedPointer = new_BSP_m;
    }

private:
    boost::shared_ptr<sinks::text_file_backend> new_BSP_m;
};

struct change_LCSP
{
    change_LCSP(const boost::shared_ptr<src::channel_logger_mt<>> &new_LCSP) :new_LCSP_m(new_LCSP) {}

    void operator()(Log_file_Dur_Sig_F_Map_struct& e)
    {
        e.loggerChannelSharedPointer = new_LCSP_m;
    }

private:
    boost::shared_ptr<src::channel_logger_mt<>> new_LCSP_m;
};

struct change_FSP
{
    change_FSP(const boost::shared_ptr<file_sink> &new_FSP) :new_FSP_m(new_FSP) {}

    void operator()(Log_file_Dur_Sig_F_Map_struct& e)
    {
        e.FrontendSharedPointer = new_FSP_m;
    }

private:
    boost::shared_ptr<file_sink>    new_FSP_m;
};
struct US_MUS {};

/*
*NB: The use of derivation here instead of simple typedef is explained in
* Compiler specifics : type hiding.
*/
////check if we need to define composite_key_compare
struct US_MUS_key :composite_key <
    Log_file_Dur_Sig_F_Map_struct,
    BOOST_MULTI_INDEX_MEMBER(Log_file_Dur_Sig_F_Map_struct, std::string, UniqueSignal), 
    BOOST_MULTI_INDEX_MEMBER(Log_file_Dur_Sig_F_Map_struct, std::string, ModifiedUniqueSignal)
> {};

// reducing symbol names through type hiding
// type hide the index specifier list within employee_set_indices

struct Log_file_Dur_Sig_F_Map_struct_set_indices :
    indexed_by <    
    ordered_non_unique<
    tag<US_MUS>, US_MUS_key >
    >
{};

typedef multi_index_container<
    Log_file_Dur_Sig_F_Map_struct,
    Log_file_Dur_Sig_F_Map_struct_set_indices
> Log_file_Dur_Sig_F_Map_struct_set;

typedef Log_file_Dur_Sig_F_Map_struct_set::index<US_MUS>::type Log_file_Dur_Sig_F_Map_struct_set_by_US_MUS;

class LoggingClass_2
{
private:
    RCF_Ban_Map_struct_set RCF_Ban_Map;

    Log_file_Dur_Sig_F_Map_struct_set Log_file_Dur_Sig_F_Map;
    static boost::bimap<set_of<std::string>, set_of<std::string>> mMUS_Map; 
    std::vector<const Log_file_Dur_Sig_F_Map_struct *> vector_new_structs;

    //make UniqueSignal vector
    static std::vector<std::string>  UniqueSignalVector;
    //make UniqueSignal map
    static std::map<std::string,unsigned int>  mlogUS_SizeMap;

    // create a cout backend
    boost::shared_ptr< sinks::text_ostream_backend > backendCout = boost::make_shared< sinks::text_ostream_backend >();

    // create a cout frontend   
    boost::shared_ptr< cout_sink > sink_cout = boost::make_shared<cout_sink>(backendCout);  

public:
    LoggingClass_2();//it automatically defines where log files are stored
    LoggingClass_2(std::string, std::string);

    void CreateUpdateLoggingStructure(std::string, std::string);
    void CreateUpdate_RCF_Ban_Map(std::string, std::string);

    void RotateLogFile(boost::shared_ptr< file_sink >);
    void init_file_collecting_path(boost::shared_ptr< file_sink >, std::string);
    src::channel_logger_mt<> mloggerCoutLog{ keywords::channel = "m_cout_log" };

    //getting the instance of core singleton class
    boost::shared_ptr< logging::core > core = logging::core::get();

    // Setup the common formatter for all sinks
    logging::formatter fmt;
};
#endif//MY_LOGGER_CLASS_SINGLE_MAP_O_H

файл 2: my_logger_class_single_map_reduced.cpp

//#include "../../stdafx.h"
#include "stdafx.h"
//#include "../../stdafx.h"
#include "my_logger_class_single_map_reduced.h"
//allUniqueSignalResponsesOfSameValue 00 00 00 Or 01 01 01 or 200 200 200 Or 404 404 404
std::string allUniqueSignalResponsesOfSameValue{ "ARS_" };// AllRespSame_ = ARS_

//allUniqueSignalResponses 00 01 02 01 19 or 200 200 200 400 404 404 >>>>>>>>>>>>>single file
std::string allUniqueSignalResponsesTogether{ "AR_" };//AllResp_ = AR_

//allUniqueSignalResponsesForFirstTime  00 01 02 04 22 or 200 300 500 400 404 >>>>>>>>>>>>>>>>>>>>single file
std::string allUniqueSignalResponsesForFirstTimeTogether{ "ARF_" };// AllRespFirst_ = ARF_

//UniqueSignalResponseOfCertainValueForFirstTime  00 Or 01 or 300 Or 200 Or 404
std::string UniqueSignalResponseOfCertainValueForFirstTime{ "RCF_" };// RespCertainFirst_= RCF_

boost::bimap<set_of<std::string>, set_of<std::string>> LoggingClass_2::mMUS_Map;


std::vector<std::string>  LoggingClass_2::UniqueSignalVector;
std::map<std::string, unsigned int>  LoggingClass_2::mlogUS_SizeMap;

//==========================================================================
LoggingClass_2::LoggingClass_2()
{
    LoggingClass_2::mMUS_Map.left.insert(boost::bimap<set_of<std::string>, set_of<std::string>>::left_value_type("allUniqueSignalResponsesOfSameValue", allUniqueSignalResponsesOfSameValue));
    LoggingClass_2::mMUS_Map.left.insert(boost::bimap<set_of<std::string>, set_of<std::string>>::left_value_type("allUniqueSignalResponsesTogether", allUniqueSignalResponsesTogether));
    LoggingClass_2::mMUS_Map.left.insert(boost::bimap<set_of<std::string>, set_of<std::string>>::left_value_type("allUniqueSignalResponsesForFirstTimeTogether", allUniqueSignalResponsesForFirstTimeTogether));
    LoggingClass_2::mMUS_Map.left.insert(boost::bimap<set_of<std::string>, set_of<std::string>>::left_value_type("UniqueSignalResponseOfCertainValueForFirstTime", UniqueSignalResponseOfCertainValueForFirstTime));

    backendCout->add_stream(boost::shared_ptr< std::ostream >(&std::cout, boost::null_deleter()));
    sink_cout->set_filter(expr::attr<std::string>("Channel") == "m_cout_log");//==
    sink_cout->set_formatter(fmt);
    core->add_sink(sink_cout);

    // And also add some logging core attributes
    core->add_global_attribute("TimeStamp", attrs::local_clock());
    core->add_global_attribute("RecordID", attrs::counter< unsigned int >());

    // Setup the common formatter for all sinks
    fmt = expr::format("[%1%] [%2%]  [%5%]")//[%3%] [%4%]
        % expr::format_date_time< boost::posix_time::ptime >("TimeStamp", "%Y-%m-%d %H:%M:%S.%f")
        % expr::attr<unsigned int>("ThreadID")
        //% expr::attr<string>("Scope")
        //% trivial::severity       
        % expr::smessage;


}

LoggingClass_2::LoggingClass_2(std::string pathFolder, std::string folderBehaviour)
{
    LoggingClass_2::mMUS_Map.left.insert(boost::bimap<set_of<std::string>, set_of<std::string>>::left_value_type("allUniqueSignalResponsesOfSameValue", allUniqueSignalResponsesOfSameValue));
    LoggingClass_2::mMUS_Map.left.insert(boost::bimap<set_of<std::string>, set_of<std::string>>::left_value_type("allUniqueSignalResponsesTogether", allUniqueSignalResponsesTogether));
    LoggingClass_2::mMUS_Map.left.insert(boost::bimap<set_of<std::string>, set_of<std::string>>::left_value_type("allUniqueSignalResponsesForFirstTimeTogether", allUniqueSignalResponsesForFirstTimeTogether));
    LoggingClass_2::mMUS_Map.left.insert(boost::bimap<set_of<std::string>, set_of<std::string>>::left_value_type("UniqueSignalResponseOfCertainValueForFirstTime", UniqueSignalResponseOfCertainValueForFirstTime));

    backendCout->add_stream(boost::shared_ptr< std::ostream >(&std::cout, boost::null_deleter()));
    sink_cout->set_filter(expr::attr<std::string>("Channel") == "m_cout_log");
    sink_cout->set_formatter(fmt);

    // And also add some logging core attributes
    core->add_global_attribute("TimeStamp", attrs::local_clock());
    core->add_global_attribute("RecordID", attrs::counter< unsigned int >());


    //========================================================================
    // Setup the common formatter for all sinks
    fmt = expr::format("[%1%] [%2%]  [%5%]")//[%3%] [%4%]
        % expr::format_date_time< boost::posix_time::ptime >("TimeStamp", "%Y-%m-%d %H:%M:%S.%f")
        % expr::attr<unsigned int>("ThreadID")
        //% expr::attr<string>("Scope")
        //% trivial::severity       
        % expr::smessage;


}


void LoggingClass_2::CreateUpdate_RCF_Ban_Map(std::string UniqueSignal, std::string UniqueSignalValue)
{
    //1
    RCF_Ban_Map_struct_set_by_US_USvalue_D & US_USvalue_D_index = RCF_Ban_Map.get<US_USvalue_D>();
    //2-2
    RCF_Ban_Map_struct_set_by_US_USvalue_D::iterator it_US_USvalue_D_0, it_US_USvalue_D_1;
    boost::tie(it_US_USvalue_D_0, it_US_USvalue_D_1) = US_USvalue_D_index.equal_range(boost::make_tuple(UniqueSignal, UniqueSignalValue));
    auto it_US_USvalue_D_update = it_US_USvalue_D_0;
    if (it_US_USvalue_D_0 == it_US_USvalue_D_1)
    {
        //boost::fusion::for_each(*it_US_USvalue_D_update, std::cout << arg1 << "\n");

        //RCF_Ban_Map_struct new_struct{ *it_US_USvalue_D_update };
        RCF_Ban_Map_struct new_struct{  };

        change_US_RCF_Ban_Map_struct(UniqueSignal).operator()(new_struct);
        change_USvalue_RCF_Ban_Map_struct(UniqueSignalValue).operator()(new_struct);
        //change_D(Duration).operator()(new_struct);

        bool successful_insert = false;
        RCF_Ban_Map_struct_set_by_US_USvalue_D::iterator it_US_USvalue_D_new;
        boost::tie(it_US_USvalue_D_new, successful_insert) = US_USvalue_D_index.insert(new_struct);////,FolderDuration,FolderDurationSpecefied));
                                                                                                                //here i should put code to catch error regarding insert>>>>>>>>>>>>>>>>>>>>x2>>
        assert(successful_insert);
        boost::fusion::for_each(*it_US_USvalue_D_new, std::cout << arg1 << "\n");

    }
    else if (it_US_USvalue_D_0 != it_US_USvalue_D_1)
    {
        //do nothing because value is already registered for this UniqueSignal
    }
}

//mLogModifiedUniqueSignalUpdateBackendsParametersMap???????????????????????????//

void LoggingClass_2::CreateUpdateLoggingStructure(std::string UniqueSignal, std::string UniqueSignalValue)
{
    //make RCF_ items clear
    //make index and get range having RCF_
    //using iterator clear RCF_ items to ""
    Log_file_Dur_Sig_F_Map_struct_set_by_US_MUS & US_MUS_index = Log_file_Dur_Sig_F_Map.get<US_MUS>();

    Log_file_Dur_Sig_F_Map_struct_set_by_US_MUS::iterator it_US_MUS_0, it_US_MUS_1;//, it_US_D_FD_FDS_MUS_update_original;
    boost::tie(it_US_MUS_0, it_US_MUS_1) = US_MUS_index.equal_range(boost::make_tuple(UniqueSignal, UniqueSignalResponseOfCertainValueForFirstTime));
    if (it_US_MUS_0 == it_US_MUS_1)
    {
        //error happens because there is no such US in the folder system so look at Modify_Unique_Signal
        throw;
    }
    else if (it_US_MUS_0 != it_US_MUS_1)
    {
        auto itx = it_US_MUS_1;
        std::advance(itx, -1);

        //3
        for (auto it_US_MUS_update = it_US_MUS_0; it_US_MUS_update != it_US_MUS_1;)
        {
            //std::cout << "\033[2J\033[1;1H"   << std::endl;
            std::cout << "\n" << std::endl;
            boost::fusion::for_each(*it_US_MUS_update, std::cout << arg1 << "\n");
            std::cout << US_MUS_index.count(boost::make_tuple(UniqueSignal,UniqueSignalResponseOfCertainValueForFirstTime)) << std::endl;
            boost::fusion::for_each(*itx, std::cout << arg1 << "\n");

            if (it_US_MUS_update->BackendName != "")
            {
                assert(US_MUS_index.modify(it_US_MUS_update, change_BName("")));
                //assert(US_MUS_index.modify(it_US_MUS_update, change_BSP(boost::make_shared< sinks::text_file_backend >(keywords::file_name = BackendFileName))));
                if (it_US_MUS_update->BackendSharedPointer.unique() == true)
                {
                    assert(US_MUS_index.modify(it_US_MUS_update, change_BSP(it_US_MUS_update->BackendSharedPointer.reset())));
                    //assert(it_US_MUS_update->BackendSharedPointer.reset());
                    ////assert(dynamic_pointer_cast<Log_file_Dur_Sig_F_Map_struct::BackendSharedPointer>(it_US_MUS_update->BackendSharedPointer).reset());
                    //const_cast<const foo*>(this)->bar();
                }
                else if (it_US_MUS_update->BackendSharedPointer.unique() != true)
                {
                    throw;
                }


                // Break the feeding loop
                ////it_US_MUS_update->FrontendSharedPointer->stop();

                // Flush all log records that may have left buffered
                it_US_MUS_update->FrontendSharedPointer->flush();

                if (it_US_MUS_update->ModifiedUniqueSignal == "AR_" || it_US_MUS_update->ModifiedUniqueSignal == "ARF_")
                {
                    //it_US_MUS_update->FrontendSharedPointer->reset_filter();//????????????ARS_
                    throw;
                }
                //else if (ModifiedUniqueSignal == "ARS_" || ModifiedUniqueSignal == "RCF_")
                else if (it_US_MUS_update->ModifiedUniqueSignal == "RCF_")
                {
                    it_US_MUS_update->FrontendSharedPointer->reset_filter();
                    it_US_MUS_update->FrontendSharedPointer->reset_formatter();
                    it_US_MUS_update->FrontendSharedPointer->locked_backend()->rotate_file();//???????
                    it_US_MUS_update->FrontendSharedPointer->locked_backend()->set_file_collector(sinks::file::make_collector(
                        keywords::target = ""));//< the target directory >

                }

                //??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
                if (it_US_MUS_update->FrontendSharedPointer.unique() == true)
                {
                    assert(US_MUS_index.modify(it_US_MUS_update, change_FSP(it_US_MUS_update->FrontendSharedPointer.reset())));
                }
                else if (it_US_MUS_update->FrontendSharedPointer.unique() != true)
                {
                    throw;
                }   

                // Remove the sink from the core, so that no records are passed to it
                core->remove_sink(it_US_MUS_update->FrontendSharedPointer);




                //the next line might be changed so that channel=ModifiedUniqueSignalCertainUniqueSignal with AR_,ARF_,RCF_ and channel=ModifiedUniqueSignalCertainUniqueSignalCertainValue with ARS_
                if (it_US_MUS_update->ModifiedUniqueSignal == "AR_" || it_US_MUS_update->ModifiedUniqueSignal == "ARF_")
                {
                    ////assert(US_MUS_index.modify(it_US_MUS_update, change_LCSP(boost::make_shared<src::channel_logger_mt<>>(keywords::channel = ModifiedUniqueSignalCertainUniqueSignal))));
                    throw;
                }
                ////else if (ModifiedUniqueSignal == "ARS_" || ModifiedUniqueSignal == "RCF_")
                else if (it_US_MUS_update->ModifiedUniqueSignal == "RCF_")
                {
                    ////assert(US_MUS_index.modify(it_US_MUS_update, change_LCSP(boost::make_shared<src::channel_logger_mt<>>(keywords::channel = ModifiedUniqueSignalCertainUniqueSignalCertainValue))));
                    if (it_US_MUS_update->loggerChannelSharedPointer.unique() == true)
                    {
                        assert(US_MUS_index.modify(it_US_MUS_update, change_LCSP(it_US_MUS_update->loggerChannelSharedPointer.reset())));
                    }
                    else if (it_US_MUS_update->loggerChannelSharedPointer.unique() != true)
                    {
                        throw;
                    }
                }

                boost::fusion::for_each(*it_US_MUS_update, std::cout << arg1 << "\n");
                //it_US_MUS_update_original = it_US_MUS_update;
                ++it_US_MUS_update;//5
                std::cout << "\n ++it_US_MUS_update " << std::endl;

                if (it_US_MUS_update != it_US_MUS_1)
                {
                    boost::fusion::for_each(*it_US_MUS_update, std::cout << arg1 << "\n");
                }

            }

        }

    }
}

файл 3: logging_trial_ars_single_map_reduced.cpp

// logger_class_trial_2.cpp : Defines the entry point for the console application.
//
// logger_trial.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "my_logger_class_single_map_reduced.h"
//#include "boost_create_directory_2.h"


int main()
{
  //make LoggingClass_2 instance
    LoggingClass_2 mLoggingInstance;
    BOOST_LOG(mLoggingInstance.mloggerCoutLog) << "starting program";


        std::string UniqueSignal{ "u_h" };

        for (int hour = 0; hour < 2; hour++)
        {
            std::stringstream ss_hour;
            ss_hour << std::setw(2) << std::setfill('0') << hour;
            std::string url_hour{ ss_hour.str() };
            std::stringstream().swap(ss_hour); // swap m with a default constructed stringstream

            mLoggingInstance.CreateUpdate_RCF_Ban_Map(UniqueSignal, url_hour);
            mLoggingInstance.CreateUpdateLoggingStructure(UniqueSignal, url_hour);
        }


    return 0;
}

person ahmed allam    schedule 05.01.2020    source источник
comment
Как выглядит ваша версия минимально воспроизводимого примера?   -  person Ted Lyngmo    schedule 05.01.2020
comment
я сделал минимальную пробную версию кода. надеюсь, это понятно   -  person ahmed allam    schedule 06.01.2020
comment
Не совсем. Минимальный пример не содержит весь ваш проект. Он также не требует от людей регистрации на внешних сайтах.   -  person Ted Lyngmo    schedule 06.01.2020
comment
эти 3 файла содержат связанный код, чтобы программа могла быть скомпилирована.   -  person ahmed allam    schedule 06.01.2020
comment
Воспроизводимый пример означает текст в вопросе, а не в ссылках. Минимум также подразумевает не весь ваш проект   -  person Caleth    schedule 06.01.2020
comment
Сделайте change_BSP::operator() const.   -  person Joaquín M López Muñoz    schedule 06.01.2020
comment
a+1 большое спасибо @JoaquínMLópezMuñoz, это сработало. Заставьте его ответить, и я плохо приму это   -  person ahmed allam    schedule 06.01.2020
comment
@JoaquínMLópezMuñoz, не могли бы вы сказать мне, почему использование const позволяет вызывать сброс, который изменяет общий указатель на постоянный общий указатель??? еще раз спасибо   -  person ahmed allam    schedule 06.01.2020
comment
На самом деле, я удивлен, что вы сообщаете об успехе, потому что, на первый взгляд, проблема не связана с change_BSP::operator(). Я написал ответ.   -  person Joaquín M López Muñoz    schedule 07.01.2020
comment
я тоже, когда я отлаживал код, он никогда не входил в перегрузку const .... но наличие перегрузки заставило код компилироваться ... я собирался сказать вам, когда нашел ваш комментарий   -  person ahmed allam    schedule 07.01.2020


Ответы (2)


Проблема с выражением it_US_MUS_update->BackendSharedPointer.reset() в:

assert(US_MUS_index.modify(
    it_US_MUS_update,
    change_BSP(it_US_MUS_update->BackendSharedPointer.reset())));

Поскольку it_US_MUS_update является константным итератором, it_US_MUS_update->BackendSharedPointer также рассматривается как константа и не может быть изменена на reset(). Если то, что вам нужно, это просто сбросить настройки, вам не нужно мучиться с change_BSP; вместо этого сделайте следующее:

US_MUS_index.modify(
    it_US_MUS_update,
    [](Log_file_Dur_Sig_F_Map_struct& e){ e.BackendSharedPointer.reset(); });
person Joaquín M López Muñoz    schedule 07.01.2020
comment
+1 я не хочу использовать лямбда-выражения .... наличие константной версии модификатора заставило компилировать код .... но он не использовал константную версию ???? Я удивлен. я сделал еще один модификатор со сбросом как в константной, так и в неконстантной версиях ... он работает .... но я не знаю, как наличие константной версии без ее использования заставило его работать ????? - person ahmed allam; 07.01.2020
comment
Я не могу больше помочь, потому что вы не предоставили MCVE ... единственное, что я могу сказать, это то, что it_US_MUS_update->BackendSharedPointer.reset() должно привести к ошибке компиляции независимо от того, как выглядит ваш change_BSP. - person Joaquín M López Muñoz; 07.01.2020

Что я делаю неправильно? почему член общего указателя считается константой?? на что указывает «этот» указатель??? мультииндексный контейнер или общий указатель структуры или члена структуры или объект, на который указывает общий указатель или модификатор struct change_BSP???

Ошибка компилятора относится к этому фрагменту кода:

it_US_MUS_update->BackendSharedPointer.reset()

Итератор it_US_MUS_update является константным итератором, что означает, что его operator-> возвращает константную ссылку на Log_file_Dur_Sig_F_Map_struct, поэтому указанный член BackendSharedPointer является константным. Функция-член reset() должна вызываться для неконстантного boost::shared_ptr, о чем говорит вам компилятор — this (который является указателем на boost::shared_ptr) является константным указателем, а неконстантный требуется для reset().

Конструкция change_BSP неверна и по другой причине. Этот функциональный объект будет вызываться элементом modify() индекса multi_index_container и получит ссылку на элемент контейнера, который функция должна изменить. Согласно вашему определению change_BSP, он должен установить член BackendSharedPointer в значение, полученное в конструкторе change_BSP. Но вы пытаетесь передать значение члена BackendSharedPointer конструктору change_BSP, что не имеет смысла. Что вы, вероятно, пытались сделать, так это передать значение new, которое вы хотите установить, в конструктор change_BSP. Если вы просто пытаетесь сбросить указатель, передайте построенный по умолчанию shared_ptr.

US_MUS_index.modify(it_US_MUS_update,
    change_BSP(boost::shared_ptr<sinks::text_file_backend>()));

Обратите внимание, что вы также можете изменять члены элементов multi_index_container, помеченных mutable, или используя const_cast напрямую, без вызова modify(). Просто помните, что измененные элементы не должны участвовать в ключах индекса, используемых для поиска и упорядочения.

person Andrey Semashev    schedule 09.01.2020
comment
Большое спасибо за ваш ответ. Я пытаюсь передать тот же общий указатель после сброса, чтобы избежать создания нового объекта, потому что эта модификация происходит каждый журнал. поэтому я попытался сохранить объекты и просто сбросить их..... - person ahmed allam; 09.01.2020