小编Foy*_*l94的帖子

无法引用函数,因为它是已删除的函数

您好我正在从一本书中学习C++,我正在讨论下面的练习题

编写一个获取并返回istream&的函数.该函数应该读取流,直到它到达文件结尾.该函数应将其读取的内容打印到标准输出.重置流以使其在返回流之前有效.

#include "stdafx.h"
#include <iostream>
#include <istream>
#include <string>
#include <string.h>
#include <list>
#include <vector>
#include <fstream>

std::istream ReadFile(std::istream &iStream)
{
    std::string word;
    while (iStream >> word)
    {}
    std::cout << "I read value " << word << std::endl;
    iStream.setstate(std::ios::goodbit);
    return iStream;

}

int _tmain(int argc, _TCHAR* argv[])
{
    ReadFile(std::cin);

    system("pause");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

以上是我的尝试,但是我在"返回iStream"行遇到错误.

Error1 error C2280: 'std::basic_istream<char,std::char_traits<char>>::basic_istream(const std::basic_istream<char,std::char_traits<char>> &)' : attempting to reference a deleted function  

2 IntelliSense: function "std::basic_istream<_Elem, _Traits>::basic_istream(const std::basic_istream<_Elem, _Traits>::_Myt &) [with _Elem=char, _Traits=std::char_traits<char>]" (declared …
Run Code Online (Sandbox Code Playgroud)

c++

22
推荐指数
2
解决办法
5万
查看次数

在XAML中设置元素的DataContext?

嗨我正试图获得绑定的悬念.

XAML代码:

<Window x:Class="WPF_SandBox.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        Title="MainWindow" Height="350" Width="525">
    <StackPanel x:Name="stackPanel">
        <TextBox x:Name="textBox_FirstName" Width="200" Margin="0,100,0,0" Text="{Binding Path=FirstName, UpdateSourceTrigger=PropertyChanged}"  />
        <TextBox x:Name="textBox_LastName" Width="200" Margin="0,10,0,0" Text="{Binding Path=LastName, UpdateSourceTrigger=PropertyChanged}" />
        <TextBlock x:Name="textBlock_FullName"  Background="LightBlue" Width="200" Margin="0,10,0,0" Text="{Binding Path=FullName, UpdateSourceTrigger=PropertyChanged}"  />
    </StackPanel>
</Window>
Run Code Online (Sandbox Code Playgroud)

C#代码:

public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            Person person = new Person { FirstName = "Matt", LastName = "Smith" };
            stackPanel.DataContext = person;

        }
    }

    public class Person : INotifyPropertyChanged
    {
        string firstName;
        string lastName;

        public string …
Run Code Online (Sandbox Code Playgroud)

wpf

5
推荐指数
1
解决办法
1万
查看次数

ES6 模块,babel/webpack。导入/导出语句不起作用

好的,我正在学习 react、es6 和 webpack/babel。我在下面设置了我的 webpack.config:

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const merge = require('webpack-merge');
const validate = require('webpack-validator');
const parts = require('./config/webpack-parts');

const PATHS = {
    app: path.join(__dirname, 'app'),
    build: path.join(__dirname, 'build')
};

const HTMLWebpackPluginConfig = new HtmlWebpackPlugin({
    template: PATHS.app + '/index.html',
    filename: 'index.html',
    inject: 'body'
});

const common = {
    entry: {
        app: PATHS.app

    },

    output: {
        path: PATHS.build,
        filename: '[name].js'

    },

    module: {
        loaders: [
            {
                test: /\.jsx?$/,
                exclude: /node_modules/,
                loader: "babel-loader"
            }
        ]
    }, …
Run Code Online (Sandbox Code Playgroud)

javascript ecmascript-6 reactjs webpack babeljs

1
推荐指数
1
解决办法
2444
查看次数

标签 统计

babeljs ×1

c++ ×1

ecmascript-6 ×1

javascript ×1

reactjs ×1

webpack ×1

wpf ×1